Radiohead - examples not working

Just installed the RH lib and am trying to run the examples (client/server). Running 2 UNO boards with 2 nRF24L01 (w/vr to 3.3). Standard wiring in all examples (8-CE, 10-CS, 13-SCK, etc)

Client appears to be not getting anything from the Server setup.

Swapped client code to other UNO/radio and moved Server....same results - Client appears to transmit but gets nothing from Server.

Need help trying to figure out what is not working...any help greatly appreciated...

R

How many times, we are told that, then when a wiring diagram and hardware details are produced, we find out, it's really not?

Also, define, "standard" wiring...

Good point. Sorry

8-CE, 10-CS, 13-SCK, 11-MI, 12-MO

Uno R3

nRF24L01 are using 5-3.3v adapter

Vcc & Gnd connected to 5v out on Uno

Both UNO’s wired same

Not enough information.

Try this tutorial. It works for most people.

Not sure what additional info I would need to provide...

latest RadioHead library - using the Examples for client and server

wiring is as noted (same as in this DroneBot youtube video - The nRF24L01 - Wireless Joystick for Arduino Robot Car with nRF24L01+ - YouTube

The suggested tutorial uses a different library (which I also tried and could not get to work either).

Have substituted new nRF24L01 modules, changed UNO's, confirmed the wiring, etc.

It is pretty simple setup - 2 UNO, 2 nRF24 modules (with VR/adapters), sketches are straight from the Examples installed with the RadioHead library.

hmmm... not sure what I am missing here but obviously I am missing something

thanks for all the suggestions/pointers...much appreciated.

See the "How to get the best out of this forum" post for hints.

Post your code, using code tags. You should not expect forum members to go searching for it, and to assume that you did not change anything. Most won't bother with links to videos.

Post a photo of the setup. Did you solder connections, and use antennas? Did you make the common mistake of using a breadboard with split rails?

Vcc & Gnd connected to 5v out on Uno.

That will burn out many of the NRF24 modules. Does yours have a built in 5V to 3.3V regulator? Post a link to the radio module.

with VR/adapters

What are those?

Thanks for the input... new here so just getting my feet wet....

Server Code (from RadioHead Examples)

// rf24_server.pde
// -*- mode: C++ -*-
// Example sketch showing how to create a simple messageing server
// with the RH_RF24 class. RH_RF24 class does not provide for addressing or
// reliability, so you should only use RH_RF24  if you do not need the higher
// level messaging abilities.
// It is designed to work with the other example rf24_client
// Tested on Anarduino Mini http://www.anarduino.com/mini/ with RFM24W and RFM26W

#include <SPI.h>
#include <RH_RF24.h>

// Singleton instance of the radio driver
RH_RF24 rf24;

void setup() 
{
  Serial.begin(9600);
  if (!rf24.init())
    Serial.println("init failed");
  // The default radio config is for 30MHz Xtal, 434MHz base freq 2GFSK 5kbps 10kHz deviation
  // power setting 0x10
  // If you want a different frequency mand or modulation scheme, you must generate a new
  // radio config file as per the RH_RF24 module documentation and recompile
  // You can change a few other things programatically:
  //rf24.setFrequency(435.0); // Only within the same frequency band
  //rf24.setTxPower(0x7f);
}

void loop()
{
  if (rf24.available())
  {
    // Should be a message for us now   
    uint8_t buf[RH_RF24_MAX_MESSAGE_LEN];
    uint8_t len = sizeof(buf);
    if (rf24.recv(buf, &len))
    {
//      RF24::printBuffer("request: ", buf, len);
      Serial.print("got request: ");
      Serial.println((char*)buf);
//      Serial.print("RSSI: ");
//      Serial.println((uint8_t)rf24.lastRssi(), DEC);
      
      // Send a reply
      uint8_t data[] = "And hello back to you";
      rf24.send(data, sizeof(data));
      rf24.waitPacketSent();
      Serial.println("Sent a reply");
    }
    else
    {
      Serial.println("recv failed");
    }
  }
}


Client Code (from RadioHead Examples)

// nrf24_client.pde
// -*- mode: C++ -*-
// Example sketch showing how to create a simple messageing client
// with the RH_NRF24 class. RH_NRF24 class does not provide for addressing or
// reliability, so you should only use RH_NRF24 if you do not need the higher
// level messaging abilities.
// It is designed to work with the other example nrf24_server.
// Tested on Uno with Sparkfun NRF25L01 module
// Tested on Anarduino Mini (http://www.anarduino.com/mini/) with RFM73 module
// Tested on Arduino Mega with Sparkfun WRL-00691 NRF25L01 module

#include <SPI.h>
#include <RH_NRF24.h>

// Singleton instance of the radio driver
RH_NRF24 nrf24;
// RH_NRF24 nrf24(8, 7); // use this to be electrically compatible with Mirf
// RH_NRF24 nrf24(8, 10);// For Leonardo, need explicit SS pin
// RH_NRF24 nrf24(8, 7); // For RFM73 on Anarduino Mini

void setup() 
{
  Serial.begin(9600);
  while (!Serial) 
    ; // wait for serial port to connect. Needed for Leonardo only
  if (!nrf24.init())
    Serial.println("init failed");
  // Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm
  if (!nrf24.setChannel(1))
    Serial.println("setChannel failed");
  if (!nrf24.setRF(RH_NRF24::DataRate2Mbps, RH_NRF24::TransmitPower0dBm))
    Serial.println("setRF failed");    
}


void loop()
{
  Serial.println("Sending to nrf24_server");
  // Send a message to nrf24_server
  uint8_t data[] = "Hello World!";
  nrf24.send(data, sizeof(data));
  
  nrf24.waitPacketSent();
  // Now wait for a reply
  uint8_t buf[RH_NRF24_MAX_MESSAGE_LEN];
  uint8_t len = sizeof(buf);

  if (nrf24.waitAvailableTimeout(500))
  { 
    // Should be a reply message for us now   
    if (nrf24.recv(buf, &len))
    {
      Serial.print("got reply: ");
      Serial.println((char*)buf);
    }
    else
    {
      Serial.println("recv failed");
    }
  }
  else
  {
    Serial.println("No reply, is nrf24_server running?");
  }
  delay(400);
}


Using the voltage regulator/adapter (as displayed in image) to convert 5v to 3.3.

Hello wr-roy

For a long time I have been following the topic with the use of this type of wireless module and the associated software functions.

For wireless projects I recommend the use of the HC12 module.

What are the advantages:

  1. no external functions from a library are needed.
  2. the development of a communication protocol is in your hands
  3. the necessary development steps can be programmed and tested without using the wireless module
  4. the radio module can be easily configured for the project requirements
  5. both transmitter and receiver are contained in one radio module

Have a nice day and enjoy coding in C++.

Found my issue- the standard RadioHead library would not work for some reason but the Sparkfun fork did run all examples perfectly.

Hi Wr-roy

Im having exactly the same issue as you here, trying to use the dronebot video but i cant get the server side going.

It looks like theres something fishy going on with the radiohead library

I googled "sparkfun fork" and google just gave me a confused look, can you elaborate what you mean by this? Where did you go to find your solutions?

Im quite new to electronics

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.