|
Arduino UNO R3 development sensor expansion board |
x 2 | |
|
LCD-S401C39TFLumex
|
x 1 | |
|
DHT22AMAZON
|
x 1 | |
|
Mini Breadboard |
x 1 | |
|
YJ-18039-nRF52840HolyIot
|
x 2 |
|
Arduino Web Editor |
NRF Data Transfer Via 2 Boards
There are various wireless communication technologies used in building IoT applications and RF (Radio Frequency) is one of them. nRF24L01 is a single-chip radio transceiver module that operates on 2.4 - 2.5 GHz (ISM band). This transceiver module consists of a fully integrated frequency synthesizer, a power amplifier, a crystal oscillator, a demodulator, a modulator, and Enhanced ShockBurs protocol engine. Output power, frequency channels, and protocol setup are easily programmable through an SPI interface.
Components Required
Arduino Uno (2)
nRF24L01 (2)
16*2 LCD
LCD I2C Module
DHT11 Sensor
NRF24L01 Transceiver Module Circuit diagram
The circuit diagrams for Arduino nRF24L01 based transmitter and receiver are given below. Here, we are sending the temperature and humidity values wirelessly from one Arduino to another using the nRF24L01 module. To get the temperature and humidity values, we are using the DHT11 sensor that is connected to the transmitting side Arduino. Transmitting Arduino will get temperature and humidity values from DHT11 and then sends it to another Arduino via the nRF24L01 module. These humidity and temperature values will be displayed on 16*2 LCD connected to the receiver side, Arduino.
Interfacing nRF24L01 with Arduino UNO - Transmitting Side
The transmitter side consists of an Arduino UNO, nRF24L01 module, and DHT11 sensor. Interfacing of the Arduino UNO with nRF24L01 and DHT11 is shown below. Arduino continuously gets data from the DHT11 sensor and sends it to the nRF24L01 Transmitter. Then the nRF transmitter transmits the data into the environment.
nRF24L01 Arduino Sender and Receiver Testing
Once the hardware and program are ready, upload both nRF24L01 transmitter and receiver codes in both Arduino modules. The transmitter module will send the temperature and humidity values to Receiver Module. And the receiver module will display it on its 16x2 LCD as shown below
This is how you can use nRF24L01 as a wireless communication medium between two Arduinos.
Code
Transmitter Side
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include "DHT.h"
const uint64_t pipeOut = 0xE8E8F0F0E1LL;
#define DHTPIN 3
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
RF24 radio(9, 10); // CN and CSN pins of nrf
struct MyData {
byte h;
byte t;
};
MyData data;
void setup()
{
Serial.begin(9600);
dht.begin();
radio.begin();
radio.setAutoAck(false);
radio.setDataRate(RF24_250KBPS);
radio.openWritingPipe(pipeOut);
}
void loop()
{
data.h = dht.readHumidity();
data.t = dht.readTemperature();
if (isnan(data.h) || isnan(data.t)){
Serial.println(F("Failed to read from DHT sensor!"));
return;
}
Serial.print("Humidity: ");
Serial.print(data.h);
Serial.print("Temperature: ");
Serial.print(data.t);
radio.write(&data, sizeof(MyData));
}
Receiver Side
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const uint64_t pipeIn = 0xE8E8F0F0E1LL;
RF24 radio(9, 10);
struct MyData {
byte h;
byte t;
};
MyData data;
void setup()
{
Serial.begin(9600);
radio.begin();
lcd.begin();
lcd.home();
lcd.backlight();
lcd.clear();
radio.setAutoAck(false);
radio.setDataRate(RF24_250KBPS);
radio.openReadingPipe(1, pipeIn);
radio.startListening();
//lcd.println("Receiver ");
}
void recvData()
{
if ( radio.available() ) {
radio.read(&data, sizeof(MyData));
}
}
void loop()
{
recvData();
Serial.print("Humidity: ");
Serial.print(data.h);
lcd.setCursor(0,0);
lcd.print("Humidity:");
lcd.print(data.h);
lcd.print("%");
lcd.setCursor(0,1);
Serial.print("Temperature: ");
Serial.print(data.t);
lcd.print("Temperature:");
lcd.print(data.t);
lcd.print(" C");
//Serial.print("\n");
}
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include "DHT.h"
const uint64_t pipeOut = 0xE8E8F0F0E1LL;
#define DHTPIN 3
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
RF24 radio(9, 10); // CN and CSN pins of nrf
struct MyData {
byte h;
byte t;
};
MyData data;
void setup()
{
Serial.begin(9600);
dht.begin();
radio.begin();
radio.setAutoAck(false);
radio.setDataRate(RF24_250KBPS);
radio.openWritingPipe(pipeOut);
}
void loop()
{
data.h = dht.readHumidity();
data.t = dht.readTemperature();
if (isnan(data.h) || isnan(data.t)){
Serial.println(F("Failed to read from DHT sensor!"));
return;
}
Serial.print("Humidity: ");
Serial.print(data.h);
Serial.print("Temperature: ");
Serial.print(data.t);
radio.write(&data, sizeof(MyData));
}
Receiver Side
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const uint64_t pipeIn = 0xE8E8F0F0E1LL;
RF24 radio(9, 10);
struct MyData {
byte h;
byte t;
};
MyData data;
void setup()
{
Serial.begin(9600);
radio.begin();
lcd.begin();
lcd.home();
lcd.backlight();
lcd.clear();
radio.setAutoAck(false);
radio.setDataRate(RF24_250KBPS);
radio.openReadingPipe(1, pipeIn);
radio.startListening();
//lcd.println("Receiver ");
}
void recvData()
{
if ( radio.available() ) {
radio.read(&data, sizeof(MyData));
}
}
void loop()
{
recvData();
Serial.print("Humidity: ");
Serial.print(data.h);
lcd.setCursor(0,0);
lcd.print("Humidity:");
lcd.print(data.h);
lcd.print("%");
lcd.setCursor(0,1);
Serial.print("Temperature: ");
Serial.print(data.t);
lcd.print("Temperature:");
lcd.print(data.t);
lcd.print(" C");
//Serial.print("\n");
}
NRF Data Transfer Via 2 Boards
- Comments(0)
- Likes(0)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by electronicguru0007
- How to make an alarm clock with pic microcontroller he five push buttons will act as an input for setting the alarm for the required time. So one end of...
- How to make RMS to DC Converter using IC AD736 A True-RMS or TRMS is a type of converter which converts RMS value to equivalent DC value. Here in t...
- STM32 SPI Communcation and Data Sent SPI in STM32F103C8Comparing SPI bus in Arduino & STM32F103C8 Blue Pill board, STM32 has 2 SPI bu...
- How to Communicate Arduinos via RS-485 What project will you develop?The project consists of 3 Arduino's. We have an Arduino UNO, a Nano, a...
- PIC16F877A Temperature and Humidity Measurement Board Temperature and Humidity measurement is often useful in many applications like Home Automation, Envi...
- Diy Buck Converter n the field of DC-DC Converters, A single-ended primary-inductor converter or SEPIC converter is a t...
- Iot AC Current Measuring System Smart power monitoring is getting increasingly popular to improve energy efficiency in medium/small ...
- ESP32 Weather Station In this project, we will learn how to create a weather station, which will display reading from a BM...
- NRF Data Transfer Via 2 Boards There are various wireless communication technologies used in building IoT applications and RF (Radi...
- Iot patient monitoring system When we are talking about major vital signs of a human body, there are four major parameters that we...
- Setting up zigbee communication with nodemcu and arduino Zigbee is a popular wireless communication protocol used to transfer a small amount of data with ver...
- Ac Dimmer Remote PCB The brightness can be controlled using the IR remote of TV, DVD, etc. Dimming Control system using M...
- Esp32 Home Automation There are relay modules whose electromagnet can be powered by 5V and with 3.3V. Both can be used wit...
- Lora Communication With Network This was a very simple project and can come in handy for various applications. But what it can't do ...
- GPS Module Based Tracking Device Pcb ESP32 GPS vehicle tracker using NEO 6M GPS module and Arduino IDE. With the help of this GPS tracker...
- Traffic Management for Emergency Vehicles using AT89S52 Microcontroller These days’ traffic congestion is the biggest problem of densely populated cities. The project focus...
- Diy Multimeter Pcb This is a project based on Arduino board which can measureresistance, diode, continuity[H1] , voltag...
- Live Instagram Followers Pcb ESP8266 is capable of functioning reliably in industrial environments, with an operating temperature...
-
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
128 0 0 -
DIY Laser Power Meter with Arduino
190 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
171 0 2 -