13 responses to “Sending structs with nRF24L01 modules and the RF24 library”

  1. Robo


    What if you would like to send the analog values from potentiometer to another arduino? Do you have to do it using float? I’m struggling to send the values and provide it to the servo.


  2. Vaclav

    thanks for the idea. I’m trying to make this work between Arduino and Raspberry Pi (with RF24 ported). The data send from Arduino to Raspberry gets through ok, but vice versa I have some issues with the struct contruct. It seems like some of the struct data gets mixed up.

    Anyway, I came back to this post to see if I didn’t miss anything important. Rereading the source, I don’t understand, why you created two structs – the A_t and the B_t. Wouldn’t just one type be enough? Then of course make two variables duino1 and duino2, but both of the same one type?

  3. pater

    @Vaclav, remember that representation of some variable types like float can be represented differently in memory on arduino and raspberry pi so it’s better to send them like integers (multiple by 100 for example)

  4. Mauro

    Many thank’s for the example… after many days of research and test with different sketch found on other page without results I found yours…..

    Now I’m able to send wireless from one arduino to the other data like temperature, pressure, UV etc.


    1. ddea


      I’m also working on getting my RPi Setup to recieve data structs, sending them from my arduino setup is easy thanks to this blog.

      Can anyone help with getting the RPi code working using https://github.com/stanleyseow/RF24 Fork?



  5. sevkisahin

    Hi, i have a question about nrf24l01. So, i want to sending measured gas ratio,temp.,humidity,day,month,..,clock information. And i tried some library but i didn’t get result yet. How to edit your code for my request ? Can you help me for this ?
    Thanks. Success in your works.
    Greetings from Turkey.


    thank you sooooooo much.

  7. Yngve

    i have been using structs and send data between arduinos.
    But are struggling a bit related to sending 2 different structs from one Ardu to another.
    I have never got any think through yet, during my attempts with sending 2 different structs.
    Presumably it can be done with sending this struct by pipeA and that struct by pipeB and receiving mode by PipeC. The other Ardu will have RX pipeA and RX pipeB and TX pipeC.

    This below i have not tried, but it must be possible as well.
    Or actually just using one struct, with float and ints and bytes and so on, and having one byte for packet allocation. so when the RX are getting the message it check the allocation byte and than copy the package to a specific data map, and if its different allocation number it copies to another data map. So than Dates, temperature, and whatever you are sending will be copied to the correct variables.

  8. NRF24L01 Networking Completed | Paladin Enabling Technologies

    […] sending a payload containing a structure of data (A guide on how to implement this can be found here). In this structure I have the “transmission pathway” which is the relay node addresses […]

  9. Paavo

    Problem with power down.
    If VCC of radio or goes down and rises back again the program loop can’t find radio again. Same problem is when distance of devices grows too long.
    How to reset Arduinos in those cases or how to get radio contact again?

  10. DevDuino Sensor Node – Part 1 – Programming the DevDuino – Squix TechBlog

    […] How to send dataobjects over the air and this […]

Leave a Reply