Tuesday, September 29, 2015

PROJECT 8a: Interfacing RF433 MODULE with ARDUINO

Hey guys, 
Today we'll looking at another cool project. Its a very basic wireless transmission project.
We'll be using it to create wireless channel between two micro-controllers.

Applications:
  • Car security system
  • Wireless security systems
  • Sensor reporting
  • Automation system
  • Remote Keyless entry 
  • Burglar alarm system
  • Smoke and fire alarm system
  • Garage door controllers
  • Car door controllers
  • Car alarm system
  • Security system
  • Cordless telephones
  • Other remote control systems


TX and RX are low cost ASK transmitter modules Pair which are based on RFIC . The transmitter modules work in very wide voltage range so they are very suitable for battery-driven applications. RX is a type of high sensitive ASK receiver which works at 3.6~5.5V. It can be used together with TX to construct simple and short range wireless control system.


The transmitted signal of the wireless receiver, remote control distance, can pass through walls, no direction. Supporting the use of any of the same frequency remote control. The Super-regenerative receiver module LC oscillator circuit includes amplifier shaping output data signals to TTL level directly to the decoder, extremely easy, and inexpensive. Small in size & high in sensitivity. 


This is an PLL based ASK Hybrid  433Mhz RF receiver module and is ideal for short-range wireless control applications where quality is a primary concern.The receiver module requires no external RF components except for the antenna.

Specs for receiver:
Static receiver module operating current is 4mA.
Operation voltage: DC5V
Static Current: 4MA
Receiver frequency: 433.92MHZ; 315 Mhz


Transmitter Module Specification:
Operating voltage :under 6V
Operating frequency: 433.92MHz; 315Mhz
Standby current: 0mA
Operating current :20-28mA
Transmission distance:> 500m
Transfer rate: <10Kbps


You have to use the MCU to simulate decode and encode process.


For the same we'll be using a commonly available decoder encoder pair from holtek
HT12d(decoder) and HT12E(encoder). the pair is a 4 bit data encoder-decoder and  has 8 address bits able to operate in 2^8 =256 different channels. And its decoder output works in active low logic.

Key: for successful operation , always use same address on encoder and decoder. SAFE FOR beginners -> keep all address bits grounded on both 12D & 12E.

The encoder decoders are a series of CMOS LSIs for remote control system applications. For proper operation, a pair of encoder/decoder with the same number of addresses and data format should be chosen.

The decoders receive serial addresses and data from a programmed series of encoders that are transmitted by a carrier using an RF 433 mhz radio.

They compare the serial input data three times continuously with their local addresses. If no error or unmatched codes are found, the input data codes are decoded and then transferred to the output pins. 
The VT pin also goes high to indicate a valid transmission. The HT12E & HT12D are arranged to provide 8 address bits and 4 data bits. 





The data flow is explained below.


The transmitter side circuit is shown below:







The receiver side circuit is shown below:


The code for the following is shown below. Copy the following Arduino code and burn it to your AVR and have fun. ;)

*************************************************************************
copy code below

// TRANSMITTER SIDE



int dat1=3;
int dat2=4;
int dat3=5;
int dat4=6;                                //    dat1 is triggered by inp1
int inp1=A0;                               //    dat2 by inp2
int inp2=A1;                               //    dat3 by inp3
int inp3=A2;                               //    dat4 by inp4            for more see the void loop function
int inp4=A4;


/*
******************************************************************************************************
I have connected simple 4 SPST push buttons , to trigger each output digitally,                      *
You can use these 4 push buttons to control a bot using a 4 button wireless joystick via rf 433mhz   *
Or you can replace the SPST with accelerometer inputs (and use analogWrite instead of digitalWrite)  *
and using a calibration and thresholding function as given in my accelerometer bot tutorial, you can *
make a simple hand gesture based robot.                                                              *
******************************************************************************************************
*/

void setup()
{
pinMode(dat1, OUTPUT);                    //declaring outputs
pinMode(dat2, OUTPUT);
pinMode(dat3, OUTPUT);
pinMode(dat4, OUTPUT);

pinMode(inp1, INPUT);
pinMode(inp2, INPUT);                    // declaring respective inputs
pinMode(inp3, INPUT);
pinMode(inp4, INPUT);

}

void loop()
{
  if (digitalRead(inp1)==1)
      {
         digitalWrite(dat1,HIGH);                        //whenever push button is pressed, turn the respective o/p on for 100ms
         delay(100);
       
      }
  if (digitalRead(inp2)==1)
      {
         digitalWrite(dat2,HIGH);
         delay(100);
      }
  if (digitalRead(inp3)==1)
      {
         digitalWrite(dat3,HIGH);
         delay(100);
      }
  if (digitalRead(inp4)==1)
      {
         digitalWrite(dat4,HIGH);
         delay(100);
      }      

digitalWrite(dat1,LOW);
digitalWrite(dat2,LOW);
digitalWrite(dat3,LOW);
digitalWrite(dat4,LOW);

delay(100);
}



**********************************************************************


//Rx side


int dat1=3;
int dat2=4;
int dat3=5;
int dat4=6;                                //    dat1 is triggered by inp1
int inp1=A0;                               //    dat2 by inp2
int inp2=A1;                               //    dat3 by inp3
int inp3=A2;                               //    dat4 by inp4            for more see the void loop function
int inp4=A4;


/*
******************************************************************************************************
I have connected simple 4 simple LED's to show each output digitally,                                *
You can use these motors to control a bot using a 4 button wireless joystick via rf 433mhz           *
Use forward= Motor_1_positive_pin (HIGH) & forward= Motor_2_positive_pin (HIGH) rest of the pins low *
   Backward= Motor_1_negative_pin (HIGH) & forward= Motor_2_negative_pin (HIGH) rest of the pins low *
    Left = Motor_1_positive_pin (HIGH) and rest of the pins low                                      *
   Right = Motor_2_positive_pin (HIGH) and rest of the pins low                                      *
and using digitalWrite or if you want PWM use analogWrite as given in my accelerometer bot tutorial, *
you can make a simple hand gesture based robot.                                                      *
******************************************************************************************************
*/

void setup()
{
pinMode(dat1, OUTPUT);                    //declaring outputs
pinMode(dat2, OUTPUT);
pinMode(dat3, OUTPUT);
pinMode(dat4, OUTPUT);

pinMode(inp1, INPUT);
pinMode(inp2, INPUT);                    // declaring respective inputs which are connected to DOUT pins of HT12D
pinMode(inp3, INPUT);
pinMode(inp4, INPUT);

}

void loop()
{
  if (digitalRead(inp1)==1)
      {
         digitalWrite(dat1,HIGH);                        //whenever push button is pressed, turn the respective o/p on for 100ms
         delay(100);
       
      }
  if (digitalRead(inp2)==1)
      {
         digitalWrite(dat2,HIGH);
         delay(100);
      }
  if (digitalRead(inp3)==1)
      {
         digitalWrite(dat3,HIGH);
         delay(100);
      }
  if (digitalRead(inp4)==1)
      {
         digitalWrite(dat4,HIGH);
         delay(100);
      }      

digitalWrite(dat1,LOW);
digitalWrite(dat2,LOW);
digitalWrite(dat3,LOW);
digitalWrite(dat4,LOW);

delay(100);
}



*****************************************************************

Have fun playing around. And feel free to ask questions around the circuit or code or its scope of use.

keep reading :)
Abheerup

1 comment:

  1. Is the circuit function changed if you remove Arduino on the tx side? Just connect directly the buttons to the encoder.

    ReplyDelete