meng483 mini blinds

Upload: carloncho2012

Post on 03-Apr-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 MENG483 Mini Blinds

    1/21

    1

    Mini Blinds Control System Project

    Mechatronics MENG 483

    Course Project

    Group 4

    Michael Carmody

    David Sonny Cooper

    Patrick Murray

    12/12/06

    ABSTRACT

    The project objective was to create a system that opens and closes mini blinds accordingto two defined settings, temperature and light intensity. The system will maintain thetemperature/light intensity in the room by opening and closing the blinds. The blinds and astepper motor will be mounted on a constructed wooden frame. The program asks the user tochoose a setting and define a specific value for that option. The program maintains the desiredrange by opening and closing the blinds using a stepper motor.

  • 7/28/2019 MENG483 Mini Blinds

    2/21

    30-Dec-06 Mini Blinds Control System

    2

    TABLE OF CONTENTS

    1. INTRODUCTION..............................................................................................................................................3

    2. SYSTEM DESIGN.............................................................................................................................................3Functions................................................................................................................................. 4

    2.1 Mechanical design .......................................................................................................... 4

    2.2 Electrical design.............................................................................................................. 7

    2.3 Software design............................................................................................................. 12

    2.4 System assembly........................................................................................................... 15

    3. SYSTEM TESTING ........................................................................................................................................16

    4. MATERIAL COST AND TOTAL EXPENSES............................................................................................16

    5. CONCLUSION.................................................................................................................................................17

    6. ACKNOWLEDGEMENTS.............................................................................................................................17

    7. REFERENCES.................................................................................................................................................17

    8. APPENDIX.......................................................................................................................................................18

    8.1 Appendix A: Mechanical Components......................................................................... 18

    8.1.1 Materials Used ...................................................................................................... 18

    8.1.2 Tools Used ............................................................................................................ 18

    8.2 Appendix B: Electronic components ............................................................................ 19

    8.2.1 Materials and Components Used .......................................................................... 19

    8.3 Appendix C: Software components .............................................................................. 20

  • 7/28/2019 MENG483 Mini Blinds

    3/21

    30-Dec-06 Mini Blinds Control System

    3

    1. INTRODUCTIONThe team project was to design and build an automatically adjustable mini blind system. The

    blinds will open and close according to a user defined setting. The user will set a desired

    temperature or light intensity in the room where the blinds are installed. The system will

    maintain the temperature/light intensity in the room by opening and closing the blinds.

    The opening and closing mechanism of the mini blinds will be driven by a Shinano Kenshi STP-

    42D241 stepper motor. This motor will be controlled by the MRK Board with the Motorola

    MC9HCS12 Microcontroller. The MRK board will be receiving inputs via the analog in pins

    from two PN 168 photo transistor light sensors and one TMP36 integrated circuit temperature

    sensor. The motor requires a control circuit that will be set up on a 3M solder less bread board.

    The team acquired and assembled a simple wooden frame with the mini blinds attached. The

    stand alone frame was constructed using 1 x 2 boards. A generic set of mini blinds measuring

    24 x 48 were affixed to the frame. The completed setup is shown in Appendix A. The MRK

    board, bread board, and sensors were also attached to the frame.

    2. SYSTEM DESIGNEquipment

    Microcontroller - Board with Motorola MC9HCS12 Microcontroller

    Motor Shinano Kenshi STP-42D241 stepper motor

    Temperature Sensor TMP36 Integrated Circuit Temperature Sensor Light sensor 2 PN 168 photo transistors

    Mini blinds Basic store bought mini blinds Wood test stand Fabricated basic wood planks

  • 7/28/2019 MENG483 Mini Blinds

    4/21

    30-Dec-06 Mini Blinds Control System

    4

    Functions

    Sense lighting conditions and open/close blinds to maintain a certain user defined lightintensity in room

    Sense temperature and open/close blinds to maintain a certain user defined temperature in

    room Open/close blinds on a timer Open/close blinds from direct user input

    2.1 Mechanical designFor the mechanical aspect of this project, the team decided to construct a model window frame.

    The team chose to use 1 x 2 boards and also purchased a set of blinds measuring 24 by 48. The

    frame was constructed by making a square frame measuring 26 x 47and adding two horizontal

    boards for support. The blinds were mounted on this frame 3.5 from the top of the frame to

    allow for the motor to be mounted. A stepper motor was zip tied to the frame directly above the

    blind turning mechanism. This mechanism was removed from the original setup, inverted, and

    then placed in the track on the top of the blinds. The inverted mechanism was situated directly

    beneath the stepper motor and connected using bushings and electrical tape. Using the existing

    mechanism prevented the team from having to fabricate a linkage or modifying the blinds

    structure. Also, there are 2 light sensors and 1 temperature sensor mounted on the frame. A light

    sensor was mounted at the midpoint of the frame on each side. A temperature sensor is located

    on the top of the frame. The MRK board and 3M breadboard are also secured at the top of the

    frame.

    The following pictures show the completed frame with blinds, MRK board and 3M breadboard

    locations, motor mount, and light sensor locations. Figure 1 is the completed frame before

    system components have been mounted. Figure 2 shows the stepper motor connection to the

  • 7/28/2019 MENG483 Mini Blinds

    5/21

    30-Dec-06 Mini Blinds Control System

    5

    blind turning mechanism. Figure 3 shows the frame with the MRK board and 3M breadboard

    attached. Figure 4 shows the location of the 2 light sensors on the frame.

    Figure 1: Frame Assembly

  • 7/28/2019 MENG483 Mini Blinds

    6/21

    30-Dec-06 Mini Blinds Control System

    6

    Figure 2: Mounted Motor

    Figure 3: Mounted MRK Board and Breadboard

  • 7/28/2019 MENG483 Mini Blinds

    7/21

    30-Dec-06 Mini Blinds Control System

    7

    Figure 4: Location of Light Sensors

    2.2 Electrical designThe electrical components of the system included two light sensors, one temperature sensor, one

    motor and integrated controlling circuit, the MRK controller board, and a bread board. The

    MRK board shown in Figure 5 acts as the brains of the system. It performs all operations for

    the components, and executes the C++ code.

    Figure 5: MRK Board with the Motorola MC9HCS12 Microcontroller

  • 7/28/2019 MENG483 Mini Blinds

    8/21

    30-Dec-06 Mini Blinds Control System

    8

    The temperature and light sensors used in the system are shown in Figures Figure 6 andFigure 7.

    All three sensors were connected to separate channels on the ANALOG IN pins of the MRK

    board. The signals from the three sensors are converted using the A/D converter. The converted

    signals are then processed by the Motorola microprocessor according to the C++ code contained

    in section 2.3.

    Figure 6: TMP36 Temperature Sensor

    Figure 7: PN 168 Photo Transistor

    Depending to the outcome of the program, the MRK board will send an output signal to the

    DIGITAL OUT pins to be received by the stepper motor shown in Figure 8. The motor is

  • 7/28/2019 MENG483 Mini Blinds

    9/21

    30-Dec-06 Mini Blinds Control System

    9

    connected to the DIGITAL OUT pins and its integrated controlling circuit via the bread board.

    The Motor receives its power via the LEFT MOTOR connection of the MRK board. In order for

    an adequate amount of energy to be received, the MRK board must be set on HIGH POWER

    mode. Further descriptions of electrical components can be seen in Appendix B.

    Figure 8: Shinano Kenshi STP-42D241 Stepper Motor

    The full electrical assembly of these components is seen in Figures Figure 9 and Figure 10.

    Figure 9: Components Connected to MRK Board

  • 7/28/2019 MENG483 Mini Blinds

    10/21

    30-Dec-06 Mini Blinds Control System

    10

    Figure 10: Components Connected to Bread Board

    The electrical connection diagram can be seen on the following page. It shows the connection of

    the sensors, motor, power, and computer to the MRK board.

  • 7/28/2019 MENG483 Mini Blinds

    11/21

    11

    ANALOG

    IN

    MBOAPOW

    SERIALPORT

    MO(LE

    DIGITAL OUT

    MRK BOARD

    GROUND

    POWER

    SIGNAL

    GROUND

    POWER

    SIGNAL

    GROUND

    POWER

    SIGNAL

    TO COMPUTER

    SERIAL PORT

    SIGNALS

    LIGHTSENSOR 1

    LIGHTSENSOR 2

    TEMPERATURE

    SENSOR

    STEPPER MOTOR

  • 7/28/2019 MENG483 Mini Blinds

    12/21

    12

    2.3 Software designThe two main functions of the program are to control temperature and light of the room. The

    first operation performed is a prompt to the user to select which mode to execute put the program

    in, light control or temperature control. Before the program displays the user menu, the blinds

    are opened 800 motor steps which place the blinds in the fully open position. Because of this,

    the blinds must always be place in the fully closed position in a particular direction before

    running the program.

    For the light control mode, the user will select a desired light intensity level: low, medium, or

    high. These light levels will correspond to a predetermined light sensor value. Two light sensors

    are used to get a representative value of the light level in a room. The average of all the sensor

    readings is taken and compared to the user chosen light level. If the light intensity measured is

    higher than the desired, the blinds will be closed until the conditions met. If the measured

    intensity is lower than the desired, the blinds will open until the conditions are met. This

    operation will run continuously until the user ends the loop by hitting the Q key, which will

    send the program back to the main menu. During a control process, the program will

    remember the number of steps taken by the motor. Because of this, the user can exit the

    program by pressing the E key, after which the program will return the blinds to the fully

    closed position.

    For the temperature control mode, the user will set the desired temperature of the room. One

    sensor is used to measure the temperature of the room. Like the light intensity mode, the

    measure temperature will be compared to the desired temperature and either open or close the

  • 7/28/2019 MENG483 Mini Blinds

    13/21

    30-Dec-06 Mini Blinds Control System

    13

    blinds accordingly. The user can also press the E key to exit the program and return the blinds

    to the fully closed position.

    A logic flow diagram can be seen on the following page. It follows the steps and decisions that

    the program makes once it is executed.

  • 7/28/2019 MENG483 Mini Blinds

    14/21

    14

    Motor Steps toFully Open

    Position

    Main Menu1. Light2. Temp3. Exit

    Li ht Intensit Mode Tem erature Mode

    User Selects:1. High2. Medium3. Low

    User Selects:4. Warmer5. Same6. Cooler

    Sensor Value:Averages the values

    from both sensor

    Acquires Temp fromsensor

    Steps motor incompensating

    direction (if needed)while recording

    position

    Steps motor incompensating

    direction (if needed)while recording

    position

    Checks if desiredvalue is within +/- 50units of sensor value

    Checks if desiredvalue is within +/- 3

    of sensor value

    Motor Steps to fullyclosed position

    User exits program

  • 7/28/2019 MENG483 Mini Blinds

    15/21

    15

    2.4 System assemblyCombining the mechanical and electrical components of the system was quite simple. The

    connection of the MRK microcontroller, bread board, and stepper motor and its corresponding

    integrated circuit were essentially laid out in the same manner as Lab 10 from the MENG 483

    Lab. This system was modified to accept two types of sensors and move the stepper motor

    according to the code discussed in section 2.3.

    Getting the stepper motor to move one way or another depending on the sensor inputs was

    proven to be much easier than expected. The major problem seen by the system was telling the

    program when the blinds were fully closed. Without a set of boundaries, the motor might

    continue to turn while the blinds are already closed, possibly breaking the rotational mechanism

    on the blinds or the stepper motor itself.

    Difficulties met in the C++ code were mostly associated with program flow. Problems were met

    in getting the program to immediately start the main menu upon running. Another difficulty

    was getting the program to return to the main menu after a user exits a control mode instead of

    having to run the program each time a mode change is desired. Without a return to main menu,

    the MRK board would have to be reset and the program run fresh for each change. It would be

    much more convenient for the code to run continuously and allow changes without the need to

    reset the system.

  • 7/28/2019 MENG483 Mini Blinds

    16/21

    30-Dec-06 Mini Blinds Control System

    16

    3. SYSTEM TESTINGThe sensors and motor functions work properly in the system. The group attempted to add a set

    of boundaries so that the blinds would stop opening or closing to keep from breaking the blind or

    motor components. The program is set up in such a way that the blinds must be fully closed in a

    certain position when beginning the program. The program implements a certain amount of

    motor steps from the closed position to the middle position. The group created a user-defined

    option for the light and temperature settings. The light intensity controller option allows a low,

    medium, or high setting while the temperature option required a value to be entered. These

    additional controls only partially worked, as the system would randomly freeze up from time to

    time. The group used flashlights to vary the intensity of the light sensor. Body heat was used to

    increase the temperature of the temperature sensor and was allowed to cool. When the program

    is running, it keeps a count of the position relative to the closed position. When the program is

    exited the blinds return to the fully closed position. The delay was set to be very low so that the

    blinds would open or close quickly. In reality the delay will be higher so only small changes in

    position are made. This makes it convenient for the user without the annoyance of the blinds

    opening and closing rapidly.

    4. MATERIAL COST AND TOTAL EXPENSESThe MRK board, stepper motor, and sensors were provided by the mechatronics lab. The group

    purchased the mini blinds and wood required to make a mounting frame. The total cost of these

    items was $7.23. The team also purchased zip ties and shrink fit tubing to secure several

    components of the system and frame.

  • 7/28/2019 MENG483 Mini Blinds

    17/21

    30-Dec-06 Mini Blinds Control System

    17

    5. CONCLUSIONThe group was able to successfully create the circuitry necessary to drive the stepper motor and

    utilize the light and temperature sensors. The stepper motor was attached to the top of the frame

    using zip ties. To open and close the blinds, the shaft of the motor was taped to the rotation

    mechanism on the blinds. The program performs as desired for major system actions but requires

    further development for stability and limitation factors. Further coding and/or mechanical

    features will be needed to ensure that the motor does not keep trying to rotate the blinds beyond

    the fully closed and fully open positions. Also, the user input settings require further

    development to ensure functionality and practicality.

    6. ACKNOWLEDGEMENTSWe would like to acknowledge our professor of the mechatronics class Dr. Zagrei, the teaching

    assistants Jonathan Berg, Hakan Cakan, and Jason Matthews for helping us with constructing our

    circuitry and providing us with the tools necessary to complete the project.

    7. REFERENCESAlciatore D.G. and Histand, M.B., (2005) Introduction to Mechatronics and Measurement

    Systems, McGraw-Hill, third edition.

    Bishop, R.H., (Editor) (2002) The Mechatronics Handbook, CRC press, first edition.

  • 7/28/2019 MENG483 Mini Blinds

    18/21

    30-Dec-06 Mini Blinds Control System

    18

    8. APPENDIX

    8.1 Appendix A: Mechanical Components

    8.1.1 Materials Used Mini Blinds A standard set of mini blinds for household use. Blinds measured 24 x

    48 when fully lowered

    Lumber Standard 1 x 2 pine boards to create a stand for the mini blinds to simulate a

    window frame

    Wood Screws Standard 2 deck screws to assemble boards into frame

    Wood Glue Standard wood glue to add rigidity to wooden frame

    Zip ties Standard 8 zip ties to secure motor and breadboard to test stand

    Electrical Tape Standard electrical tape used in securing motor to rotation mechanism

    of blinds and used in splicing wire connections

    8.1.2 Tools Used Miter Saw 10 electric Makita miter saw used to section wooden boards for frame

    Screw Drill 18V cordless DeWalt screw drill used to place deck screws in frame

    Screw Drivers Assorted sizes and types of screwdrivers for several uses

  • 7/28/2019 MENG483 Mini Blinds

    19/21

    30-Dec-06 Mini Blinds Control System

    19

    8.2 Appendix B: Electronic components

    8.2.1 Materials and Components Used TMP36 Temperature Sensor

    o 2.7 to 5.5 V

    o Calibrated Directly to C

    o 2% Accuracy

    o 5 C Linearity

    o -40 C to +125 C Operation

    PN 168 Photo Transistor

    o 5 30V Collector/Emitter Voltage

    o 3 mA photo current

    o -25 C +85 C operation temperature

    Shinano Kenshi STP-42D241 Stepper Motor

    o 2 phase uni-polar 6 lead

    o 12V, 3.1 ohm, 2.9 mH

    o 3 degree step angle

    o 120 steps/rev

  • 7/28/2019 MENG483 Mini Blinds

    20/21

    30-Dec-06 Mini Blinds Control System

    20

    8.3 Appendix C: Software components#include "MRK. h"

    char mode, c;

    void cr azy( void) {mode = f get char ( SCI 0) ;}void menu( void) {

    f pr i nt f ( SCI 0, "Whi ch cont r ol mode do you wi sh t o use?\ n\ r " ) ;f pr i nt f ( SCI 0, "Li ght ( L) or Temper at ur e ( T) \ n\ r " , c ) ;f pr i nt f ( SCI 0, "Press q at any t i me t o r etur n t o mai n menu. \ n\ n\ n\ n\ r " ) ;

    }

    int di gi t al _val ue, l i ght 1, l i ght 2, l i ght _ l evel , l i ght _des i red, t emp,t emp_desi r ed, st ate, hi gh, l ow ;

    intmai n( ) {

    / / Li ght I nt ens i t y Cont rol l i ngMode_____ _____ _____ _____ _____ _____ _____ _____ _____ __

    anal og_i n(RESOLUTI ON, 10) ;di gi t al _i n( OUTPUT, ALL) ;motor_out ( LEFT, 255) ;const char st ep_sequence[ ] = {0x01, 0x04, 0x02, 0x08};while (1) {

    menu( ) ;crazy();

    if ( ( mode==' L' ) | | ( mode == ' l ' ) ) {setup_sci ( SCI 0, I NTERRUPT, &cr azy) ;

    while (1) {

    del ay ( 10) ;l i ght _desi r ed = 300;l i ght 1 = anal og_i n( I N, 2) ;l i ght 2 = anal og_i n( I N, 4) ;l i ght _l evel = ( l i ght 1+l i ght 2) / 2;l ow = l i ght _l evel - 50;hi gh = l i ght _l evel + 50;f pr i nt f ( SCI 0, "Li ght Aver age: %R4u Press Q t o r eturn t o

    menu\ r " , l i ght _ l evel ) ;

    if ( hi gh >= l i ght _desi r ed) {st at e = st ate - 1;di gi t al _i n( OUT, ALL, st ep_sequence[ st at e & 0x03] ) ;

    }

    if ( l ow < l i ght _desi r ed) {st at e = st at e + 1;di gi t al _i n( OUT, ALL, st ep_sequence[ st at e & 0x03] ) ;

  • 7/28/2019 MENG483 Mini Blinds

    21/21

    30-Dec-06 Mini Blinds Control System

    21

    }

    if ( mode == ' q' ) {setup_sci ( SCI 0, I NTERRUPT, 0) ;break;

    }

    }}

    / / ___________________________________________________________________________

    / / Temperatur e Cont r olMode_____ _____ _____ _____ _____ _____ _____ _____ _____ _____ ____

    if ( ( mode==' T' ) | | ( mode == ' t ' ) ) {setup_sci ( SCI 0, I NTERRUPT, &cr azy) ;

    while (1) {

    t emp_desi r ed = 85;

    del ay ( 10) ;

    di gi t al _val ue = anal og_i n( I N, 8) ;t emp=( 71 * di gi t al _val ue) / 100 + 29;l ow = t emp - 5;hi gh = t emp + 5;f pr i nt f ( SCI 0, "Sensor : %R4u Pr ess Q t o r eturn to

    menu\ r " , t emp) ;

    if ( hi gh >= t emp_desi r ed) {st at e = st ate - 1;di gi t al _i n( OUT, ALL, st ep_sequence[ st at e & 0x03] ) ;

    }

    if ( l ow < t emp_desi r ed) {st at e = st at e + 1;di gi t al _i n( OUT, ALL, st ep_sequence[ st at e & 0x03] ) ;

    }

    if ( mode == ' q' ) {setup_sci ( SCI 0, I NTERRUPT, 0) ;break;

    }

    }

    / / ___________________________________________________________________________

    }}

    }