Connecting to Arduino 433MHz transmitter and receiver. Wireless control relay.

In this paper we consider the work of Arduino with 433 MHz radio transmitter and receiver (Figure 1). In particular implement wireless control electromagnetic relays using the clock button.

Figure 1 – The radio transmitter and receiver

Wireless modules transmitters allow Arduino to communicate with other Arduino, or radio controlled devices that operate on the same frequency (433 MHz in this case).

They work in pairs, ie we need to work as a receiver and transmitter.

Technical characteristics of radio modules

Transmitter (TX)

Working voltage: 3V – 12V fo max. power use 12V
Working current: max Less than 40mA max , and min 9mA
Resonance mode: (SAW)
Modulation mode: ASK
Working frequency: Eve 315MHz Or 433MHz
Transmission power: 25mW (315MHz at 12V)
Frequency error: +150kHz (max)
Velocity : less than 10Kbps

Receiver (RX)

Working voltage: 5.0VDC +0.5V
Working current:?5.5mA max
Working method: OOK/ASK
Working frequency: 315MHz-433.92MHz
Bandwidth: 2MHz
Sensitivity: excel –100dBm (50?)
Transmitting velocity: <9.6Kbps (at 315MHz and -95dBm)

One of the main requirements for radio module – a range and quality of their actions. However, they can be significantly improved by further connecting the antenna – it recommended length for transmitters with a frequency of 433 MHz is about 17 cm.

Now to connect the same elements. Each has pins “power” and “ground” as well as digital output for data. They subscribed to the motherboard, so the connection will not cause any problems. Additional antenna connection will increase the quality of the modules, but the communication range can be improved and by supplying power to the module – if it will be 12, the range and reliability due to increase significantly.

Connecting the transmitter


Connecting the receiver


Relay will be connected to the digital output 7 on Arduino with receiver.
The button will be connected to the digital output 8 on Arduino with transmitter.

The scheme with the transmitter and button


Scheme with receiver and relay


Program code for the transmitter

This sketch transmits a short text message using the VirtualWire library
connect the Transmitter data pin to Arduino pin 12

int switchPin = 8;
boolean lastButton = LOW;
boolean currentButton = LOW;
int check = 0;

void setup()
pinMode(switchPin, INPUT);

// Initialize the IO and ISR
vw_setup(2000); // Bits per sec

boolean debounce(boolean last)
boolean current = digitalRead(switchPin);
if (last != current)
current = digitalRead(switchPin);
return current;

void loop()
currentButton = debounce(lastButton);
if (lastButton == LOW && currentButton == HIGH && check == 0)
check = 1;

if (lastButton == LOW && currentButton == HIGH && check == 1)
check = 0;

void send (char *message)
vw_send((uint8_t *)message, strlen(message));
vw_wait_tx(); // Wait until the whole message is gone

Program code for the receiver

This sketch displays text strings received using VirtualWire
Connect the Receiver data pin to Arduino pin 11
byte message[VW_MAX_MESSAGE_LEN]; // a buffer to store the incoming messages
byte messageLength = VW_MAX_MESSAGE_LEN; // the size of the message
int relayPin = 7;

void setup()
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, HIGH);

Serial.println("Device is ready");
// Initialize the IO and ISR
vw_setup(2000); // Bits per sec
vw_rx_start(); // Start the receiver
void loop()
if (vw_get_message(message, &messageLength)) // Non-blocking

Serial.print("Received: ");
for (int i = 0; i < messageLength; i++) { char c = message[i]; Serial.print(c); char on = 'on'; if(c == on) { digitalWrite(relayPin, LOW); } char off = 'of'; if(c == off) { digitalWrite(relayPin, HIGH); } } Serial.println(); } }

The result of the work done:

1 комментарий

Оставить ответ

Обязательные поля помечены*

Этот сайт использует Akismet для борьбы со спамом. Узнайте как обрабатываются ваши данные комментариев.