IOT

How 433 MHz RF Module Works & Interfacing with Arduino?

In this blog, We’ll study the 433MHz RF Wireless Transmitter and Receiver Module and how it connects to an Arduino. Additionally, we’ll discover how this module functions and how wireless communication happens. Finally, we’ll discover how to wirelessly transmit and receive data packets using this module and an Arduino.

What is an RF Module?

The RF module, as its name suggests, works at radio frequency. This frequency band spans 30 kHz and 300 GHz. The digital data is represented as variations in the amplitude of the carrier wave in this RF system. This type of modulation is an Amplitude Shift Keying (ASK).

An RF Transmitter and an RF Receiver are included in this RF module. The frequency of the transmitter/receiver (Tx/Rx) pair is 434 MHz. An RF transmitter accepts serial data and wirelessly delivers it via RF via its antenna linked to pin4. The transmission speed is between 1 and 10 kilobits per second. An RF receiver operating at the same frequency as the transmitter receives the transmitted data.

433MHz RF Module

433 Mhz RF Module

So, this module appears exactly as it does in the above illustration. Additionally offered in a variety of packages. But basically, each of these modules serves the same purpose. The receiver section is a little larger in size and has 8 pins, whereas the transmitter section is tiny and has just 4 pins.

  • Transmitter Section
433 Mhz Transmitter

This little component serves as a transmitter. The SAW resonator, which is tuned for 433 MHz activities, is the module’s beating heart. A switching transistor and a few passive parts are present.

433 Mhz RF Transmitter Working

The oscillator starts producing a steady RF output carrier wave at 433 MHz when logic HIGH is applied to the DATA input, and it ceases when logic LOW is applied. Amplitude Shift Keying is the name of this method, which is covered in more detail below.

  • Receiver Section
433 Mhz Receiver

This one is a receiver module. To magnify the carrier wave received from the transmitter, it is made up of an RF tuned circuit and a few OP Amps.

433 Mhz RF Receiver Working

The signal is further amplified before being sent into a phase-lock loop (PLL), which allows the decoder to “lock” onto a stream of digital bits for improved output and noise immunity.

What is Amplitude Shift Keying (ASK)?

These modules employ a method known as Amplitude Shift Keying to transmit digital data over the radio (ASK). The amplitude of the carrier wave is altered during amplitude shift keying in response to the incoming data stream.

This closely resembles the analog amplitude modulation method used in AM radio. Because there are just two levels, it is occasionally referred to as binary amplitude shift keying. An ON/OFF switch could be compared to it.

  • For Digital HIGH – This drives the carrier at full strength. 
  • For Digital LOW – This cuts the carrier off completely.
Amplitude Shift Keying

Amplitude Shift keying is really easy to use and reasonably priced, which is a plus. The decoder circuitry is fairly easy to develop. Additionally, compared to other modulation methods like FSK, ASK requires less bandwidth.

Interfacing 433Mhz RF Module with Arduino

We will need two Arduino boards, two breadboards, and a few jumper wires because we will be transmitting data between the two Arduino boards. Both portions of the RF module have an antenna. The real height of the antenna should be 69 cm, although it is not practical to use an antenna that long. So, any wired antenna with a length of around 17 cm can be used.

Transmitter Section Wiring

The transmitter’s wiring is simple. There are just three connections. Connect the Arduino’s VCC pin to the 5V pin and GND to the ground. As recommended by the default library, the Data-In pin should be linked to Arduino’s digital pin 12. library.

Interfacing 433Mhz RF Module with Arduino

Receiver Section Wiring

The receiver’s wiring is equally simple as that of the transmitter. There are just three connections left to be made, once more. Connect the Arduino’s VCC pin to the 5V pin and GND to the ground. Digital pin 11 should be linked to one of the centre’s two Data-Out pins, as illustrated in the diagram.

Interfacing 433Mhz RF Module with Arduino

As a result, you can see in the image below how we connected an Arduino to a 433MHz RF module for both the transmitter and receiver sections.

Source Code/Program

You must first install a library called a Radiohead library before uploading the code. A library called Radiohead enables quick data exchange between Arduino boards. It can be used to power a variety of radio communications equipment, including our 433MHz modules, due to its versatility.

Radiohead Library: Download

Transmitter Section

#include <RH_ASK.h> // Include RadioHead Amplitude Shift Keying Library
#include <SPI.h> // Include dependant SPI Library
// Create Amplitude Shift Keying Object
RH_ASK rf_driver;
void setup()
{
// Initialize ASK Object
rf_driver.init();
// Setup Serial Monitor
Serial.begin(9600);
}
void loop()
{
const char *msg = “Hello World”;
rf_driver.send((uint8_t *)msg, strlen(msg));
rf_driver.waitPacketSent();
{
// Message Transmitted
Serial.println(“Message Transmitted: “);
delay(1000);
}
}

Receiver Section


#include <RH_ASK.h> // Include RadioHead Amplitude Shift Keying Library
#include <SPI.h> // Include dependant SPI Library

// Create Amplitude Shift Keying Object
RH_ASK rf_driver;

void setup()
{
// Initialize ASK Object
rf_driver.init();
// Setup Serial Monitor
Serial.begin(9600);
}

void loop()
{
// Set buffer to size of expected message
uint8_t buf[11];
uint8_t buflen = sizeof(buf);
// Check if received packet is correct size
if (rf_driver.recv(buf, &amp;buflen))
{
// Message received with valid che-cksum
Serial.print(“Message Received: “);
Serial.println((char*)buf);
}
}

Code Explanation

Transmitter sketch:

  • The Radiohead ASK library is introduced in the sketch’s opening. Since the RadioHead library depends on the Arduino SPI Library, we also need to add it.
  • To use the unique features of the Radiohead ASK library, we must next build an ASK object.
  • We must initialize the ASK object in the setup function. We prepare a message before beginning the loop function. The character pointer msg contains a straightforward text string.
  • The send() function is then used to send the message. It takes two inputs: an array of data as the first argument, and the number of bytes (or length of the data) to be delivered as the second. The waitPacketSent() function, which waits until any prior transmit packet is complete in transmission, is typically called after the send() function.
  • The sketch then pauses for a brief period to give our receiver time to process everything.

Receiver sketch:

  • The receiver code begins by loading the Radiohead and SPI libraries and constructing an ASK object, much like the transmitter code did.
  • We initialize the ASK object and configure the serial monitor in the setup procedure because this is how we will view the message we have just received.
  • We establish a buffer with the same size as the transmitted message in the loop function.
  • The recv() method is then called. If the receiver isn’t already turned on, this turns it on. It writes the message to its first argument buffer and returns true if there is a valid message available; otherwise, it returns false. The sketch enters an if statement and prints the received message on the serial monitor if the function returns true.

Conclusion
I hope all of you are clear about How the 433 MHz RF Module Works & how to interface with Arduino. We MATHA ELECTRONICS will be back soon with more interesting topics.

Leave a Reply

Your email address will not be published.