automated blinds
TRANSCRIPT
-
8/7/2019 AUTOMATED BLINDS
1/24
AUTOMATED BLINDS
Prepared for
Professor Rashdee
EET-344: Microprocessor with PeripheralsDeVry University, Fremont
Prepared by
Mai Zoua VangJustin Niel
Joshua Quintero
February 13, 2007
-
8/7/2019 AUTOMATED BLINDS
2/24
CONTENTS
Page
ABSTRACT...................................................................................................................1
INTRODUCTION/FEASIBILITY..1
MATERIALS AND EQUIPMENTS...5
Basic information of ADC ..5Basic information of reversed-bias LED....6
Basic information of 3-to-8 line decoder....6
Basic information of stepping motor ..7Basic information of ULN2003 ..7
PROGRAMMING AND INTERFACING APPROACH...8
Flowchart 8Hardware ...12
SOFTWARE CODE..14
RESULTS .19
CONCLUSION .19
WORKS CITED ...20
APPENDIX ...21
ii
-
8/7/2019 AUTOMATED BLINDS
3/24
LIST OF ILLUSTRATIONS
Figures Page
1. Figure 1: Light Sensors 2
2. Figure 2: Left Sensor 2
3. Figure 3: Center Sensors 3
4. Figure 4: Right Sensor 3
5. Figure 5: Blinds 4
6. Figure 6: ADC Pin out 5
7. Figure 7: 3-to-8 Decoder Pin out (MM74HC138M) 6
8. Figure 8: Stepper Motor sequence 7
9. Figure 9: ULN2003 pin out 7
10. Figure 10: ADC connection to decoder 12
11. Figure 11: ULN2003 connection to Stepper Motor 13
12. Figure 12: Circuit 13
iii
-
8/7/2019 AUTOMATED BLINDS
4/24
1
ABSTRACT
Background
Have you ever had trouble with your blinds letting out too much heat at night when you forget to
close them? Or would you like your blinds to be open, letting in sunlight and heat as soon as youget up in the morning? Well we are here to help! We at Solar Blind Systems Inc. have devised a
solution for all of your troubles. It is automatic blinds! These specially designed blinds will
allow the shutters to follow the sunlight in order to let in an optimal amount of heat for your
home and close up when not in use.
Results
We found that we can create blinds that will follow light using light sensors and a simple
program in C++ that will compare the inputs, after the comparison is made, and the output will
be sent to our motor to change the position of the blinds. When there is no sunlight outside to let
in, the blinds will simply close up to retain the heat that is in your home already. This systemwill not only be convenient to the average homeowner, but it will also save you money on
electricity bill.
Conclusion
If you would like to save possibly hundreds of dollars on your electricity bill over the next fewyears, automatic blinds are the answer for you! With our unique power saving techniques of
blind management, we will save you both time and energy.
INTRODUCTION/ FEASABILITY
These electronic blinds are the future of the world as we know it. No longer will we be required
to maintain our own household blinds to gain optimal lightning and contain the heat stored in our
homes. The natural heating provided by the sun will be sufficient to allow the owner to use lessnatural gas and/or electricity to heat their home. The homeowners will also benefit from the
optimal lightning procedures of the system to enable the users to be able to worry less about
using indoor lights. This also can be used on focusing solar cells toward the sun.
The process is simple; we take in light from four strategic locations and compare their values to
locate the position of the sun.
-
8/7/2019 AUTOMATED BLINDS
5/24
2
There are four light sensors located at different angles.
Figure 1: Light Sensors
Divider
Light sensors
If the sun shines to the left, the left sensor will receive the most amount of light.Figure 2: Left Sensor
-
8/7/2019 AUTOMATED BLINDS
6/24
3
If the sun shines in the center, the two center sensors will receive the most amount of light.Figure 3: Center Sensors
If the sun shines more to the right, the most right will get most of the sunlight.Figure 4: Right Sensor
-
8/7/2019 AUTOMATED BLINDS
7/24
4
Whichever location brings in the most light can be considered the location of where the sun is
most closely located at. The motor will turn the blind using the corresponding steps to the
position with the most light. The whole process of taking and comparing the values from the foursensors repeat over again; closing if there is no longer enough light to bring in.
Figure 5: Blinds
Stepper motor
sensorblinds
-
8/7/2019 AUTOMATED BLINDS
8/24
5
MATERIALS AND EQUIPMENTS
The materials used in the automated blind are listed in Table 1.
Table 1: List of Materials
Quantity Part Num. Description Cost
4 Green LEDs $0.40
1 Stepping motor $17.95
4 ADC0804Analog-to-digitalconverter $7.96
1 MM74HC138 3-to-8 line decoder $0.17
5 103 Ceramic capacitor $0.17
1 Blind $15.63
Wires
6 General diodes
1 Triple power supply
1 ULN2003 Current driver $0.69
Resistors $0.01
2 Banana-to-banana cord
Total expense $42.98*
*Price does not include power supply, general diodes and wires.
Basic information of ADC
The ADC (Analog-to-Digital Converter) converts a single analog signal into a digital signalbased upon the percentage of a reference voltage that the output is. Thus we can take the inputvoltage, divide it by the reference voltage and multiply it by 256 (eight outputs) to receive the
digital output in increments of 1/256.
Figure 6: ADC Pinout
Source: Alldatasheet.com
-
8/7/2019 AUTOMATED BLINDS
9/24
6
Four ADC sensors were used to take in the varying sunlight values based upon their locations.
One ADC sensor is located at 22.50; one at 67.5
0; one at 112.5
0; and one at 157.5
0. Only one
ADC is actively sending the data to our microprocessor at a time. A decoder is used to activatethe desired ADC chip. This output is taken into a microprocessor which then compares the value
with the other ADC outputs.
Basic information of reversed-bias LED
When a normal Light Emitting Diode is set in reversed bias it will act as a phototransistor.
Whenever light is focused upon the LED, the current will flow freely through the diode atdifferent voltages based upon the amount of light the LED is absorbing. The more light focused
upon the LED, the more voltage the LED will let pass freely through it. This gives us a point of
reference and comparison. Reversed-bias LEDs are used as phototransistor in the automatedblind. When a LED is reversed-bias, the depletion zone widens. When the atoms inside the LED
absorb the light, the energy band inside the atom raises. But instead of releasing the energy
through light, like it usually does, it releases electrons.
Basic information of 3-to-8 line decoder
A 3-to-8 line decoder takes in three inputs to select one of eight outputs. The three inputs are
binary values (0 and 1) which would result in a value from 0 through 7 which then selects the
corresponding output (output 0 output 7) to be set at a low state. The outputs of the decoder
are active-low. The outputs of the decoder can then be used to enable the chips connected tothem.
The decoder was used in this project to select one of four ADC to send their digital outputs to themicroprocessor. To do this, the decoder is sent a binary value that signifies the desired ADC
chip. Then the decoder will send a low state to the ADCs chip select pin. The ADC chip select
pin is active-low.
Figure 7: 3-to-8 Decoder Pinout (MM74HC138M)
Source: Alldatasheet.com
-
8/7/2019 AUTOMATED BLINDS
10/24
7
Table 2: Truth table. This table shows the value of the inputs of the decoder that select the corresponding ADC
chip.
S0 S1 S2 Y0(ADC1) Y1(ADC2) Y2(ADC3) Y3(ADC4)
0 0 0 0 1 1 1
0 0 1 1 0 1 1
0 1 0 1 1 0 1
0 1 1 1 1 1 0
Basic information of stepping motor
The stepping motor is a four-phase stepper motor. This means that the stepper motor has four
stator windings with a center-tapped common. This common allows the motor to change thecurrent direction within each of the two coils which changes the polarity of the stator.
The stepper motor used is a 4.7 V motor with 1.5 angle step. To determine the required numberof steps to turn the rotor to a desired position, the following formula was used:
Steps = Desired Angle / Angle step (Specified by the motor).
This stepper motor has a four step sequence as displayed below.
Figure 8: Stepper Motor Sequence
Clockwise Step # Winding A Winding B Winding C Winding D Dec # Counter-clockwise
1 1 0 0 1 9
2 1 1 0 0 C
3 0 1 1 0 6
4 0 0 1 1 3
Basic information of ULN2003
The ULN2003 is the stepper motors driver. It takes in the datas from Port B. The ULN2003
inverses the inputs. After that, each bit is sent to its own Darlington pair, where the voltage is
stepped up to the voltage desired to run the stepper motor.
Figure 9: ULN2003 Pin out
Source: Alldatasheet.com
-
8/7/2019 AUTOMATED BLINDS
11/24
8
PROGRAMMING AND INTERFACING APPROACH
Flowchart
Initialized char stepper = 0x33HInitialized ADC
Initialized blind to position 1
Read values from LEDs
Set greater = sensor_1Set Position = 1
Greater < sensor_2
Set greater = sensor_2
Set new_position = 2
Set greater = sensor_3
Set new_position = 3
True
Greater < sensor_3
Greater < sensor_4
False
True
False
Set greater = sensor_4
Set new_position = 3Difference = position new_positionTrue
False
-
8/7/2019 AUTOMATED BLINDS
12/24
9
Switch( difference)
Print position 1
Steps = 120
Print position 2
Steps = 241
Print position 3
Steps = 482
Print position 4
Steps = 723
0 1, -1 2, -2 3, -3
Print position 4
Steps = 723
Default
Position = new_position
While(steps !=0 &&
difference =0)
True False
Do while loop
-
8/7/2019 AUTOMATED BLINDS
13/24
10
Send stepper value to Port B
Rotate value to the left once
Steps = steps - 1
Difference = positon - 1
False
While keyboard is notpressed
True
False
Switch( difference)
Steps = 120 Steps = 361 Steps = 600 Steps = 860
0 1, -1 2, -2 3, -3
Steps = 0
Default
While steps != 0
Send stepper value to Port B
TrueWhile loopFalse
Do while loop
-
8/7/2019 AUTOMATED BLINDS
14/24
11
Rotate stepper value to the light
once
Steps = steps - 1
While loop
End propram
False
-
8/7/2019 AUTOMATED BLINDS
15/24
12
Hardware
Figure 10: ADC connection to decoder. Figure 11 shows how the 3-to-8 decoder is connected to eachADC chip select and Port C.
1S1
2S2
S33___
G2A4
16
15
14
13
Vcc
Out0
Out1
Out2
9
Out6
MM74HCT138
5
___
G2B12
Out3
6G1
11Out4
7Out7
10Out5
GND
8
1
__
CS
2
__
RD___
WR3
CLK IN4
19
18
17
16
CLK R
DB0
DB1
DB2
Vcc1
20
5
____
INTR15
DB3ADC0804
6Vin(+)
7Vin(-)
GND8
Vref/29
14
13
12
11
DB4
DB5
DB6
DB7 (MSB)GND
10
1
__
CS
2
__
RD___
WR3
CLK IN4
19
18
17
16
CLK R
DB0
DB1
DB2
Vcc1
20
5
____
INTR15
DB3
6Vin(+)
7Vin(-)
GND8
Vref/29
14
13
12
11
DB4
DB5
DB6
DB7 (MSB)GND
10
1
__
CS
2
__
RD___
WR3
CLK IN4
19
18
17
16
CLK R
DB0
DB1
DB2
Vcc1
20
5
____
INTR15
DB3ADC0804
6Vin(+)
7Vin(-)
GND8
Vref/29
14
13
12
11
DB4
DB5
DB6
DB7 (MSB)GND
10
1
__CS
2__RD
___
WR3
CLK IN4
19
18
17
16
CLK R
DB0
DB1
DB2
Vcc1
20
5
____
INTR15
DB3ADC0804
6Vin(+)
7Vin(-)
GND8
Vref/29
14
13
12
11
DB4
DB5
DB6
DB7 (MSB)GND
10
PORT C
330 ohm
330 ohm
330 ohm
330 ohm
50 3 421 6
PORT A
Data
210
5V
10 nF
5V
10nF
5V
10 nF
5V
10 nF
0.47 uF
0.47 uF
0.47 uF
0.47 uF
-
8/7/2019 AUTOMATED BLINDS
16/24
13
Figure 11: ULN2003 connection to the stepper motor. It shows how Port B is connected to the inputs
of the ULN2003. The ULN2003 is connected to the stepper motor.
Figure 12: Circuit
-
8/7/2019 AUTOMATED BLINDS
17/24
14
SOFTWARE CODE
#include // header for Sleep#include #include
#include #include "mdedriverdll.h"
This portion links the necessary header files to our project.
void main(){int iwork;unsignedchar sensor_1 = 0, sensor_2 = 0, sensor_3 = 0, sensor_4 = 0,
greater = 0;
int position = 1, new_position, difference, steps = 120;unsignedchar stepper = 0x33;
This portion enters the main then initializes all the variables used in ourprogram.
iwork = MDEOpenLPTPort(0x378); // initialize driverMDEConfigPort(0x378, 0x90);
cout
-
8/7/2019 AUTOMATED BLINDS
18/24
15
// clear screensystem ("cls");
This portion initializes the ADC and clears the screen afterwards.
// initialized blind to position 1- 22.5 degreeMDEOutPB(0x378, 0xff);
MDEOutPB(0x378,stepper);Sleep(10);MDEOutPB(0x378,0x00);Sleep(10);
while(steps !=0){MDEOutPB(0x378,stepper);Sleep(10);MDEOutPB(0x378,0x00);
Sleep(10);
_asm{mov al, stepperROR al,1mov stepper,al
}
steps = steps - 1;}
This portion initializes the blinds to position 1(or 22.5 degree). One of thestepper motor values 33(in hex) is sent to port B. Then we rotated the valueand it became 99(in hex).
do{
//cout
-
8/7/2019 AUTOMATED BLINDS
19/24
16
Sleep(50);
// cout new_position;
This portion checks what position the stepper motor should be in.
difference = position - new_position;
switch( difference){case 0:
cout
-
8/7/2019 AUTOMATED BLINDS
20/24
-
8/7/2019 AUTOMATED BLINDS
21/24
-
8/7/2019 AUTOMATED BLINDS
22/24
19
RESULTS
The results we got were as proposed. The lights sensors would send the value through the ADCto the microprocessor. The Microprocessor would then interpret these values and determine
which sensor is absorbing the most light. The microprocessor would then send determine the
amount of steps required to reach the desired point. Then the microprocessor would output thevalues to the ULN2003 which would then output to the stepper motor. This process would then
enable the blinds to move to the desired position and repeat the process above.
The initial proposal as initially proposed, except we decided to replace the photodiodes with areversed bias LED, which in fact was more sensitive compared to the other photodiodes that we
obtained.
CONCLUSION
From this project we learned many important and pertinent facts concerning electronic devices
and microprocessor. This experience helped strengthen our knowledge of the curriculum coveredin this course. We, the group, will now be able to walk away with a strong knowledge in the
design of electronic circuits using microprocessors and interfacing various devices. Amongthose devices includes the use of a strong stepper motor.
-
8/7/2019 AUTOMATED BLINDS
23/24
20
Work Cited
ADC0804 : 8-Bit, Microprocessor- Compatible, A/D Converters. Intersil Corporation. 1999.http://pdf1.alldatasheet.com/datasheet-pdf/view/66283/INTERSIL/ADC0804.html.
ULN2003 : SEVEN DARLINGTON. STMICROELECTRONICS. 2002.
http://pdf1.alldatasheet.com/datasheet-
pdf/view/25575/STMICROELECTRONICS/ULN2003.html.
MM74HCT138N : 3-to-8 Line Decoder. Fairchild Semiconductor Coporation. 1999.
http://pdf1.alldatasheet.com/datasheet-pdf/view/53791/FAIRCHILD/MM74HCT138N.html
-
8/7/2019 AUTOMATED BLINDS
24/24
21
APPENDIX