Hey guys. 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 transmitter part should power on once every minute, transmit temperature values. The receiver is an Arduino Uno with NRF24l01. Problem is that serial monitor on the transmitter displays the temperature values perfectly. The receiver however shows radio not found. Both the radios work perfectly as i tested them using the example joystick code.
TX part
#include <RF24Network.h>
#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
RF24 radio(9,10);
RF24Network network(radio);
const uint16_t this_node = 1;
const uint16_t other_node = 0;
const unsigned long interval = 2000; //ms
unsigned long last_sent;
unsigned long packets_sent;
const uint64_t pipe = 0xE8E8F0F0E1LL;
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup()
{
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipe);
Serial.println("Dallas Temperature IC Control Library Demo");
network.begin(80, this_node);
sensors.begin();
}
void loop(void)
{
Serial.print(" Requesting temperatures...");
Serial.println("DONE");
float currentTemp;
currentTemp = sensors.getTempCByIndex(0);
Serial.print("Temperature for Device 1 is: ");
// radio.write( ¤tTemp, sizeof(currentTemp) );
RF24NetworkHeader header(/to node/ other_node);
bool ok = network.write(header,¤tTemp,sizeof(currentTemp));
Serial.print(currentTemp);
uint16_t sensorValue = currentTemp;
}
RX part
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <RF24Network.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2
#define CE_PIN 9
#define CSN_PIN 10
RF24 radio(9,10); //NRF24L01 CE to pin9, CSN to pin10 on Uno
RF24Network network(radio);
const uint64_t pipe = 0xE8E8F0F0E1LL;
const uint16_t this_node = 1;
const uint16_t other_node = 0;
void setup()
{
Serial.begin(9600);
//delay(1000);
Serial.println("Nrf24L01 Receiver Starting");
network.begin( 80, this_node);
radio.openReadingPipe(1,pipe);
radio.startListening();
}
void loop()
{
//network.update();
float currentTemp;
if ( network.available() )
{
bool done = false;
while (!done)
{
//if ( radio.available() )
RF24NetworkHeader header;
network.read( header,¤tTemp,sizeof(currentTemp) );
//radio.read( ¤tTemp, sizeof(currentTemp) );
Serial.print("Temperature is ");
Serial.print(currentTemp);
}
}
else
{
Serial.print("radio not available");
}
}
The following websites were used to connect the circuit
http://www.hobbytronics.co.uk/ds18b20-arduino
https://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
Can anyone point out the mistake i'm making and fix it please?