Sunteți pe pagina 1din 21

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 according to two defined settings, temperature and light intensity. The system will maintain the temperature/light intensity in the room by opening and closing the blinds. The blinds and a stepper motor will be mounted on a constructed wooden frame. The program asks the user to choose a setting and define a specific value for that option. The program maintains the desired range by opening and closing the blinds using a stepper motor. 1

30-Dec-06

Mini Blinds Control System

TABLE OF CONTENTS
1. 2. INTRODUCTION..............................................................................................................................................3 SYSTEM DESIGN.............................................................................................................................................3

Functions................................................................................................................................. 4 2.1 2.2 2.3 2.4


3. 4. 5. 6. 7. 8.

Mechanical design .......................................................................................................... 4 Electrical design.............................................................................................................. 7 Software design............................................................................................................. 12 System assembly........................................................................................................... 15

SYSTEM TESTING ........................................................................................................................................16 MATERIAL COST AND TOTAL EXPENSES............................................................................................16 CONCLUSION.................................................................................................................................................17 ACKNOWLEDGEMENTS.............................................................................................................................17 REFERENCES.................................................................................................................................................17 APPENDIX .......................................................................................................................................................18

8.1 8.1.1 8.1.2 8.2

Appendix A: Mechanical Components......................................................................... 18 Materials Used ...................................................................................................... 18 Tools Used ............................................................................................................ 18 Appendix B: Electronic components ............................................................................ 19 Materials and Components Used .......................................................................... 19

8.2.1 8.3

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

30-Dec-06

Mini Blinds Control System

1.

INTRODUCTION

The 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 STP42D241 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. Equipment

SYSTEM DESIGN

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

30-Dec-06 Functions

Mini Blinds Control System

Sense lighting conditions and open/close blinds to maintain a certain user defined light intensity 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 design

For 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 4

30-Dec-06

Mini Blinds Control System

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

30-Dec-06

Mini Blinds Control System

Figure 2: Mounted Motor

Figure 3: Mounted MRK Board and Breadboard

30-Dec-06

Mini Blinds Control System

Figure 4: Location of Light Sensors

2.2

Electrical design

The 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

30-Dec-06

Mini Blinds Control System

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 8

30-Dec-06

Mini Blinds Control System

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

30-Dec-06

Mini Blinds Control System

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.

10

TO COMPUTER SERIAL PORT

SERIAL PORT

GROUND POWER SIGNAL

MRK BOARD POWER

AC POWER

LIGHT SENSOR 1

GROUND POWER SIGNAL

LIGHT SENSOR 2

A N A L O G

MRK BOARD

GROUND POWER

I N DIGITAL OUT MOTOR (LEFT) + -

TEMPERATURE SENSOR

SIGNAL

SIGNALS

STEPPER MOTOR

11

2.3

Software design

The 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 12

30-Dec-06

Mini Blinds Control System

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.

13

Motor Steps to Fully Open Position Main Menu 1. Light 2. Temp 3. Exit

Light Intensity Mode User Selects: High Medium Low

Temperature Mode User Selects: Warmer Same Cooler

1. 2. 3.

4. 5. 6.

Sensor Value: Averages the values from both sensor Checks if desired value is within +/- 50 units of sensor value Steps motor in compensating direction (if needed) while recording position

Acquires Temp from sensor

Checks if desired value is within +/- 3 of sensor value Steps motor in compensating direction (if needed) while recording position

User exits program

Motor Steps to fully closed position

14

2.4

System assembly

Combining 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.

15

30-Dec-06 3. SYSTEM TESTING

Mini Blinds Control System

The 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 EXPENSES

The 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.

16

30-Dec-06 5. CONCLUSION

Mini Blinds Control System

The 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. ACKNOWLEDGEMENTS

We 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. REFERENCES

Alciatore 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.

17

30-Dec-06 8. APPENDIX

Mini Blinds Control System

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

18

30-Dec-06

Mini Blinds Control System

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

19

30-Dec-06

Mini Blinds Control System

8.3

Appendix C: Software components

#include "MRK.h" char void mode } void mode,c; crazy(void) { = fgetchar(SCI0); menu(void){ fprintf(SCI0,"Which control mode do you wish to use?\n\r"); fprintf(SCI0,"Light (L) or Temperature (T)\n\r",c); fprintf(SCI0,"Press q at any time to return to main menu.\n\n\n\n\r");

int digital_value, light1, light2, light_level, light_desired, temp, temp_desired, state, high, low ; int main() {

//Light Intensity Controlling Mode_______________________________________________ analog_in(RESOLUTION, 10); digital_in(OUTPUT,ALL); motor_out(LEFT,255); const char step_sequence[] = {0x01, 0x04, 0x02, 0x08}; while (1) { menu(); crazy(); if ((mode=='L')||(mode == 'l')) { setup_sci(SCI0, INTERRUPT, &crazy); while (1) { delay (10); light_desired = 300; light1 = analog_in(IN,2); light2 = analog_in(IN,4); light_level = (light1+light2)/2; low = light_level - 50; high = light_level + 50; fprintf(SCI0,"Light Average:%R4u menu\r",light_level);

Press Q to return to

if (high >= light_desired) { state = state - 1; digital_in(OUT,ALL, step_sequence[state & 0x03]); } if (low < light_desired) { state = state + 1; digital_in(OUT,ALL, step_sequence[state & 0x03]);

20

30-Dec-06

Mini Blinds Control System

} if (mode == 'q') { setup_sci(SCI0, INTERRUPT, 0); break; }

} } //___________________________________________________________________________ //Temperature Control Mode______________________________________________________ if ((mode=='T')||(mode == 't')) { setup_sci(SCI0, INTERRUPT, &crazy); while (1) {

temp_desired = 85; delay (10); digital_value = analog_in(IN,8); temp=(71 * digital_value) / 100 + 29; low = temp - 5; high = temp + 5; fprintf(SCI0,"Sensor:%R4u Press Q to return to menu\r",temp); if (high >= temp_desired) { state = state - 1; digital_in(OUT,ALL, step_sequence[state & 0x03]); } if (low < temp_desired) { state = state + 1; digital_in(OUT,ALL, step_sequence[state & 0x03]); } if (mode == 'q') { setup_sci(SCI0, INTERRUPT, 0); break; }

} //___________________________________________________________________________ } } }

21

S-ar putea să vă placă și