Tuesday, October 18, 2011
Automatic Blind
Week 1
Features:
Week 2
Discussion
Introduction
The aim of this project is to understand and gain the knowledge needed to design and build an automated system to control a venetian blind. This project consists of an automatic blind which will open and close with the use of a light to frequency converter and a temperature sensor. It will also be controlled with the use of a motion sensor and a remote control.
The light to frequency converter will detect outside Sun light levels and the temperature sensor will detect room temperature. At a predetermined light level the blinds will open or it can be set on a clock timer that will only allow the blinds to open at a certain time. At dusk, they will close in the same manner with a clock setting to indicate it been night time. The temperature sensor will also be set up so that temperature readings from inside the room can activate the device depending on daylight or night settings. All sensor setting can be over written by the use of the remote control to activate the device. The Automatic blind will run from a mains supply but will also have a battery back-up in case of a power outage.
Week 1
It's week 1 and we were assigned our projects today. I got my first choice which is an Automatic blind. The first thing I will have to research is how to write a new language called PBasic.
PBasic is the language for operating the Basic Stamp Microcontroller which I will be using in this project.
This weeks lab consisted of testing the circuit on the breadboard and interfacing it to the PC using PBasic. After having some problems with the circuit it was discovered that the Basic Stamp Microcontroller that was recieved last week was not working. When this was replaced everything worked fine. Testing the voltage regulator showed that there was 8.4V coming onto the breadboard and when passed through the regulator it showed to be 5.2V.
The Basic Stamp II
The Basic Stamp 2 is a very easy microcontroller to understand and use. It is made by Parallax Inc who also makes a number of peripherals that work with the microcontroller. It can control and monitor peripherals such as motors, sensors, relays, switches lights and more. To program the basic stamp microcontroller, an easy to use language called PBasic is used.
The Basic Stamp has its own processor on board as well as its own clock source, memory and power regulator. It stores code that is written to the stamp inside a serial EEPROM. This non-volatile storage retains memory of the code written without power. The Basic Stamp runs on 5V to 15V DC and has an on board 5 Volt regulator which converts power from anything above 6V back to 5V for its components. It has 16 Input/output pins as well as 2 dedicated serial port pins and can execute 4000 instructions per second.
Features:
- Power Supply Requirements: 5.5-15VDC (Vin) or 5VDC (Vdd)
- Communication: Serial (9600 baud for programming)
- Processor Speed: 20 MHz
- Program Execution Speed: ~4,000 PBASIC instructions/sec.
- RAM Size: 32 Bytes (6 I/0, 26 Variable)
- EEPROM (Program) Size: 2 KBytes; ~500 PBASIC instructions
- Number of I/O Pins: 16 + 2 dedicated serial
- Current Draw @ 5 VDC: 3mA Run, 50 μA Sleep
- Source/Sink Current per I/O: 20 mA / 25 mA
- Source/Sink Current per unit: 40 mA / 50 mA per 8 I/O pins
- PBASIC Commands: 42
- Package: 24-pin DIP
- Industrial-Rated since Rev J
Dimensions:
- 1.20 x 0.63 x 0.15 in (30.0 x 16.0 x 3.81 mm)
Week 2
In order for this to work correctly, a circuit was bulit on a breadboard with a Basic Stamp microcontroller. To bring power to the board a 9V battery was used and regulated to 5V using a 7805 voltage regulator. A test programme was then written on PBasic was used to read in from the light to frequency sensor and send out a signal from the Basic Stamp to light up an LED -BAR in sequence. This will communicate with the board through a USB to serial (RS-232) adapter. Therefore connecting to the Basic Stamp microcontroller a USB lead to run from the breadboard with a 9 pin female connector had to be made. Pin 2 (RX) on the lead connects to pin 1(SOUT) on the stamp pin 3(TX) on the lead goes to pin 2(SIN) on the stamp, pin 4 (DTR) connects to pin 3 (ATN) on the stamp and pin 5 connects to ground, pin 4(VSS) on the stamp. Pins 6 (DSR) and 7 (RTS) on the lead are joined together to enable automatic port detection.
Week 3
This weeks lab consisted of getting the software to work proparly to communicate with the LED's on the board. The code is now working so that when the light to frquency sensor reads in a signal, depending on how bright or how dark it gets, it will light the LED's to match that frequency. This can now be used to program the individual controls for the blind, such as tilt the blind when it gets to a certain light, or lift the blind. A como drill (100:1) 1.5-3v DC motor will be used to control the blind. And to control the motions of the motor a H-Bridge circuit will control the flow of current which will send the motor forward or reverse. A H-Bridge is made up of a selection of PNP and NPN transistors along with some resistors and diodes.
TSL230 Light to Frequency converter
The light to frequency converter measures light intensity using an array of photodiodes which then will output a square wave whose frequency will be proportional to light intensity which strikes the surface of the chip. It can provide three levels of sensitivity from the measurement of nearly any light intensity. The sensitivity is set by the appropriate levels on the control pins S0 and S1. Because the output frequencies can reach from 1Hz to over 1 MHz, pins S2 and S3 are used as a frequency divider on the TSL230 making it possible for the basic stamp to measure the frequencies. The operating voltages for the TSL230 are from 2.7V to 5.5V enabling it to be interfaced with a micro controller which operates within these voltages. This would include all microcontrollers that are produced from Parallax INC.
Week 4
H-Bridge
The H-Bridge that was created for this project is made up from 2 x TIP 125PNP Transistors, 2 x TIP 121 NPN Transistors, 4 x diodes and 4 x 1Kohm resisters. The NPN transistors connect the motor to GND and the PNP transistors connect it to VDC. The resistors prevent too much current from passing through the BASE pin of the transistors. A 1Kilohm resistor allows enough current to saturate the transistor; anything higher would cause the motor to receive less power. The Diodes create a safe path for the energy from the motor back to the battery when it is stopped.
From the picture below it shows the H-Bridge connected to the Basic Stamp circuit that was built earlier. The 2 x PNP's are on top and NPN's are on the bottom. R3 is connected to the left NPN and R1 connected to the one on the right. Where R4 is connected to the PNP to the left and R2 is connected to the one on the right. In order to make the motor go forward, R2 must be connected to GND and R3 to VDC, with R1 to GND or disconnected and R4 to VDC or disconnected. For reverse motion it is R1 to VDC and R4 to GND, with R2 toVDC or disconnected and R3 to GND or disconnected. When using this way to control the motor it is very important never to connect R1 to VDC and R2 to GND at the same time or it will short circuit the battery. And the same applies to R3 to VDC and R4 to GND.
The next step will be to make this circuit a bit tidier as there is alot more to do. There is still the thermistor to think about and a remote control sensor to be interfaced in this circuit, also if there is time and an easy solution, there will be a motion sensor to activate the closing of the blind as someone walks past the window.
Once the H-Bridge was proven to function correctly it was then interfaced with the rest of the circuit. From left to right we see the Basic Stamp microcontroller, next the light to frequency converter, the IC to the right of that is the DS1302 trickle charge time keeping chip. The DS1302 contains a real time clock and calendar with 31 bytes of static RAM. The clock/calendar provides seconds, minutes, hours, day, date, month and year information. It can operate in both modes of either 24 hour mode or 12 hour mode with an AM and PM indicator. After that the H-Bridge is included for the forward/ reverse control of the motor.
Discussion
Overall this project has come together without any major problems however there is a lot more to learn about the software in order to get it to function properly. After having some problems with the circuit it was discovered that the Basic Stamp Microcontroller that was received in the first week was not working. When this was replaced everything worked fine. There is still the thermistor to connect to the circuit and a remote control operation will need to be incorporated into the design.
Part 2 of this project will include bringing the remote control onto the board and the final testing before the development stages of the PCB design. From here the testing procedures as well interfacing it to the blind will begin. When the circuit is completed a full test will be carried out before the PCB design will go ahead. Once the PCB’s are complete there will be further testing carried out for continuity checks, functional tests as well as bench tests.
No comments:
Post a Comment