Friday, December 7, 2012

RF remote controlled home loads.

RF remote controlled home loads
                As  I already mentioned earlier the basic need to build an embedded system is the desired application. First you decide what application you want. I chose my application that is  to build a system that can control the home loads through  remote.  I decided to do that project strongly, and what is next step ?  That Is our required functionality. Here I decided to control four home loads that might be fan, lights, TV, etc., .  
Then draw the basic block diagram of your application

I built my block diagram as I required.  Go through the required components, I chose                              

Transmitter Part:-
Ø  Since I am using wireless communication I required one receiver transmitter pair.

     Here am using RF Txr &Rxr pair which will be operated in 433MHz frequency band. These pair can operate in limited area  up to 80mtrs. Instead we can use IR transmission also but it can operate in line –of-sight conditions.
Ø  To operate the four loads I can choose 4-push buttons at the transmitter side. Since wireless communication is a serial communication we can’t transmit parallel data. So we require a Encoder which can convert parallel data to serial data. Here I chose HT12E encoder. With this I completed the basic requirements to build transmitter part. The total circuit will
      be shown later.
Receiver Part:-
Ø  Encoded data will be received through the RF receiver.  It has
    to convert from serial data to parallel data, for that  we need to
    use the compatible Decoder. I chose HT12D  decoder.
Ø  To control the actions we need one controller. I am choosing AT89C51 controller because am good at this.
Ø  Since we are controlling AC loads we need Relay circuits(SPDT single pole double threw 12-v)
HT12E is 18-pin dip it has 8-Address pins and 4 Data pins.

Pins 1-8 are address pins here we don’t need. 14-pin is floating pin. Pins 10-13 are data pins D8 to D11 respectively. 15 and 16 pins are oscillator pins.17th pin is Data out. S1-S4 are push buttons.
          Receiver data flow:-
                       RF receiver à Decoder à microcontroller à relays à loads
Ø  The RF receiver part connection is same just like transmitter part. The parallel is fed to AT89C51 microcontroller. The resulted outputs are  fed to relays through transistors.

 It is a 8-bit and 40-pin DIP micro controller developed by Atmel corporation. It has 4 ports
PORT-0: multiplexed  Address and Data lines floating pins
PORT-1: I/O port floating pins
PORT-2: higher order Address pins floating pins
PORT-3: I/O pins and have a special function to each pin
11.0592MHz crystal provides the Clock frequency to the Micro controller.
 1N4148 diode protects the transistor and relay from the damage and back emf.
        Flow chart will illustrates the total control functionality of the circuit

Initially all the inputs are assigned to ‘1’ and all the loads are assigned to ‘0’.      
  When switch1 is pressed at the Txr it generate 1110 data. This data is compared in the micro-controller. If it matches then load1 preformed XOR operation  with ‘1’. If initial value is ‘0’
                                   0 xor 1=1;                                                                                                                                                                                                                                                        When second time pressed the same switch-1 then (already load-1=’1’)
                                               1 xor 1=0;
 The same operation is performed to switches-1,-2 and -3.

Source Code:-

sfr rfr=0x90;
sbit load1=P3^0;
sbit load2=P3^1;
sbit load3=P3^2;
sbit load4=P3^3;
unsigned int i;
void main()
rfr=0x0F;  // initialising as input port
load1=0;   // output pin
load2=0; // output pin
load3=0; // output pin
load4=0;  // output pin
while(1)  // super loop
if(rfr==0x0E // checks if switch-1 is pressed or not
  load1^='1';   //xor operation
else if(rfr==0x0D)  // checks if switch-2 is pressed or not
load2^='1';    //xor operation
else if(rfr==0x0B)   // checks if switch-3 is pressed or not
load3^='1'; //xor operation
else if(rfr==0x07)   // checks if switch-4 is pressed or not
load4^='1';  //xor operation