Which library to use (rf24 or rf24Network) ?

Hello,
I’ve an arduino + NRF24 connected to my PC to make a “bridge” with my nodeJS application.
On a track, i’ve RC cars that also have an arduino + nrf24. I need to speak with all my cars from my application (and my bridge).

  • Look at the attachments if i’m not clear

Today, i’m using the radiohead library (RadioHead: RH_NRF24 Class Reference), it’s working, but it doesn’t manage acknowledgement. So i’ve develop my own, but it’s not a good solution.

I want to try the http://tmrh20.github.io/RF24/ but i don’t know if i have to use rf24 or rf24Network library ?
Here is what i need :

  • All message are transmitted to the bridge. I have 4 cars for now, but i would like to have more later, if i’ve understand, rf24Network can only speak to 5 direct clients.
  • At the start, the bridge don’t know which cars will be on the track. When i power on the car it send a message to the bridge, but is it possible with rf24 ? (i can send to a “public” channel ?)

My project is here : http://www.pathdriver.org/
Here are my bridge and car sketches : arduino · master · tedour / pathdriver · GitLab

I have a somewhat similar application - controlling model trains. I am using the TMRh20 RF24 library (not the network version) arranged as master and slaves. The master polls each slave in turn. There is a simplified version of my pair of programs here.

...R

You can listen to six different addresses (5 have to share the top 4 byte) at the same time.
There is nothing like a personal address, all addresses are 'public'.

The normal RF24 should work.

If you need acknowledgement, the chips are able to provide it.

Thank you for the code Robin2. But you define the id of each slave :

const uint64_t deviceID = 0xE8E8F0F0E1LL; // Define the ID for this slave

For me, i can't define it because i don't know which slave will be on the track...

I would have one public address open in the receiver and have the cars send to that address.
As long as no other PRX acknowledges that address, this works with any number of nodes.

You don't really need to have individual addresses for the cars, if the information only flows to the receiver.

Thanks Whandall,
Sorry, what is PRX acknowledges ?

The communication is half-duplex, the receiving nodes wait as PRX for packets, the sending nodes have to be/become PTX to send.
The switching of both sides to the other role (and back) for transmitting the acknowledgement is handled by the shockburst protocol.

Any number of nodes can listen to any address. As long as maximal one node acknowledges an address at a time, there are no problems with collisions. If no node acknowledges, a send (expecting an acknowledgement) will reported as failed, regardless of how many nodes copied the message.

Ok, thanks, but i've not read that carefully before :

You don't really need to have individual addresses for the cars, if the information only flows to the receiver.

But, the cars are sending informations to the bridge (position and eeprom datas) and bridge send informations to cars (speed, direction).

So, imagine i've two cars on the track (car number 2 and car number 5) :

  • Car 2 send to Bridge : i'm on RFID 2, Bridge send ack => OK
  • Bridge send to Car 5 : turn right, but Car 2 receive the message and send ack => I don't know if the car 5 have receive the message

Sorry, perhaps i don't understand everything :confused:

You could use something like

  • base station listens to well known address and acknowledges
  • cars listen to an individual address and acknowledge
  • cars pass their individual addresses to base so they can be reached
  • all nodes act as PRX and only switch to PTX if they have to send something
    All messages will be acknowledged. It is even possible to send up to 32 bytes back (embedded in the acknowledge packet),
    but this data is always a little behind (it has to be preloaded) and can only be pipe-specific (not node-specific) (1:N),
    so the base station would present the same data to any node sending to its address.
    Cars could attach personal data for the base, because only the base will talk to them (1:1).

tedour:
For me, i can't define it because i don't know which slave will be on the track...

I guess my system has the same issue. I just poll all of the slaves in sequence and only those that are switched on will respond.

...R

Thank you very much for all your answers !
I don't know what is the system used by mySensors (https://www.mysensors.org/).
But it's time for me to test everything, and to try it !