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)
Designing:-
Transmitter:-
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:-
          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.





MicroController:-
 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.
Relay:-
 1N4148 diode protects the transistor and relay from the damage and back emf.
FLOW CHART:-
        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:-

#include<reg51.h>
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
for(i=0;i<50;i++);
}
else if(rfr==0x0D)  // checks if switch-2 is pressed or not
{
load2^='1';    //xor operation
for(i=0;i<50;i++);
}
else if(rfr==0x0B)   // checks if switch-3 is pressed or not
{
load3^='1'; //xor operation
for(i=0;i<50;i++);
}
else if(rfr==0x07)   // checks if switch-4 is pressed or not
{
load4^='1';  //xor operation
for(i=0;i<50;i++);
}

}
}









Propeller project.
#include<reg51.h>
  sfr leds=0xB0;
  unsigned int i;
  void main()
  {
   leds=0x00;
   while(1)
   {
    leds=0xFE;
leds=0x14;
leds=0x12;
leds=0x12;
leds=0x14;
leds=0xF8;
for(i=0;i<10;i++);
leds=0xFE;
leds=0x04;
leds=0x04;
leds=0x08;
leds=0x10;
leds=0x20;
leds=0xFE;
for(i=0;i<10;i++)
leds=0xFE;
leds=0x14;
leds=0x12;
leds=0x12;
leds=0x14;
leds=0xF8;
for(i=0;i<10;i++);
leds=0xFE;
leds=0x04;
leds=0x04;
leds=0x08;
leds=0x10;
leds=0x20;
leds=0xFE;
for(i=0;i<10;i++)
    leds=0xFE;
leds=0x82;
leds=0x44;
leds=0x38;
  }
}