Multiple Nodes nRF24L01+ Wireless Temperature DS18B20 with Arduino UNO (2 Transmitter , 1 Receiver)

Parts List
  • nRF24L01+
  • DS18B20 Temperature Sensor
  • I2C LCD display 16×2
  • Arduino UNO
  • 4.7k resistor

Multiple_Nodes_nRF24L01_Elec-Cafe

Library

nRF24L01 Library
RF24 Library
DallasTemperature 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

TX1_DS18B20_ArduinoUNO_nRF24L01_Elec-CafenRF24L01+ DS18B20 TX 1

TX2_DS18B20_ArduinoUNO_nRF24L01_Elec-CafenRF24L01+ DS18B20 TX 2

RX_Multi_nRF24L01_ArduinoUNO_LCD_Elec-CafenRF24L01+ RX (Multiple Nodes)

Code

Upload Code to TX 1

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 2

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

float temp1;

RF24 radio(9, 10);
const uint64_t pipes[3] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0E2LL, 0xF0F0F0F0E3LL };

void setup(void) {
Serial.begin(9600);
sensors.begin();
radio.begin();
radio.setDataRate(RF24_250KBPS);
radio.openWritingPipe(pipes[1]);
radio.startListening();
}

void loop(void)
{
sensors.requestTemperatures();
temp1 = sensors.getTempCByIndex(0);
radio.write(&temp1, sizeof(temp1));
delay(10);
}

Upload Code to TX 2

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 2

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

float temp2;

RF24 radio(9, 10);
const uint64_t pipes[3] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0E2LL, 0xF0F0F0F0E3LL };

void setup(void) {
Serial.begin(9600);
sensors.begin();
radio.begin();
radio.setDataRate(RF24_250KBPS);
radio.openWritingPipe(pipes[2]);
radio.startListening();
}

void loop(void)
{
sensors.requestTemperatures();
temp2 = sensors.getTempCByIndex(0);
radio.write(&temp2, sizeof(temp2));
delay(10);
}

Upload Code to RX (Multiple Nodes)

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.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 temp1, temp2;

RF24 radio(9, 10);
const uint64_t pipes[3] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0E2LL, 0xF0F0F0F0E3LL };

void setup(void) {
Serial.begin(9600);
radio.begin();
radio.setDataRate(RF24_250KBPS);
radio.openReadingPipe(1, pipes[1]);
radio.openReadingPipe(2, pipes[2]);
radio.startListening();
lcd.begin(16, 2);
lcd.backlight();
lcd.clear();
lcd.print("nRF24L01+ Temp");
delay(1000);
lcd.clear();
lcd.print("Connecting.....");
delay(1000);
}

void loop(void)
{
lcd.clear();
delay(500);
if ( radio.available() )
{
delay(50);
radio.read(&temp1, sizeof(temp1));
lcd.setCursor(0, 0);
lcd.print("Temp 1");
lcd.setCursor(9, 0);
lcd.print(temp1);
lcd.print(" C");

delay(50);
radio.read(&temp2, sizeof(temp2));
lcd.setCursor(0, 1);
lcd.print("Temp 2");
lcd.setCursor(9, 1);
lcd.print(temp2);
lcd.print(" C");
}
else
{
lcd.println("No radio available");
}
delay(1000);
}
DS18B20 nRF24L01+ Temperature with LCD Display

Temp 1 amd Temp 2 on LCD Display

 Multi_nRF24L01_ArduinoUNO_LCD