Arduino Wireless Temperature LCD Display (nRF24L01+ DHT11)

Parts List
  • nRF24L01+
  • DHT11 Temperature and Humidity Sensor
  • I2C LCD display 16×2
  • Arduino UNO
  • 4.7k resistor
Library

nRF24L01 Library
RF24 Library
DHT11 Library
LiquidCrystal_I2C Library
Wire Library

Wiring

Wire nRF24L01+ to Arduino UNO

GND <–> GND
VCC <–> Arduino 3.3V
CE <–> Arduino pin 9
CSN <–> Arduino pin 10
SCK <–> Arduino pin 13
MOSI <–> Arduino pin 11
MISO <–> Arduino pin 12

 

nRF24L01_DHT11_LCD_Arduino_UNO_TX_Elec-Cafe

nRF24L01_DHT11_LCD_Arduino_UNO_RX_Elec-Cafe

Code

Upload Code to TX

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <DHT11.h>

int pin = A0;
DHT11 dht11(pin);
float temperature[2];

double Fahrenheit(double celsius) {
return ((double)(9 / 5) * celsius) + 32;
}

double Kelvin(double celsius) {
return celsius + 273.15;
}

RF24 radio(9, 10);
const uint64_t pipe = 0xE8E8F0F0E1LL;

void setup(void) {
radio.begin();
radio.openWritingPipe(pipe);
}

void loop(void)
{
float temp, humi;
dht11.read(humi, temp);
temperature[0] = temp;
temperature[1] = humi;
radio.write(temperature, sizeof(temperature));
delay(1000);
}

 

Upload Code to RX

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <DHT11.h>
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
// Addr, En, Rw, Rs, d4, d5, d6, d7, backlighpin, polarity

float temperature[2];

RF24 radio(9, 10);
const uint64_t pipe = 0xE8E8F0F0E1LL;

void setup(void) {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(1, pipe);
radio.startListening();
lcd.begin(16, 2);
lcd.backlight();
lcd.clear();
lcd.print("Humidity & temp");
delay(1000);
lcd.clear();
lcd.print("Starting.....");
delay(1000);
}

void loop(void)
{
if ( radio.available() )
{
bool done = false;
while (!done)
{
done = radio.read(temperature, sizeof(temperature));
lcd.clear();
delay(500);
lcd.setCursor(0, 0);
lcd.print("Temp");
lcd.setCursor(0, 1);
lcd.print("Humidity");
lcd.setCursor(9, 0);
lcd.print(temperature[0]);
lcd.print(" C");
lcd.setCursor(9, 1);
lcd.print(temperature[1]);
lcd.print(" %");
delay(1000);
}
}
else
{
lcd.setCursor(0, 0);
lcd.print("No radio available");
}
}