Tuesday, October 27, 2015

RF 433 MHz (Wireless Radio Frequency) Communication Between two Microcontroller [Step By Step Tutorial ]




RF Modules are popularly used in the remote control system. In  Quadcopter, Robot remote control, Industrial remote control, telemetry and remote sensing etc.  Get more details here RF_Wiki
max232 433mhz module
RF module interfacing tutorial

RF Module :

RF Module means Wireless Radio Frequency Module. RF module consists of two units. One Transmitter unit and another is Receiver unit. Basically, RF modules are used to building a wireless connection between two points. We can easily communicate over  300-500m distance through RF module . in this tutorial we are using RF Module at the 433Mhz frequency and it supports baud rate 9600. Although didn't try this. In this tutorial, I will use baud rate2400.

We will use UART  communication to interface RF Module with microcontroller. As we did previously in Bluetooth Interfacing with Pic Microcontroller tutorial. Now let's take a look on RF Transmitter and Receiver respectively .

RF Transmitter :


RF Module ( Wireless Radio Frequency )Transmitter_Tx
RF Module ( Wireless Radio Frequency )Transmitter_Tx
max232 433mhz module
max232 433mhz module

RF Receiver :

RF Module ( Wireless Radio Frequency ) Receiver Rx
RF 433 MHz (Wireless Radio Frequency) Communication Between two Microcontroller [Step By Step Tutorial ]


RF Module ( Wireless Radio Frequency ) Receiver pin out
RF Module ( Wireless Radio Frequency ) Receiver Pinout

MikroC Code :

Now open MikroC and Create a new Project .If you are an expert you don't have to follow this steps .


Create New Project in MikroC_1

Create New Project in MikroC_2

Create New Project in MikroC_3

 Include All Library in mikroc
RF 433 MHz (Wireless Radio Frequency) Communication Between two Microcontroller [Step By Step Tutorial ]


Mikro C Library Funtions :

UARTx_Init:  This function will initialize USART option of  Microcontroller with Baud rate . We will use baud rate 2400 . The code will be look like this :
 UART1_Init(2400);


UARTx_Data_Ready: This checks if it is available to read or transmit data .
UARTx_Read_Text: To read text data .Look at the example .
if (UART1_Data_Ready() == 1) {
UART1_Read_Text(  txt,  ")" , 2); }
This is checking if data is available to read . ")" . The txt char array variable will be being stored until the ")" will be found . 2 means to try for 2 times . So , I think our text should not be longer than 2 character .
UARTx_Write_Text: This will send text data . Look at the example :

if (UART1_Tx_Idle() == 1) {// this will check , if the last data transmission is completed

 UART1_Write_Text("button2");
 }

UARTx_Write: This will send char data . Look at the example :
if (UART1_Tx_Idle() == 1) {// this will check , if the last data transmission is completed

 UART1_Write( '(' );
 }
 

Reducing Noise :

To reduce noise, we will use a trick. Before reading the data text we will keep a function and this will check the first character. If the character will be '(', it will be checked by an if statement. Finally read text function will be performed until the char  ')' will be found. That means microcontroller will show us only the text between '(' and ')'.

Please follow the example:
If we send  (A) , Lcd will show "A" . If we send (B) , we will get "B" . Unless we cant get any text output.  If we send "(A" , this will show no output to LCD display.

 Source Code :

# Transmitter :




 char txt[16];  
 char chk;  
 int i=0,ckop=0;  
 void main() {  
 ADCON1=0x0F;         // Configure RE1 pin as input  
 CMCON=7;  
 for(i=0;i<16;i++){txt[i]=' ';}  
   TRISA.F0=1;  
    TRISA.F1=1;        // Initialize ADC  
      TRISA.F2=1;  
      TRISA.F3=1;  
   UART1_Init(2400);  
      delay_ms(200);            // Initialize LCD  
  while(1){  
  if(PORTA.F0==0){  delay_ms(100);  
  if (UART1_Tx_Idle() == 1)  
  UARt1_Write_Text(",,,,,,,,,,,");  
 UART1_Write('(');  
   UART1_Write('A');  
  UART1_Write(')');  
   UARt1_Write_Text(",,,,,,,,,,,");  
  }  
 if(PORTA.F1==0){   delay_ms(100);  
  if (UART1_Tx_Idle() == 1)  
   UARt1_Write_Text(",,,,,,,,,,,");  
 UART1_Write('(');  
  UART1_Write('B');  
  UART1_Write(')');  
   UARt1_Write_Text(",,,,,,,,,,,");  
  }  
 if(PORTA.F2==0){  delay_ms(100);  
  if (UART1_Tx_Idle() == 1)  
  UARt1_Write_Text(",,,,,,,,,,,");  
 UART1_Write('(');  
  UART1_Write('C');  
  UART1_Write(')');  
   UARt1_Write_Text(",,,,,,,,,,,");  
  }  
  if(PORTA.F3==0){  delay_ms(100);  
  if (UART1_Tx_Idle() == 1)  
   UARt1_Write_Text(",,,,,,,,,,,");  
 UART1_Write('(');  
  UART1_Write('D');  
  UART1_Write(')');  
   UARt1_Write_Text(",,,,,,,,,,,");  
  }  
 }  
 }
 

# Receiver :





 // LCD module connections  
 sbit LCD_RS at LATB7_bit;  
 sbit LCD_EN at LATB6_bit;  
 sbit LCD_D4 at LATB5_bit;  
 sbit LCD_D5 at LATB4_bit;  
 sbit LCD_D6 at LATB3_bit;  
 sbit LCD_D7 at LATB2_bit;  
 sbit LCD_RS_Direction at TRISB7_bit;  
 sbit LCD_EN_Direction at TRISB6_bit;  
 sbit LCD_D4_Direction at TRISB5_bit;  
 sbit LCD_D5_Direction at TRISB4_bit;  
 sbit LCD_D6_Direction at TRISB3_bit;  
 sbit LCD_D7_Direction at TRISB2_bit;  
 // End LCD module connections  
 char txt[16];  
 char chk;  
 int i=0,ckop=0;  
 void main() {  
 ADCON1=0x0E;         // Configure RE1 pin as input  
 CMCON=7;  
 for(i=0;i<16;i++){txt[i]=' ';}  
  Lcd_Init();  
   UART1_Init(2400);  
      delay_ms(200);            // Initialize LCD  
  Lcd_Cmd(_LCD_CLEAR);        // Clear display  
  Lcd_Cmd(_LCD_CURSOR_OFF);     // Cursdhhdor off  
   Lcd_Cmd(_LCD_CLEAR);  
  Lcd_Out(1, 4, "Welcome");  
  Lcd_Out(2, 2, "pictutorial.net");  
  delay_ms(1500);  
   Lcd_Cmd(_LCD_CLEAR);  
   Lcd_Out(1, 2, "Received Data");  
  while(1){  
   ckop=2;  
 if (UART1_Data_Ready() == 1){  
  chk = UART1_Read();  
  for(i=0;i<16;i++){txt[i]=' ';}  
      if(chk=='('){  
  UART1_Read_Text(txt,")",2);  // reads text until 'enter' is found  
  Lcd_Cmd(_LCD_CLEAR);  
  Lcd_Out(1, 2, "Received Data");  
  Lcd_Out(2,1,txt);  
  delay_ms(500);  
  }  
  }  
 }  
 }

RF 433 MHz (Wireless Radio Frequency) Communication Between two Microcontroller [Step By Step Tutorial ]

Proteus Circuit:

How to Create a New Project in Proteus 8_Step1
How to Create a New Project in Proteus 8_Step1
How to Create a New Project in Proteus 8_Step2
How to Create a New Project in Proteus 8_Step2

How to Create a New Project in Proteus 8_Step3
How to Create a New Project in Proteus 8_Step3
How to Pick parts from Proteus library
How to Pick parts from Proteus library
RF 433 MHz (Wireless Radio Frequency) Communication Between two Microcontroller [Step By Step Tutorial ]
How to find Power, Ground etc
Now just complete the circuit as I have given below.

RF 433 MHz (Wireless Radio Frequency) Communication Between two Microcontroller [Step By Step Tutorial ]
RF 433 MHz (Wireless Radio Frequency) Communication Between two Microcontroller [Step By Step Tutorial ]

Result :

RF 433 MHz (Wireless Radio Frequency) Communication Between two Microcontroller [Step By Step Tutorial ]
RF 433 MHz (Wireless Radio Frequency) Communication Between two Microcontroller [Step By Step Tutorial ]

RF 433 MHz (Wireless Radio Frequency) Communication Between two Microcontroller [Step By Step Tutorial ]
RF Module ( Wireless Radio Frequency ) Controlled Simulation

Watch Real Life Video :


MODULO RF(PROTEUS)

  Download Link(Google Drive)

Thank You!



23 comments:

  1. i've downloaded the file and i tried to play the simulation but there is no data shown in the LCD , niether in the virtual terminal , could you check it please ?


    what about the RF modules in proteous ? did you design it your self or it is a ready library ?


    thanks

    ReplyDelete
    Replies
    1. I have found that RF modules in a facebook group. I have no Idea why wasn't working. I have uploaded everything after getting it worked.

      Delete
  2. hi
    what is the porpuse of this line UARt1_Write_Text(",,,,,,,,,,,");

    ReplyDelete
    Replies
    1. Well, All I did was to make it work. That's all I could say.

      Delete
  3. Hello!
    Unable to download a project from dropbox.
    Could you please put file somewhere else?
    Thanks in advance.

    ReplyDelete
  4. How do i ensure that if two RF receivers get the data, only one of them receives it? For example - when we use HT12E and HT12D pair of ICs, when there are two RF receivers, only the one which the address matches gets the data.

    How do i achieve it using this circuit? Should i still use HT12E/12D ICs to set the address using DIP switches?

    Thanks,
    vsathyan

    ReplyDelete
    Replies
    1. On that case you have to make something different like see every receiver can receive data but you can specify a certain call or code or address for each receiver and Receiver mcu will response after having a call. Thank you.

      Delete
  5. Hello, I tested here on my protheus 8.0 and it does not communicate, I put the original pic files for each one, being rx, and tx both working at 12mhz, it turns the display on, but when key press does not communicate, what can it be?
    Thank you for the explanation so far.

    ReplyDelete
    Replies
    1. It was supposed to work, check out the youtube video. Ah, I have no idea. You should check everything and there might be something wrong, I guess. I had published it after having it working. Thank you.

      Delete
  6. Could you please share the link of libraries required for rf tx and rx? It will be useful.Thank You!

    ReplyDelete
    Replies
    1. Sure I will(My comment option wasn't working for a long time). I will upload this within next 3-4 hours.

      Delete
  7. I recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing. Smart Watches

    ReplyDelete
  8. I think this is a standout amongst the most huge data for me. Furthermore, i'm happy perusing your article. Be that as it may, ought to comment on some broad things, The site style is flawless, the articles is truly incredible : D. Great job, salud
    I can't read articles online all the time, however I'm happy I did today. This is extremely elegantly composed and your focuses are all around communicated. Kindly, never quit composing.
    Nature of Administrations

    ReplyDelete
  9. Gonzalez, thought about a capable criminal programmer, given "Dumps" which is credit card information he took from the breaks and upheld the flexibly of "Carders". "Carders" are the individuals who purchase, sell, and exchange online the credit card information taken from phishing destinations or from huge information penetrates at retail locations. Cvv dumps

    ReplyDelete
  10. Amazing site, Distinguished input that I can handle.
    Polk Audio T50

    ReplyDelete
  11. Also, it isn't only the useful issues that are a worry to you. Being the proprietor of an independent venture, with a restricted pay and limited assets you are normally centered around holding those expenses down.free credit card machine for small business

    ReplyDelete
  12. In a harsh working environment, everyday keyboards can't always go the distance. You need a durable keyboard you can rely on - one that won't be affected by dust, dirt, moisture or extreme temperatures. Our range of tough industrial keyboards have been designed and manufactured to the highest specifications to ensure you full functionality and dependability. Industrial keyboard for HMI

    ReplyDelete
  13. You've written a fantastic article. This article provided me with some useful knowledge. Thank you for providing this information. Hire A Verified Hacker

    ReplyDelete
  14. Before we investigate the different radio and administration choices accessible, we should initially consider a few fundamentals that apply to two-way radios and radio administrations. https://twitchviral.com/

    ReplyDelete
  15. i love reading your blog posts. keep posting. visit our website and check best golf grips here is the link

    ReplyDelete
  16. Thanks for sharing. visit our website and get universal remote codes for sanyo tv with Instructions

    ReplyDelete

Ain't getting any visitors!
Please Share and Bookmark posts.

Tags

: (1) 18F2550 (1) 36KHz (3) and (1) arduino (1) Based (1) battery (1) Bipolar (1) Blinking (1) blinks (1) Bluetooth (1) bluetooth device interfacing (1) bluetooth module (1) button (1) circuit (1) clock (1) control (1) crystal oscillator (3) Db9 (1) DC Motor (2) digital (2) Digital Voting Machine (1) digital voting machine using pic (1) display (2) DS1307 (1) electronic (1) embedded c programming tutorial (11) embedded c tutorial (11) experiment kit (4) external interrupt (4) flash (1) flashing (1) Gas Leakage detector (1) HC-06 (1) home (1) how (1) How to (10) i2c tutorial (1) in (1) indicator (1) infrared Connection (3) interface (8) interfacing (3) Interrupt (3) Introduction (1) IR Connection (3) IR Receiver (4) IR Transmitter (4) key pad (1) keyboard (1) keypad (1) lavel (1) Lcd 16x2 (2) lcd 2x16 (2) led (1) lm35 (2) LPG (1) machine (1) make (1) Make bootloader (1) making (1) matrix (1) max232 (1) membrane keyboard (2) meter (2) Micocontroller (1) microchip (4) microchip pic (2) microchips (3) microcontroller (9) microcontroller based (3) microcontroller programming (3) Microcontroller Project (4) Microcontroller Projects (1) microcontroller_project (2) microcontrollers (4) Microprocessor (2) mikroC (5) mikroc code to start and stopstart and stop dc motor (1) mikroc pro for pic (2) Motion detector (1) MQ-9 Gas Sensor (1) musical (1) NEC Protocol (4) pcb (5) PIC (3) pic controller (11) pic microcontroller (11) pic microcontroller tutorial (11) pic programming (1) pic programming in c (12) pic proteus (1) Pic Tutorial (12) pic18 (2) pic18f2550 (11) picmicrocontroller (4) picRFモジュール (1) PIR Motion Sensor (1) printed circuit board (1) proteus (6) pulse width modulation (1) push (1) push button (1) PWM (1) real (1) rf transmitter (3) Rs 232 (1) Rs232 (1) scroll (1) scrolling (1) Serial communication (1) Serial Connection (1) Serial Port (1) serial port rs232 (1) Servo Motembedded c programming tutorial (1) simulation (2) Soil Moisture Meter (1) speed control (1) step by step (7) step bystep (1) Stepper Motor (2) text (2) Thief Detector (1) time (1) timer (4) timer0 (4) tone (1) TSOP38236 Receiver (4) tutorial (2) Unipolar (1) USART Connection (1) USB (1) usb 1.0 (1) USB bootloadere (1) USB HID (1) using (9) voltmeter (1) voting (1) water level indicator (3) with (2) work (1)

Traffic Feed


Live Traffic Feed
Visitor Tracking

Leave Your Message Here

Name

Email *

Message *

Like on Facebook