* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Fully-automated control of lighting and security system of a
Survey
Document related concepts
Stray voltage wikipedia , lookup
Voltage optimisation wikipedia , lookup
Current source wikipedia , lookup
Electrical substation wikipedia , lookup
Mains electricity wikipedia , lookup
Circuit breaker wikipedia , lookup
Integrating ADC wikipedia , lookup
Switched-mode power supply wikipedia , lookup
Power MOSFET wikipedia , lookup
Schmitt trigger wikipedia , lookup
Immunity-aware programming wikipedia , lookup
Buck converter wikipedia , lookup
Regenerative circuit wikipedia , lookup
Resistive opto-isolator wikipedia , lookup
Transcript
EE389 Electronic Design Lab Project Report, EE Dept, IIT Bombay, Nov 2009 Fully-automated control of lighting and security system of a Room Group No: D2 Bharat Bhushan (06d04026) <[email protected]> Sravan Kumar Jatavath (06d07018) <[email protected]> Bhamare Jitendra Dilipkumar (06d07019) <[email protected]> Abstract In this report we are discussing the design of an occupancy detector circuit that automatically switch ON and OFF the light in a room based on room occupancy and display the number of persons in a room on LCD, design of Light dependent Resistor (LDR) based circuit that controls the light in a room depending upon the lighting condition (intensity of ambient light), design of Temperature indicator, design of smoke detector and design of capturing an image using webcam/canon camera. 1 Introduction The motivation behind this project is “Energy Saving”; we tried our level best in designing an energy efficient electronic circuit to prevent the wastage of energy after looking at hostel rooms, toilets, Central Library e.t.c. of IIT Bombay. The major parts of this project are: Occupancy Detector: An occupancy detector circuit was built using a pair of infrared transceivers (5mm Transmitter and Receiver). When an opaque object is put in between the aligned transceivers, the receiver gets toggled. Putting one transceiver on a door could be used to determine whether someone crossed the door, however, two are needed to determine the direction of the person crossing the door. This is the circuit which saves the electricity to great extent, this circuit saves approximately around the 57.8% of the energy which otherwise has been wasted. LDR based switching circuit: This circuit is basically a light sensor circuit which senses the light and accordingly switches on and off the light automatically. This is the circuit which saves the electricity to great extent. Temperature Indicator: It is designed using LM35 sensor & 2x16 LCD Display LCD Display: In this part we are displaying the room Temperature and information about room occupancy (i.e number of persons) in the room detected by an occupancy detector circuit on LCD. Smoke detector: this circuit will produce a Buzz/Voice when a smoke is detected. 1.1 Conditions for Light source to switch ON and OFF If an occupancy of room is zero, i.e. room is empty then light source will be switched off automatically If an occupancy of room is not zero then o if an ambient light is sufficient then light source will be switched OFF o otherwise light source will be switched ON 1.2 Block Diagram: 2 Occupancy Detector 2.1 Circuit Implementation: The voltage that develops across the receiver is dependent on the opaqueness of the object and the distance between the transmitter and receiver. To deal with this, an inverting Schmitt Trigger (IC40106B) was used. This design permits easy interfacing with the microcontroller as it provides an active-low signal to indicate a specific sensor has toggled. The transmitter/receiver Pair has an active range of detection of about 10° and was tested for acceptable operation of 0.25m, 0.5m, 0.75m, 1m. 2.2 Algorithm: The circuit feeds information to the microcontroller, so an appropriate algorithm needed to be developed. Conceptually, when a person walks into the room through a door with the sensors, Sensor A is toggled first followed by Sensor B. Similarly, when a person leaves the room, Sensor B is toggled before Sensor A. In order to account for cases when a person walks half-way through the door (toggling only Sensor A) and decides to reverse direction and leave never entering the room, the following algorithm was implemented. The number of people in the room will only be increased if the sensors are toggled in the following specific order: 1. Sensor A 2. Sensor A and Sensor B 3. Sensor B In an analogous manner, the number of people will only be decreased if the following sensors are toggled in order: 1. Sensor B 2. Sensor B and Sensor A 3. Sensor A All other combinations are ignored. 2.3 Circuit Diagram: 3 LDR based switching circuit 3.1 Circuit Implementation: This circuit is made using Light dependent Resistor (LDR) of dark resistance equal to 51kohms, the voltage developed across the resistance R is given to Schmitt Trigger, output of Schmitt Trigger is one of the input of AND gate, the other input of AND gate is an output of occupancy detector, when both are at logic 1 then they turn ON the switch and the Light source will glow. 3.2 Circuit Diagram: 4 Switching of CFL bulb : A 5 volt DC relay (GS-SH-205T) is connected to the CFL bulb as a switch. When a 5 volt is applied to relay it gets switched on. As 5v DC relay requires sufficient current to function properly, a transistor BD139 is introduced as an another switch for relay. 4.1 Circuit Diagram: 5. Temperature Indicator ( Using LM35 sensor & 2x16 LCD Display) 5.1 LM35 Sensor : The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature. We connect the Vcc to 5V ,GND to Gnd and the Out to one of the ADC (analog to digital converter channel). The output linearly varies with temperature. The output is 10 milliVolts per degree centigrade. Ex : When the temperature is 27 degree C , the output of the LM35 sensor would be 270 mV. We fetch this voltage to the Analog to Digital Converter of ATMEGA32 microcontroller . 5.2 Analog to Digital Converter (ADC) : The resolution of ATMEGA16 ADC is 10bit and for reference voltage we are using 5V so the resolution in terms of voltage is 5/1024 = 5mV approx So ADCs result corresponds to 5mV resolution i.e. if ADC reading is 10 it means 10 x 5mV = 50mV ADC Initialization : We have to configure the ADC by setting up ADMUX and ADCSRA registers. (a) ADC Multiplexer Selection Register – ADMUX REFS1 REFS0 selects the reference voltage. Our reference voltage will be Vcc(5v). So we set ADMUX=(1<<REFS0); (b)ADC Control and Status Register A – ADCSRA ADEN – We set this to 1 to enable ADC ADPS2-ADPS0 – Prescaler for ADC.We select division factor as 128. So ADC clock frequency = 16000000/128 = 125000 = 125KHz ADCSRA=(1<<ADEN)|(1<<ADPS2)|(ADPS1)|(ADPS0); //Enable ADC with Prescalar=Fcpu/128 Reading the analog value : We read the value of any ADC channel using the function ReadADC(ch); Where ch is channel number (0-5) in case of ATmega8. If you have connected the LM35's out put to ADC channel 0 then call adc_value = ReadADC(0) This will store the current ADC reading in variable adc_value. The data type of adc_value should be int as ADC value can range from 0-1023. As we saw ADC results are in factor of 5mV and for 1 degree C the output of LM35 is 10mV, =>So 2 units of ADC = 1 degree. So to get the temperature we divide the adc_value by to Temperature = adc_value/2 Finally we display this value in the LCD Module. Schemati c of the tempera ture sensing circuit - We connect the LCD Module to port D to display the tempera ture 6 LCD Display Numbers of persons present in the room are displayed on LCD 6.1 Circuit Diagram: 6.2 Circuit Implementation: We are using only four pins D4, D5, D6 and D7 of LCD to interface with microcontroller. 7. Smoke Detector It consists of photo-emitter and photo-detector. Whenever smoke is introduced between emitter and detector, the detector diode does not receive any photo-radiation from emitter thus it becomes open (logically 1) in the circuit, which causes high voltage at point A, Which is connected to a npn transistor (BD139). Thus it enables the transistor to turn on. This transistor acts as a switch for an Alarm (Buzzer). 7.1 Schematic: 8. Image capturing by webcam As a part of security of the room, whenever a person enters inside the room, the webcam capture his/her image and store it in the PC hard-disk. Position of webcam: In front of the door passage 8.1 Block Diagram 8.2 Mechanism and Working Connections: Whenever IR sensors detects a person coming inside the room, they conveys it to the microcontroller (Atmega 16). The microcontroller sends a signal to the MAX 232. The logical voltage values (i.e. 0V or +5V) get converted into serial port compatible voltage ( i.e. +9 or -9) by MAX 232 IC and are sent to the DB9 (serial Port ). Here, the signal coming from MAX232 IC goes into the Data Carrier Detect (DCD) pin of the DB9, which is the PIN1 of the DB9. A serial port to USB converter is used to connect DB9 to the PC. Pinouts of the serial port (DB9) Code Algorithm(code written in MATLAB): Code contains an image capturing function, (which controls the webcam) when it is called, snaps are taken by a webcam.The bit value of Data Carrier Detect (DCD) Pin can be read in the code. (which is, here, set by microcontroller). When this value becomes 1, program calls an image capturing function, thus an image gets captured. 9. Image capturing by Canon camera: 9.1 Requirements: In order to trigger a CHDK camera remotely, we will need to install CHDK on your camera connect a suitable triggering device to be connected to the USB socket of your camera ensure "Enable remote" to have been selected in CHDK run a suitable script (see example below) place your camera in shoot mode (i.e. not playback mode, movie mode, alt mode, etc) with CHDK still running operate the trigger 9.2 USB remote cable A popular method for remotely triggering CHDK-enabled cameras involves constructing a simple triggering device from a 3V battery, a USB extension cable, and a push switch. The camera's USB cable is then attached to the camera at one end and to the triggering device by the other end. Below is a circuit diagram of such a switch. If we are cutting up a commercially-made USB extension cable, then wires 1 and 4 are red and black, respectively, according to the USB standard. It seems that even cheaply made USB cables follow this standard. 9.3 Script @title Remote button while 1 wait_click 1 if is_key "remote" then shoot wend end