Escolar Documentos
Profissional Documentos
Cultura Documentos
Block Diagram:
Fig1 shows the flow of design in the form of blocks. The Bluetooth signal from cell phone having Android application platform is received by the bluetooth module. The android application software TERMINAL has a keypad which shows the alphabets. These alphabets are used as input to operate the appliances. Bluetooth module transmits these signals which can be received by kick start board. The kick start board has microcontroller and 7805IC for +5V power supply assembled on it. Adaptor is used for providing +12V supply to kick start board & relay driver module. Relays are then connected to the appliances as switching device. According to the microcontroller programming the output goes to the input of relay driver module and LCD. The red indication of LED at relay driver section show on/off of a particular relay as four relays are connected to this section. The microcontroller also interfaced with LCD which displays the output of microcontroller that which relay is on/off.
MAX232 IC (IC3) is used as logic convertor to make the serial communication signal; received through db9 connector; compatible with microcontroller. Its pin no 13 & 14 is connected to the pin 3 & 2 of db9 connector respectively to receive the signal. Similarly its pin no 11 & 12 are connected to 11 & 12 of microcontroller to transmit the converted signal. It requires 4 capacitors i.e. C4, C6, C7 & C8 of 10uf. The heart of the kick start board is microcontroller P89V51RD2. it is a 40 pin 8051-based microcontroller with 64K+8K kB Flash and 1024 bytes of data RAM32 I/O lines, 3 Timers/Counters, 9 Interrupts/4 priority levels, SPI, Dual Data Pointers, WDT, 5-channel PCA. 4 jumpers of 10 pins JP1 to JP4 are used to connect the ports of microcontroller and remaining two pins of jumpers are assigned as +5V and gnd. Resistor array is used at port 0. The reset circuit connected at pin9 and crystal oscillator at pin18 & 19. +12V supply is given to the Pushto-on switch JP7 to start the board.
Circuit description:
Fig8 shows the circuit diagram of Bluetooth controlled home automation system comprising Bluetooth module, Kick start board, LCD and Relays. Here only 1 appliance is connected to relay to show the connections. More than one appliance can be connected to it. Bluetooth module is used to connect the device with cell phone bluetooth, so whenever ground & +5V supply is given to this module; it starts and detect the available bluetooth device within 12 seconds maximum. The red LED blinks when it starts detecting the device. This bluetooth module receives the signal from the cell phone and then transmits them to microcontroller for further processing. The communication between bluetooth module and microcontroller is done through db9 connector cable. Bluetooth module and kick start board has db9 connector which acts as transmitter & receiver respectively.
The P89V51RD2 microcontroller also act as the heart of the system as it receives the signal, programmed it and then gives the output to Relay driver module to operate the relays for controlling the ON/OFF action of appliances. The kick start board output at port P2.0, P2.1, P2.2, P2.3 is connected to the input pins IN4, IN3, IN2, IN1 of relay driver module as Port2 of microcontroller is bidirectional port. Here it is used as output port for microcontroller. Adaptor provides the +12v supply to kick start board for 7805IC assembled on it and also to Relay driver module to drive relays. Input on Relay driver module also drives relay through transistor. The red LED indication on Relay driven board tells us that the operation of ON/OFF is done on the appliance which is connected to this relay. Now how to connect the appliance? Relay is used as switching device in the path of appliance to AC Mains. Rather than connecting an appliance directly to ac main power, connect its one terminal to relay and other one to supply. Similarly one end of relay to power supply. Thus relay is connected between the main supply and appliance. Switching action of relay is responsible for the required operation and appliance ON/OFF according to the instruction given by the cell phone bluetooth operator. Also an LCD is interfaced with microcontroller to display the output of microcontroller. For interfacing, port0 is used to give output to data pins of LCD i.e. pin7-14. Pin5 is grounded for write operation. Connect pin4 & pin6 to microcontroller port P3.4 & P3.6 respectively. +5V supply is given by the kick start board.
Construction:
The Actual-size, single-side PCB for the kick start board and relay driver module is shown in fig3 & fig6 respectively. Its component layout in fig4 & fig7 respectively. The wired connections for Bluetooth based Home Automation are shown in the fig7. Assemble the PCBs with various components along with the IC bases. Arrange all modules. Connect them as shown in fig7. Start bluetooth module and bluetooth of Cell phone. Connect it and test it by pressing the alphabets. The operation displays on the LCD and the appliance works according to the pressed alphabets.
Software:
The software is written in Embedded C language. Compile it to obtain hex code. Burn the generated hex code into the microcontroller. The software is well commented and easy to understand. PARTS LIST: Bluetooth Module 16x2 alphanumeric LCD Kick start Board Semiconductor:
IC1 IC4 IC3 D1 Capacitors: C1, C2 C3, C4, C6, C7, C8 C10 Resistors: R1 R10 Miscellaneous: Q1 X9 J1 RN2 JP1, JP3, JP5, JP6 JP7 H1, H2, H3, H4 3mm LED Vertical jumper 40-pin IC Base 14-pin IC Base 3-pin IC Base Tactile Switch Relay driver Module:
- P89V51RD2 microcontroller - 7805, 5V regulator - MAX232N - 1N4007 rectifier Diode - 33pf ceramic - 10uf, 25V electrolytic - 100uf, 25V electrolytic - 10-kilo-ohm - 220-ohm - KDS110592 Crystal oscillator - db9 Connector - DC Jack - 8-pin Resistor Array - pin heads - Push-to-on Switch - Mount-pad
Semiconductor: D1, D2, D3, D4, D5, D6, D7, D8 T1, T2, T3, T4 Resistors: R10, R11, R12, R13, R41 R2, R3, R4, R5 Miscellaneous: X3, X4, X5, X6 ` Relay1, Relay2, Relay3, Relay4 H3, H4 4 SMD resistors LED 3mm REDs Pin heads
- 1N4007 Diode - BC547 transistors - 1-kilo-ohm - 10-kilo-ohm - 3 pin terminal block - 12V, Q3F-1Z relay - mount-pad
Rx Bluetooth module Tx
LCD
Rx
12V supply
Relays
Relay 1 Home appliances Relay 2 Relay 3 Relay 4
Fig1: Block diagram
//Data and Command port Selection //LCD #define LCDdata P0 sbit LCDrs = P3^4; sbit LCDen = P3^6; // Motor sbit LM1P=P2^0; sbit LM1N=P2^1; sbit RM1P=P2^2; sbit RM1N=P2^3; //Declaring LCDdata //The Register select Pin //The Enable Pin //left motor +ve //left motor -ve //Right motor +ve //Right motor ve
/* Prototype: void MSdelay(unsigned int); Return Type: void Arguments: unsigned int Description: Generates time delay in milliseconds */ void delay(unsigned int rtime) { unsigned int r,s; for(r=0;r<rtime;r++) for(s=0;s<1275;s++); }
/* Prototype: void lcdcmd (unsigned char); Return Type: void Arguments: unsigned char Description: Issue commands to LCD */
void lcdcmd(unsigned char DATA) { LCDrs=0; LCDen=1; //Strobe the enable pin LCDdata = DATA; //Put the value on the pins LCDrs=0; LCDen=0; }
/* Prototype: void initialize (void); Return Type: void Arguments: None Description: Initialize LCD */ void initialize(void) { lcdcmd(0x30); delay(1); lcdcmd(0x38); delay(1); lcdcmd(0x0c); delay(1); lcdcmd(0x01); delay(1); lcdcmd(0x06); delay(1); }
/* Prototype: void lcddat (unsigned int) Return Type: void Arguments: unsigned int Description: Display data on LCD */
void lcddat(unsigned int DATA) { LCDrs = 1; // for data LCDen = 1; //Strobe the enable pin LCDdata = DATA; //Put the value on the pins LCDrs = 1; LCDen = 0; } /* Prototype: void display_lcd (unsigned char,unsigned char) Return Type: void Arguments: unsigned char & unsigned char* Description: Diplay the argument character string on given location using lcddat(unsigned int) */ void display_lcd(unsigned char location, unsigned char *d) { lcdcmd(0x80 | location); delay(1); //10mS delay generation while(*d) { lcddat(*d++); delay(1); } } int serial_rec(void) { int AA; while(RI==0); AA=SBUF; RI=0; return AA; } void main() { char rec; P2=0x00; P1=0x00
initialize (); TMOD=0x20; TH1=0xFD; SCON=0X50; TR1=1; display_lcd(0x00, "Bluetooth Based"); display_lcd(0x40, "Home Automation"); delay(200); while(1) { rec=serial_rec(); if(rec=='a') { display_lcd(0x00, " 1st Relay "); display_lcd(0x40, " on "); LM1P=1; LM1N=0; RM1P=0; RM1N=0; } // Light on
if(rec=='b') { display_lcd(0x00," 1st Relay "); display_lcd(0x40," off "); LM1P=0; LM1N=0; RM1P=0; RM1N=0; } // Light off
if(rec=='c') { display_lcd(0x00," 2nd Relay "); display_lcd(0x40," on "); LM1P=0; LM1N=1; RM1P=0; RM1N=0; }
// Fan on
if(rec=='d') { display_lcd(0x00," 2nd Relay "); display_lcd(0x40," off "); LM1P=0; LM1N=0; RM1P=0; RM1N=0; }
// Fan off
if(rec=='e') { display_lcd(0x00," 3rd Relay "); display_lcd(0x40," on "); LM1N=0; LM1P=0; RM1P=1; RM1N=0; }
// Computer on
if(rec=='f') { display_lcd(0x00," 3rd Relay "); display_lcd(0x40," off "); LM1P=0; LM1N=0; RM1P=0; RM1N=0; }
// Computer off
if(rec=='g') { display_lcd(0x00, " 4th Relay "); display_lcd(0x40, " on "); LM1P=0; LM1N=0; RM1P=0; RM1N=1; }
// A.C. ON
if(rec=='h') { display_lcd(0x00, " 4th Relay "); display_lcd(0x40, " off "); LM1P=0; LM1N=0; RM1P=0; RM1N=0; }
//A.C. Off
if(rec=='i') { display_lcd(0x00," All Relay "); display_lcd(0x40," on "); LM1P=1; LM1N=1; RM1P=1; RM1N=1; } // // // // Light on Fan on Computer on A.C. ON
//
All Relay on
if(rec=='j') { display_lcd(0x00," All Relay "); display_lcd(0x40," off "); LM1P=0; LM1N=0; RM1P=0; RM1N=0; } } } // Light off // Fan off // Computer off //A.C.ON
//