433mhz RF Transmitter and Receiver module with Arduino

433mhz RF Transmitter and Receiver module with Arduino

Hello, welcome back. In this tutorial, we will learn what is the RF transmitter-receiver module and how it works with the Arduino platform. We can mainly use this module for wireless communication. That is, it can be used to communicate data between two Arduino boards. It uses 433MHz radio waves. Also, we can buy this module at a low cost and communicate data easily. This tutorial presents step by step how to communicate data between two Arduino boards using the example of rotating a servo motor by a potentiometer.

433mhz RF Transmitter and Receiver module with Arduino

This RF transmitter-receiver module consists of two main components. That is,

Transmitter

433mhz RF Transmitter and Receiver module with Arduino

This module was created using a component called SAW Resonator. We can consider it as the main component here. Also, it operates at a radio frequency of 433MHz. An antenna must be connected to transmit the signal more distance.

Receiver

433mhz RF Transmitter and Receiver module with Arduino

This captures the signals sent by the transmitter. To do that, it includes an RF tuned circuit and two op-amps. For this module, we need to connect an antenna.

How does this module work?

Data transmission through these two modules takes place according to a special process. This is called Amplitude Shift Keying (ASK). That is, when a HIGH signal is received for the transmitter module, the constant oscillation activates and produces an RF output carrier wave, and when a LOW signal is given, the oscillation stops. This process is the same as the AM radio process. This is also called binary amplitude shift keying. Because the process works HIGH or LOW in two ways.

The PIN structure of this sensor

Okay, let’s see step by step how this module works with Arduino. The required components are as follows.

Step 1

Firstly, identify these components.

Step 2

Secondly, connect these components. To do this, use the circuit diagrams below.

Transmitter circuit diagram

433mhz RF Transmitter and Receiver module with Arduino

Receiver circuit diagram

433mhz RF Transmitter and Receiver module with Arduino

Step 3

Thirdly,let’s creates the programs for these two circuits. They are given below.

  • RC switch master library — Download
  • The complete program of this project – Download

Transmitter program

#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(9600);
  mySwitch.enableTransmit(10);
}

void loop() {
  int value = analogRead(A1);
  value = map(value, 0, 1024, 0, 180);
  mySwitch.send(value, 30);
}
Code Explanation

Firstly, the library was included and an object was created for this library.

#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();

In the setup function, the library is enable.

void setup() {
  Serial.begin(9600);
  mySwitch.enableTransmit(10);
}

In the loop function, the potentiometer values are taken and sent to the receiver module.

void loop() {
  int value = analogRead(A1);
  value = map(value, 0, 1024, 0, 180);
  mySwitch.send(value, 30);
}

OK, now select board and port. After, upload this code to the transmitter circuit.

Receiver program

#include <Servo.h>
#include <RCSwitch.h>
Servo servo;
RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(9600);
  mySwitch.enableReceive(0);
  servo.attach(3);
}

void loop() {
  if (mySwitch.available()) {
    Serial.println(mySwitch.getReceivedValue());
    servo.write(mySwitch.getReceivedValue());
    mySwitch.resetAvailable();
  }
}
Code Explanation

Firstly, the RCSwitch and servo libraries are included. After, objects were created for these libraries.

#include <Servo.h>
#include <RCSwitch.h>
Servo servo;
RCSwitch mySwitch = RCSwitch();

In the setup function, the RCSwitch is library enable. Also, the pin that connects the servo motor is included.

void setup() {
  Serial.begin(9600);
  mySwitch.enableReceive(0);
  servo.attach(3);
}

In the loop function, the transmitter values are checked using the IF condition and those values are obtained. Then, the servo motor rotates according to those values.

void loop() {
  if (mySwitch.available()) {
    Serial.println(mySwitch.getReceivedValue());
    servo.write(mySwitch.getReceivedValue());
    mySwitch.resetAvailable();
  }
}

OK, now select board and port. After, upload this code to the receiver circuit.

Okay, now power up the two circuits and enjoy this project. The full video guide is given below. So, we will meet in the next video.

433mhz RF Transmitter and Receiver module with Arduino

Similar Posts

Leave a Reply

Your email address will not be published.