Help with nRF24Network...


I’m using the maniacbug RF24network library and his Sensornet example. It works fine for the base and 1 node but when I bring on a second node, the second node doesn’t talk to the base. I know that all three radios are working and wired right because I swapped 1 and 2 and the 2 node still does not talk but 1 does… I tried to set the second node to every available set_up address 2-9 and had no luck. I can’t see the problem, can anyone help me? The serial output looks like:

VERSION: Unknown
setup_address node=05 mask=07 parent=00 pipe=05
23: NET Pipe 5 on node 05 has address f0f0f0a5c3
32: NET Pipe 4 on node 05 has address f0f0f0a5a5
40: NET Pipe 3 on node 05 has address f0f0f0a596
49: NET Pipe 2 on node 05 has address f0f0f0a569
58: NET Pipe 1 on node 05 has address f0f0f0a55a
66: NET Pipe 0 on node 05 has address f0f0f0a53c
STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1	=  0xf0f0f0a53c 0xf0f0f0a55a

165: APP Sending 5cee/481c to 0...
172: NET Sending id 0001 from 05 to 00 type S
180: NET message 5cee
184: MAC Sending to 00 via 00 on pipe 5
191: NET Pipe 5 on node 00 has address f0f0f0f0c3
338: MAC Sent on f0f0f0c3 failed
345: APP Send failedú

Nothing gets picked up on the base serial output…

Heres the code…

Copyright (C) 2011 James Coliz, Jr. <>

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.

* Example of a sensor network
* This sketch demonstrates how to use the RF24Network library to
* manage a set of low-power sensor nodes which mostly sleep but
* awake regularly to send readings to the base.
* The example uses TWO sensors, a 'temperature' sensor and a 'voltage'
* sensor.
* To see the underlying frames being relayed, compile RF24Network with
* #define SERIAL_DEBUG.
* The logical node address of each node is set in EEPROM. The nodeconfig
* module handles this by listening for a digit (0-9) on the serial port,
* and writing that number to EEPROM.

#include <avr/pgmspace.h>
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>
#include "nodeconfig.h"
#include "sleep.h"
#include "printf.h"

// Avoid spurious warnings
#undef PROGMEM
#define PROGMEM __attribute__(( section("") ))
#undef PSTR
#define PSTR(s) (__extension__({static prog_char __c[] PROGMEM = (s); &__c[0];}))

// This is for git version tracking. Safe to ignore
#ifdef VERSION_H
#include "version.h"
const char program_version[] = "Unknown";

RF24 radio(8,9);
RF24Network network(radio);

// Our node address
uint16_t this_node;

// The message that we send is just an unsigned int, containing a sensor reading.
struct message_t
  uint16_t temp_reading;
  uint16_t voltage_reading;
  message_t(void): temp_reading(0), voltage_reading(0) {}

// The pin our sensor is on
const int temp_sensor_pin = A2;
const int voltage_sensor_pin = A3;

// How many measurements to take. 64*1024 = 65536, so 64 is the max we can fit in a uint16_t.
const int num_measurements = 64;

// Sleep constants. In this example, the watchdog timer wakes up
// every 1s, and every 4th wakeup we power up the radio and send
// a reading. In real use, these numbers which be much higher.
// Try wdt_8s and 7 cycles for one reading per minute.> 1
const wdt_prescalar_e wdt_prescalar = wdt_1s;
const int sleep_cycles_per_transmission = 4;

void setup(void)
  // Print preamble
  printf_P(PSTR("VERSION: %s\n\r"),program_version);
  // Pull node address out of eeprom

  // Which node are we?
  this_node = nodeconfig_read();

  // Prepare sleep parameters

  // Only the leaves sleep.
  if ( this_node > 0 )

  // Bring up the RF network

  network.begin(/*channel*/ 92, /*node address*/ this_node);

void loop(void)
  // Pump the network regularly

  // If we are the base, is there anything ready for us?
  while ( network.available() )
    // If so, grab it and print it out
    RF24NetworkHeader header;
    message_t message;,&message,sizeof(message));
    printf_P(PSTR("%lu: APP Received %x/%x from %u\n\r"),millis(),message.temp_reading,message.voltage_reading,header.from_node);

  // If we are not the base, send sensor readings to the base
  if ( this_node > 0 )
    int i;
    message_t message;
    // Take the temp reading
    i = num_measurements;
      message.temp_reading += analogRead(temp_sensor_pin);
    // Take the voltage reading
    i = num_measurements;
      message.voltage_reading += analogRead(voltage_sensor_pin);

    printf_P(PSTR("%lu: APP Sending %x/%x to %u...\n\r"),millis(),message.temp_reading,message.voltage_reading,0);
    // Send it to the base
    RF24NetworkHeader header(/*to node*/ 0, /*type*/ 'S');
    bool ok = network.write(header,&message,sizeof(message));
    if (ok)
      printf_P(PSTR("%lu: APP Send ok\n\r"),millis());
      printf_P(PSTR("%lu: APP Send failed\n\r"),millis());
    // Power down the radio. Note that the radio will get powered back up
    // on the next write() call.

    // Be sure to flush the serial first before sleeping, so everything
    // gets printed properly
    // Sleep the MCU. The watchdog timer will awaken in a short while, and
    // continue execution here.

  // Listen for a new node address
// vim:ai:cin:sts=2 sw=2 ft=cpp

Are you using a very recent copy of the underlying RF24 driver? A bug fix recently came in that would explain this behaviour.

I'll update everything today and check it out. Is there a specific date to look for?


edit Are you saying that the recent version's fix is causing the error... So I have to roll back the driver.

The base nRF24 library is from Jan 17th (or when I downloaded it)

The nRFnetwork is dated Jan 22 which I think are the latest ones. ( I downloaded them on march 5th)

That’s the problem then. 2c97186329 went in on Feb 26, and fixes a problem that can totally be expected to cause the problem you’ve hit.

Perfect. I will give this a try later tonight.

You have been more than helpful!


I am getting confused and am having a difficult time with sending data from a DHT22 temp and humid sensor... The sending node looks good...

328548: APP Sending 18/2d to 0...
328554: NET Sending id 0206 from 02 to 00 type S
328563: NET message 0600
328567: MAC Sending to 00 via 00 on pipe 2
328574: NET Pipe 2 on node 00 has address f0f0f0f069
328585: MAC Sent on f0f0f069 ok
328591: APP Send ok

Where 18/2d = 24 degrees C / 45% RH, which is correct.

Receiving unit...

3537: MAC Received on 2 id 0232 from 02 to 00 type S
3547: NET message 0600
3551: NET Enqueue @0 ok
3555: NET Received id 0232 from 02 to 00 type S
3563: APP Received 600/b00 from 2

600/b00 is no good... :frowning:

Also, where are message.temp_reading and message.voltage_reading written as hex and how can I change this?

I got it working

Hi all!
Sorry for this "necropost"...
Can you help me and explain how to configure basenode (00) in SensorNet example of RF24Network lib?
There is a code

printf_P(PSTR("\n\rERROR: This sketch cannot run on node 00\r\n"));

in the nodeconfig.cpp file.
Do I need to write individual sketch for the basenode?


I also would like to know how to set up the basenode.


I've changed nodeconfig.cpp file to allow configure 00 address. And it works fine, but you need to be accurate (I think duplicate of 00 node will be bad).
This is code from my nodeconfig.cpp:

if (c == 'n') // new address config
	if ( address > 0 )
	  // It is our address
	  eeprom_info.address = address;

	  // And we are done right now (no easy way to soft reset)
	  printf_P(PSTR("\n\rManually set to address 0%o\n\rPress RESET to continue!"),address);
	else // 00 address!
	  printf_P(PSTR("\n\rWARN: Are you sure you want to make this node act as a BASE NODE? y/n \r\n"));
	  char answ;
	  while ((answ = == -1)
	  if (answ == 'y')
	    // It is our address
	    eeprom_info.address = address;
            // And we are done right now (no easy way to soft reset)
	    printf_P(PSTR("\n\rManually set to address 0%o\n\rPress RESET to continue!"),address);
      } // new address config