37 responses to “RF24 library revisited”

  1. Jason

    Hi, I’ve gone down a similar route to you – I could get the NRFs working with Mirf and ManiacBugs RF24 library, but I didn’t understand the whole “role” thing, so I shelved a project, but seeing your two sketches makes me think it’s time I dusted off those radios and rewrite my sketches!

    Many thanks for making sense of RF24, this is a great starting point for me!

  2. Renke

    Dude, thank you so much for this example. Now things are starting to make sense.

  3. Rafic

    I am having trouble getting the analog readings on the receiver end.
    I am using UNO for TX, and NANO328 for RX.
    the only change i made in the code was:
    RF24 radio(10,9); on both TX and RX (which from my understanding they represent the CE/CS pins.)

    on the TX end i added:
    Serial.println(joystick[0]); // to verify TX is reading the A0
    Serial.println(joystick[1]); // to verify TX is reading the A1


    on the RX end serial monitor all i am getting is.

    any help is greatly appreciated

    note that i also got the same results with your other example sketch using the Mirf library.

    1. Stanis

      I had the same problem.
      If u use NANO as o TX and UNO as RX it should by work fine (works for me)

  4. Rafic

    Thank you for your response. I also thought the nano might have been the problem. i will rewire it from scratch this week and use both uno for both TX/RX. and see how that works.
    I was wondering if can can possibly post the pin-out for the nrf24L01 module that match this sketch for the RF24 to avoid confusion on my part. I does not have to be a diagram text will do just fine.

    Thank you.

  5. Rafic

    Thank you. very much.

  6. Rafic

    Works Great When i used UNO for both TX/RX, for the record with the NANO and after playing with it for a while i got it to transmit but never had success receiving using the nano even with PaLevel set low on the transceiver.

    So it might be the 3V3 issue like you said but i really find it weird that the module uses more power to receive than to transmit~~~.

  7. Rob

    Can you explain what the line

    const uint64_t pipe = 0xE8E8F0F0E1LL;

    is there for?


    1. cr8ive

      Good stuff here on the Nrf24L01+ .
      From what I have understood about

      “const uint64_t pipe = 0xE8E8F0F0E1LL;”

      Simply put : It tells the 2 radio’s to stay tuned to the same frequency.

  8. Rob

    Great thanks!

  9. Stanis


    I got stupid question: what’s mean this number “2” in this line int joystick[2]; ?

    P.S. sry 4 my english

  10. Stanis


    Do you have any idea how to modify a RX sketch to obtain signal PPM like in RC controller?

    I try to create RC system to controll quadrocopter (if its posible)

  11. stanis

    I don’t wont use a standard RC system (transmitter and receiver).
    i wont create RX and TX on two arduino with nRF24 so that the signal was compatible with PPM.
    I must connect PPM signal to MultiWii board to controll quad.
    on page 3 is instruction how to connect receiver to board.
    I think the PPM is the best solution but i don’t know how to do it.
    It is possibly?

  12. dandrade

    The RF24 library, have mutiples errors!!!!

    1)GettingStarted.cpp:21:18: fatal error: RF24.h no file

  13. Alan69

    “with the NANO and after playing with it for a while i got it to transmit but never had success receiving using the nano ”

    Having 2 nano setups side by side on 2 computers, I have to type something in the Serial Monitor on the receive one before it will receive. It appears after reset, something isn’t set up correctly until you send it a character or two on the serial. Haven’t checked yet if it’s the serial chip on the nano, or code side not working until a char comes in.

  14. Mansoor

    Nice work and thanx for making these modules code so simple.I am trying to send four values instead of two but at the receiver end, i received strange values.I also change the joystick size from 2 to 4 but problem not solved.Will u guide me?
    Can u explain me
    const uint64_t pipe = 0xE8E8F0F0E1LL;
    How u determine this address.
    Waiting for your kind reply.

  15. TERWI

    I spent 2 days working with 2 NRF (the little ones) to get them running on an UNO and MEGA with RF24-Lib.
    Everythings seems fine so far – all tranceivers are correctly recognized …
    … MEGA seems to sent something, but always with errors.
    … UNO received supposal always correct and transmitt back ,but MEGA doesnt receve anything.
    I tried a lot of things (more or less output power, change several channels – might be WLAN ist disurbing)
    … but nothing comes to an satisfying result.

    An hour ago i read about “… put a little capacitor of 100nF between Vcc and GND at the tranceivers board on MEGA’s side.”

    You won’t beleave it: This little thing causes a little (no – a great !) wonder !

    Now Mega works fine with UNO.

  16. Andreas' Blog » Blog Archive » nRF24L01

    […] nRF24L01 2.4GHz Radio/Wireless Transceivers How-To RF24 library revisited […]

  17. critter42

    Thanks for these sketches! the RF24 examples were driving me nuts – I dropped these in, modified to suit what I wanted to do and my project started working like a champ!

  18. Azmyin

    Hello Mr Bajdi
    Thanks a million for these two simple sketches. I too found RF24’s example very very confusing.
    Mr Stanis I too am trying the same idea of building the remote controller system using NRF24L01s. I think it will work just fine and theoretically it should work. I am building the source code from scratch to understand PID and other features. I tried to do the experiment with NRF905s but they didn’t work. Now after reading this blog I think the main culprit was mega’s 3V3 power supply. I will try by adding a 100nf capacitor or by building a separate power supply for nrf24l01. Who know maybe nrf905s will work out just fine

    Once again Mr Bajdi thanks for the help.

  19. Laydinata

    Hi, thx for your sketches. What can I do to control more leds?

    1. Laydinata

      Sorry, I havent seen your project on web page. I have seen your project (led control) on arduino forum.

  20. Debojit Kundu

    I am also trying to interface the nrf module with nano, and i tried everything (including bypass capacitor) but it does not work. I also tried with external 3.3v supply still it does not work.
    i m using rf24 library with 9 as ce and 10 as csn. the modules work fine with uno.
    i m using the getting started example provided by rf24 library. do i need to alter the program to run with nano?

  21. Andres

    when i compile the recieve sketch apprear an error like this:

    a.ino: In function ‘void loop()’:
    a.ino:31:13: error: void value not ignored as it ought to be

    please help me what is my problem

  22. Grigory Makeev

    Just in case anybody else stumbles upon this… You get this error about ‘void value’ because ‘read’ was changed to return nothing (before that it returned success value).

    Just change

    if ( radio.available() )
    // Dump the payloads until we’ve gotten everything
    bool done = false;
    while (!done)
    // Fetch the payload, and see if this was the last one.
    done = radio.read( joystick, sizeof(joystick) );

    to something like

    while ( radio.available() )
    // Dump the payloads until we’ve gotten everything
    // Fetch the payload, and see if this was the last one.
    radio.read( joystick, sizeof(joystick) );

  23. me

    im use a code
    error line done = radio.read( joystick, sizeof(joystick) ); error
    “void value not ignored as it ought to be”

    1. Grigory Makeev

      The answer is right above your question.

Leave a Reply