How 433MHz RF Module Works & Interfacing With Arduino

Introduction:

Wireless Communication in any form has become an essential part of human life whether it may be short distance T.V Remote or long-distance radio communication. Wireless communication is all about the transmission of data wirelessly so that there is no hassle of any wires and no direct contact with the device itself.

One of the easiest and cheapest ways to implement wireless communication is using RF Module (Radio Frequency Module). In this blog, we will be seeing, how you can interface the 433MHz RF module with Arduino and transmit the data from one place and receive it at the other place wirelessly.

What is RF in Arduino?

RF stands for Radiofrequency. The Arduino can be made to communicate data with other microcontrollers via RF. This can be done by interfacing an RF module with an Arduino to send and receive data wirelessly.

What is RF 433MHz?

As we know RF stands for Radiofrequency, RF 433MHz is a pair of electronic RF transmitter and receiver modules used to send and receive radio signals between any two devices. The transmitter module sends the data from the transmitter end and the Receiver module receives that data at eh receiver’s end. The frequency of this RF signal will be 433MHz.

Components required for interfacing 433MHz RF module with Arduino:

  1. Arduino UNO  -  2.
  2. 433MHz RF Transceiver module  -  1
  3. Breadboard  -  2
  4. LED (Any color)  -  1
  5. Push Button  -  1
  6. Male to male jumper cable  -  As required

How does the 433 MHz RF module work?

How does the 433 MHz RF module work

The above block diagram shows the full workflow of the RF Module. We will see in detail, how the RF transmitter and receiver module works.

Transmitter working:

This radio frequency (RF) transmitter module uses Amplitude Shift Keying (ASK) and operates at 434MHz. The transmitter module takes serial input through a microcontroller and transmits these signals through RF. The transmitted signals are then received by the receiver module placed at the other end from the source of transmission.

RF 433MHz transmitter working

So when the DATA input pin of Arduino is set to logic HIGH, the oscillator starts generating a constant RF output carrier wave at 434 MHz and when the logic LOW is applied to the DATA, the oscillator stops producing the RF wave. This technique is known as Amplitude Shift Keying.

Receiver Working:

RF 433MHz Receiver working

The receiver module receives the data in the form of a signal and sends it to the data pin. The data received by the module is always in an encoded form which can be decoded by either using the microcontroller or the decoder.

The RF receiver module comprises an RF tuned circuit and a couple of Operational Amplifiers to amplify the received carrier wave from the transmitter. The amplified signal is then further fed to a PLL (Phase Lock Loop) later it is received by the decoder which decodes the output stream and gives better noise immunity.

What is ASK?

As discussed above, for sending the data over the radio frequency signals, these modules use a technique called Amplitude Shift Keying or ASK. In Amplitude Shift Keying the amplitude (i.e. the level) of the carrier wave (in our case it’s a 433MHz signal) is changed in response to the incoming data signal.

This is very similar to the analog technique of amplitude modulation which you might be familiar with if you’re familiar with AM radio. It’s sometimes called binary amplitude shift keying because there are only two levels we are concerned with. You can think of it as an ON/OFF switch.

  • For Digital 1 – This drives the carrier at full strength.
  • For Digital 0 – This cuts the carrier off completely.

This is what the Amplitude modulation looks like:

Interfacing 433Mhz RF Module with Arduino

Amplitude Shift keying has the advantage of being very simple to implement. It is quite simple to design the decoder circuitry. Also, ASK needs less bandwidth than other modulation techniques like FSK (Frequency Shift Keying). This is one of the reasons for being inexpensive.

Interfacing 433Mhz RF Module with Arduino( add source code, circuit):

For interfacing 433MHz Rf Module with Arduino, we require the components mentioned above in the components required section.

Below is the connection diagram for the transmitter and receiver module with Arduino UNO:

Transmitter module with Arduino UNO:

RF 433MHz Transmitter

The connection for the transmitter side has to be made as per the above diagram. You can use any Arduino board for this project.

VCC pin of the Transmitter module

5V pin of Arduino

GND pin of the Transmitter module

GND pin of Arduino 

DATA pin of the Transmitter module

GPIO 12 of Arduino 

Pin 1 of the push-button 

GPIO 6 fo Arduino 

Pin 2 of the push-button

GND pin of Arduino 

Receiver module with Arduino UNO:

RF 433MHz Receiver

The connection for the receiver side has to be made as per the above diagram. For connecting the transmitter module, we will be using the second Arduino UNO board.

Both the VDD pins of the Receiver module

5V pin of Arduino

3 GND pins of the Receiver module

GND pin of Arduino 

DATA pin of the Receiver module

GPIO 11 of Arduino 

Positive terminal of LED via a 330-ohm resistor in series

GPIO 6 fo Arduino 

Negative pin of LED

GND pin of Arduino 

Source code for Transmitter module:

#include <VirtualWire.h>
#define button 6

char *data;
int val;
int value = 0;

void setup()
{
vw_set_tx_pin(12);
vw_setup(2000);
pinMode(button, INPUT_PULLUP);
}
void loop()
{
val = digitalRead(button);
if(val == LOW && value == 0)
{
data="a";
vw_send((uint8_t *)data, strlen(data));
vw_wait_tx();
delay(500);
value = 1;
}
else if(val == LOW && value == 1)
{
data="b";
vw_send((uint8_t *)data, strlen(data));
vw_wait_tx();
delay(500);
value = 0;
}
delay(200);
}
           

 

In the above code we have used a library called VirtualWire.h. In this code, we are calling the functions from the VirtualWire.h library and passing the PIN to which the transmitter module’s DATA pin is connected and we are passing the data to the transmitter to the receiver via RF signal. We have used an if, else statement in the code. In this if, else statement we made a condition that, when the pushbutton is pressed for the first time, the character ‘a’ data has to be transmitted to the receiver. When the button is pressed for the second time, the character ‘b’ has to be transmitted to the receiver.

Source code for Receiver module:


#include <VirtualWire.h>
#define ledPin 6

void setup()
{
vw_set_rx_pin(11);
vw_setup(2000);
pinMode(ledPin, OUTPUT);
vw_rx_start();
}
void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen))
{
if(buf[0]=='a')
{
digitalWrite(ledPin,HIGH);
}
else if(buf[0]=='b')
{
digitalWrite(ledPin,LOW);
}
}
}
           

 

The above code is used for receiver module. In the code, we have passed the pin number to which the DATA pin of the receiver is connected. And we have declared a pin for connecting LED. The if, else statement is used to check the condition of the received data. If the character ‘a’ data is received, then the LED will be turned ON. And when the character ‘b’ is received, then the LED will be turned OFF.

Procedure:

  1. Make connections as per the circuit diagram on the transmitter and the receiver side.
  2. Upload the respective code to both the Arduino boards. (Transmitter code on transmitter Arduino and Receiver code on receiver Arduino)
  3. Once the connections and the programming are done, it's time to see the output.
  4. Turn ON both the Arduino and place it a distance below 3 meters in indoors.
  5. Next, press the push-button on the transmitter side, the LED on the receiver side should turn ON. Again when you press the push button for the second time, the LED on the receiver side will be turned OFF.  
  6. Hence, we have successfully established a communication link between the transmitter and the receiver wirelessly through RF signals and transmit data from the transmitter to the receiver.

Conclusion:

In this blog, we have learned about RF technology and how to use the RF technology using Arduino and RF modules. We have seen, what is RF in Arduino? What is a 433MHz RF module? Working principle of RF modules, and components required, connections, source code, and how to interface it with Arduino and communicate data between transmitter & receiver wirelessly.

Frequently Asked Questions

1. What is RF in Arduino?

RF in Arduino means, Interfacing of RF module with Arduino and enabling Arduino to communicate with other microcontrollers via RF signals. For doing this we will require an RF module such as a 433MHz RF transmitter and receiver module.

 

2. How do I know if an RF module is working?

TO check the RF module, make the connection as given in the connections section in the above blog, upload the source code to both the Arduino, and press the push button on the transmitter side. If the LED on the receiver side turns ON then your RF module is working fine.


 

Leave a comment

Please note, comments must be approved before they are published