Arduino, DS18B20 and NRF24l01
Project details
I’m doing a hobby project and can’t seem to get it working. Aim of the project is to transmit temperature values from a DS18B20 using an Arduino Uno and NRF24l01. The receiver should receive temperature values from transmitter and display. Already worked on the code and the partial code is below.
TX part
#include <OneWire.h>
#include <DallasTemperature.h>
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define ONE_WIRE_BUS 2
#define CE_PIN 9
#define CSN_PIN 10
#define ONE_WIRE_BUS 2
RF24 radio(CE_PIN, CSN_PIN);
//RF24Network network(radio);
const uint16_t this_node = 1;
const uint16_t other_node = 0;
const unsigned long interval = 2000; //ms
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup(void)
{
(9600);
();
(127);
(“Dallas Temperature IC Control Library Demo”);
// (80, this_node);
(pipes[1]);
(1, pipes[0]);
();
}
void loop(void)
{
(” Requesting temperatures…”);
(); // Send the command to get temperatures
(“DONE”);
float currentTemp = (0);
//RF24NetworkHeader header(other_node);
//bool ok = (header, ¤tTemp, sizeof(currentTemp));
();
( ¤tTemp, sizeof(currentTemp) );
(“Temperature for Device 1 is: “);
(currentTemp);
}
RX part
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define CE_PIN 9
#define CSN_PIN 10
RF24 radio(CE_PIN, CSN_PIN);
//RF24Network network(radio);
const uint16_t this_node = 1;
const uint16_t other_node = 0;
const unsigned long interval = 2000; //ms
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
void setup(void)
{
(9600);
delay(1000);
();
(127);
(“Nrf24L01 Receiver “);
//(80, this_node);
(pipes[0]);
(1, pipes[1]);
();;
}
void loop(void)
{
float currentTemp;
if ( () )
{
{
bool done = false;
while (!done)
{
//RF24NetworkHeader header;
//bool ok = (header, ¤tTemp, sizeof(currentTemp));
done = ( ¤tTemp, sizeof(currentTemp) );
(“Temperature for Device 1 is: “);
(currentTemp);
}
}
}
else
(“radio not found”);
}
Transmitter is working perfectly but I’m not receiving any data at the receiver. The following websites were used to connect the circuit
Awarded to:
Var R.
(5.0)
Awarded to:
Var R.
(5.0)
Project details
TX part
#include <OneWire.h>
#include <DallasTemperature.h>
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define ONE_WIRE_BUS 2
#define CE_PIN 9
#define CSN_PIN 10
#define ONE_WIRE_BUS 2
RF24 radio(CE_PIN, CSN_PIN);
//RF24Network network(radio);
const uint16_t this_node = 1;
const uint16_t other_node = 0;
const unsigned long interval = 2000; //ms
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup(void)
{
(9600);
();
(127);
(“Dallas Temperature IC Control Library Demo”);
// (80, this_node);
(pipes[1]);
(1, pipes[0]);
();
}
void loop(void)
{
(” Requesting temperatures…”);
(); // Send the command to get temperatures
(“DONE”);
float currentTemp = (0);
//RF24NetworkHeader header(other_node);
//bool ok = (header, ¤tTemp, sizeof(currentTemp));
();
( ¤tTemp, sizeof(currentTemp) );
(“Temperature for Device 1 is: “);
(currentTemp);
}
RX part
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define CE_PIN 9
#define CSN_PIN 10
RF24 radio(CE_PIN, CSN_PIN);
//RF24Network network(radio);
const uint16_t this_node = 1;
const uint16_t other_node = 0;
const unsigned long interval = 2000; //ms
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
void setup(void)
{
(9600);
delay(1000);
();
(127);
(“Nrf24L01 Receiver “);
//(80, this_node);
(pipes[0]);
(1, pipes[1]);
();;
}
void loop(void)
{
float currentTemp;
if ( () )
{
{
bool done = false;
while (!done)
{
//RF24NetworkHeader header;
//bool ok = (header, ¤tTemp, sizeof(currentTemp));
done = ( ¤tTemp, sizeof(currentTemp) );
(“Temperature for Device 1 is: “);
(currentTemp);
}
}
}
else
(“radio not found”);
}
Transmitter is working perfectly but I’m not receiving any data at the receiver. The following websites were used to connect the circuit
skills of Var R.
skill ? | level ? | projects ? | ||
---|---|---|---|---|
Arduino |
35%
|
5 | ||
Electrical Engineering |
35%
|
3 | ||
Electronic Forms |
35%
|
1 | ||
C# Programming |
34%
|
1 | ||
Electronics |
34%
|
1 | ||
Microcontroller |
34%
|
1 | ||
PHP |
34%
|
1 | ||
Software Architecture |
34%
|
1 | ||
Software Development |
34%
|
1 |
Some Var R. projects
Project Title | Skills required in the project |
---|---|
Arduino, DS18B20 and NRF24l01 | Arduino C# Programming |
Wordclock controller v3.0 — 2 | Arduino Electrical Engineering Electronic Forms Electronics Microcontroller |
Write some Arduino Software | Arduino PHP Software Architecture |
Need help with a project | Arduino Electrical Engineering |