Arduino 433Mhz rf transmitter and receiver
Table of Contents
Description:
Arduino 433Mhz RF Rx Tx- In this Tutorial, you will learn, how to make your own wireless remote control system using Arduino and 433MHz RF Radiofrequency transmitter and receiver modules. 433Mhz RF Rx Tx modules are quite famous for short-range uni-directional communication. These 433Mhz RF modules can be used for monitoring and controlling. This tutorial covers all the basics steps by step.
- H-Bridge explanation
- Transmitter and Receiver Circuit Diagrams explanation.
- Transmitter and receiver module Pinout.
- Transmitter and receiver program explanation.
H-Bridge:
H-bridges are very commonly used in robotics for controlling the direction of DC Motors. Each DC motor can have one H-bridge. If two H-bridges are used with two motors in a Robot, the Robot forward, left and right movements can be controlled. This remote controller can be used to control almost anything. By increasing the number of buttons many electrical loads can be controlled.
In this Project, two H-Bridges will be controlled wirelessly. Basically we have two types of H-bridges.
- Relays based H-bridge.
- Mosfets based H-bridge.
The relays based H-bridges are used in low speed switching circuits, where we need to Turn on or Turn off an electrical load at low switching speeds greater than 500 milliseconds. While the MOSFETs based H-Bridges are used in high speed switching circuits where we need to control the motor using the Pulse Width Modulation. As in the project under discussion, we are not using the Pulse width modulation, so in this project, Relays will work just fine.
In relays based H-Bridge, two relays are used to change the polarity of the DC Motor. The working of the H-Bridge will be explained in the receiver circuit diagram.
Amazon Links:
Arduino Nano USB-C Type (Recommended)
433 MHz Transmitter and Receiver Modules:
*Disclosure: These are affiliate links. As an Amazon Associate I earn from qualifying purchases.
433Mhz RF and Arduino Circuit Diagrams:
1 433Mhz RF Transmitter and Arduino Circuit Diagram:
The transmitter circuit is really simple as it consists of only 4 push buttons and a transmitter module. As you can see one leg of all the push buttons is connected with the ground. while the other legs are connected with pin numbers 2, 4, 7 and 8 of the Arduino.
While the VCC of the transmitter module is connected with Arduino’s 5v, GND is connected with the Arduino’s ground and data pin is connected with pin number 12 of the Arduino. To increase the range a wire can be soldered with the antenna.
This is a 433Mhz RF transmitter module, as you can see it has three male headers labeled with data, Vcc and ground. Its connection with the Arduino is already explained in the circuit diagram.
This is the 433Mhz RF receiver module, it has 4 male headers. the rightmost pin is the VCC and the leftmost pin is the ground. while the middle two pins are interconnected and these are the data pins. Connect any of these two pins with pin number 11 of the Arduino.
433Mhz RF Receiver and Arduino Circuit Diagram:
This is the circuit diagram of the receiver. As you can see the 433Mhz RF receiver module VCC pin is connected with the Arduino’s 5v, the ground is connected with the Arduino’s ground and the data pin is connected with Pin number 11 of the Arduino.
On the right side, we have two H-bridges, each H-bridge is used to control one motor, with the help of these H-bridges the direction of rotation of the motors can be controlled. The DC motor two wires are connected with the relay common contacts. While the relay normally close and normally open contacts are connected with the External Power Supply. By turning ON and Turn Off the relays we can control the direction of the dc motor.
Download: “H-bridge PCB board”
Programming:
This Project is based on two programs, one program is written for the transmitter, while another program is written for the Receiver side.
Arduino 433Mhz Rf Transmitter side Programming:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
// transmitter.pde #include <VirtualWire.h> const int led_pin = 11; const int transmit_pin = 12; const int transmit_en_pin = 3; int button = 7; int button1 = 8; int button2 = 2; int button4 = 4; void setup() { // Initialise the IO and ISR vw_set_tx_pin(transmit_pin); pinMode(button, INPUT); pinMode(button1, INPUT); pinMode(button2, INPUT); pinMode(button4, INPUT); vw_setup(2000); // Bits per sec } byte count = 1; void loop() { char msg[7] = {'h'}; char msg1[7] = {'j'}; char msg2[7] = {'l'}; char msg3[7] = {'m'}; char msg8[7] = {'z'}; // msg[6] = count; if(digitalRead(button) == 0 ) { vw_send((uint8_t *)msg, 1); // change this number according to the sensor values vw_wait_tx(); // Wait until the whole message is gone delay(1000); } if(digitalRead(button1) == 0 ) { vw_send((uint8_t *)msg1, 1); // change this number according to the sensor values vw_wait_tx(); // Wait until the whole message is gone delay(1000); } if(digitalRead(button2) == 0 ) { vw_send((uint8_t *)msg2, 1); // change this number according to the sensor values vw_wait_tx(); // Wait until the whole message is gone delay(1000); } if(digitalRead(button4) == 0 ) { vw_send((uint8_t *)msg8, 1); // change this number according to the sensor values vw_wait_tx(); // Wait until the whole message is gone delay(1000); } else digitalWrite(button, HIGH); digitalWrite(button1,HIGH); digitalWrite(button2,HIGH); digitalWrite(button4,HIGH); } |
Arduino 433Mhz Rf Receiver side Programming:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
#include <VirtualWire.h> const int led_pin = 13; int rightmotor1 = 2; // right side motor int rightmotor2 = 3; // left side motor int leftmotor1 = 7; int leftmotor2 = 8; const int receive_pin = 11; void setup() { delay(1000); Serial.begin(9600); // Debugging only Serial.println("setup"); // Initialise the IO and ISR vw_set_rx_pin(receive_pin); vw_set_ptt_inverted(true); // Required for DR3100 vw_setup(2000); // Bits per sec vw_rx_start(); // Start the receiver PLL running pinMode(led_pin, OUTPUT); digitalWrite(led_pin, LOW); pinMode(rightmotor1, OUTPUT); pinMode(rightmotor2, OUTPUT); pinMode(leftmotor1, OUTPUT); pinMode(leftmotor2, OUTPUT); } void loop() { uint8_t buf[VW_MAX_MESSAGE_LEN]; uint8_t buflen = VW_MAX_MESSAGE_LEN; if (vw_get_message(buf, &buflen)) // Non-blocking { int i; // Message with a good checksum received, dump it. Serial.print("Got: "); for (i = 0; i < buflen; i++) { char c = (buf[i]); if( c == 'z') { digitalWrite(led_pin , LOW); digitalWrite(rightmotor1 , LOW); digitalWrite(rightmotor2 , LOW); digitalWrite(leftmotor1 , LOW); digitalWrite(leftmotor2 , LOW); Serial.print(c); Serial.print(' '); } if( c == 'j') // for right side { digitalWrite(rightmotor1 , LOW); digitalWrite(rightmotor2 , LOW); digitalWrite(led_pin, LOW); digitalWrite(leftmotor1 , HIGH); digitalWrite(leftmotor2 , LOW); delay(200); digitalWrite(leftmotor1 , LOW); digitalWrite(leftmotor2 , LOW); delay(200); // digitalWrite(leftmotor1 , HIGH); // digitalWrite(leftmotor2 , LOW); Serial.print(c); Serial.print(' '); } if( c == 'h') // for straight { digitalWrite(led_pin, HIGH); digitalWrite(rightmotor1 , HIGH); digitalWrite(rightmotor2 , LOW); digitalWrite(leftmotor1 , HIGH); digitalWrite(leftmotor2 , LOW); Serial.print(c); Serial.print(' '); } if( c == 'l') // for left { digitalWrite(leftmotor1 , LOW); digitalWrite(leftmotor2 , LOW); digitalWrite(rightmotor1 , HIGH); digitalWrite(rightmotor2 , LOW); delay(200); digitalWrite(rightmotor1 , LOW); digitalWrite(rightmotor2 , LOW); delay(200); // digitalWrite(leftmotor1 , LOW); // digitalWrite(leftmotor2 , HIGH); Serial.print(c); Serial.print(' '); } if( c == 'm') { Serial.print(c); Serial.print(' '); } } } } |
Watch Video Tutorial:
Other Projects based on the 433Mhz RF Tx and Rx:
Wireless Joystick controlled Robot Car using Arduino, 433Mhz RF and L298N Motor Driver
Wireless Hand gesture controlled Robot with Flex Sensor using Arduino
Load balancing of a 3 Phase Transformer, Arduino 3 Phase Load Balancer
Wireless Joystick controlled Robot Car using Arduino, 433Mhz RF and L298N Motor Driver
Tongue Controlled Wheelchair using Arduino and Hall effect Sensors