Arduino - RF 433 Module Communication

In this Project, we will see about how to transfer data through RF433MHz module with Arduino.

Circuit Diagram:

Arduino Code:
rf_433_tx_code.ino
/*
   RF433 TRANSMITTER
*/

#include "VirtualWire.h"
char *msg;

void setup() {
  vw_set_tx_pin(8);
  vw_setup(4000);
}

void loop() {
  msg = "LED_ONN" ;
  vw_send((char *)msg, strlen(msg));
  vw_wait_tx();
  delay(3000);

  msg = "LED_OFF" ;
  vw_send((char *)msg, strlen(msg));
  vw_wait_tx();
  delay(3000);
}

rf_433_rx_code.ino
/*
   RF433 RECEIVER
*/

#include "VirtualWire.h"

void setup() {
  vw_set_rx_pin(8);
  vw_setup(4000);
  vw_rx_start();

  Serial.begin(9600);
  pinMode(13, OUTPUT);
}

void loop() {
  char buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;

  if (vw_get_message(buf, &buflen)) {
    Serial.println(buf);
    String str(buf);
    if (str.equals("LED_ONN")) {
      digitalWrite(13, 1);
    }
    if (str.equals("LED_OFF")) {
      digitalWrite(13, 0);
    }
  }
}

Libraries Used:

Youtube Video Tutorial:




Download our official Android App in PlayStore. Click Here
You can get the all the required files (like Circuit Diagram, Arduino.ino file, Libraries Used, and others) for the project  in ZIP format and much more...

No comments:

Post a Comment