[Solved, moving to standard RF24] Problem with RF24Mesh

Hello, i'm having a lot of troubles with RF24 modules. I'm trying to use RF24 mesh but it seems not to work propely.

Hardware description:
master base welded on a PCB with modules on a removable base
Arduino nano atmega328p 5V, RF24 module nRF24L01+, voltage regulator L78L 3.3V TO-82, getting source directly from arduino 5V
Capacitor ceramic 0.02uF + electrolytic 3300uF

Slave base welded on a PCB with modules on a removable base:
Arduino pro mini 5V atmega328, RF24 module nRF24L01+, voltage regulator L78L 3.3V TO-82, getting source from L78xx 5V TO-220 getting power from a 12V line

Test description:
If i load "RF24 Test.ino" (attached) i see that the communication is OK
When i start to test other debug files (see meshTest.ino)

i have this result on slave

check Start: 1
ID: 0 - 0
ID: 1 - 5
ID: 2 - 37777777776
ID: 3 - 37777777776
ID: 4 - 37777777776
ID: 5 - 37777777776
check Start: 1
ID: 0 - 0
ID: 1 - 5
ID: 2 - 37777777776
ID: 3 - 37777777776
ID: 4 - 37777777776
ID: 5 - 37777777776
check Start: 1
ID: 0 - 0
ID: 1 - 5
ID: 2 - 37777777776
ID: 3 - 37777777776
ID: 4 - 37777777776
ID: 5 - 37777777776
check Start: 1
ID: 0 - 0
ID: 1 - 5
ID: 2 - 37777777776
ID: 3 - 37777777776
ID: 4 - 37777777776
ID: 5 - 37777777776
check Start: 1
ID: 0 - 0
ID: 1 - 5
ID: 2 - 37777777776
ID: 3 - 37777777776
ID: 4 - 37777777776
ID: 5 - 37777777776

and this one on master (randomly)

check Start: 0
Renew Start
Renew Skipped
check Start: 1
ID: 0 - 37777777777
ID: 1 - 5
ID: 2 - 37777777777
ID: 3 - 37777777777
ID: 4 - 37777777777
ID: 5 - 37777777777
check Start: 0
Renew Start
Renew Skipped
check Start: 1
ID: 0 - 37777777777
ID: 1 - 5
ID: 2 - 37777777777
ID: 3 - 37777777777
ID: 4 - 37777777777
ID: 5 - 37777777777
check Start: 0
Renew Start
Renew Skipped
check Start: 1
ID: 0 - 37777777777
ID: 1 - 5
ID: 2 - 37777777777
ID: 3 - 37777777777
ID: 4 - 37777777777
ID: 5 - 37777777777
check Start: 0
Renew Start
Renew Skipped
check Start: 0
Renew Start
Renew Skipped

This seems not logic, if slave is connected why master shows it only randomly?

I need a way to identify from the master if nodes are alive, should i test with write?

In any case i'm having a lot problems with this modules.

PS: if I modify master in this way it's also not working

     for (int i = 0; i <6; i++){
          char toWrite[4] = {3,2,1,2};
          bool res = mesh.write(i, toWrite, 1, 4);
          int add = mesh.getAddress(i);
          Serial.print("ID:  " );
          Serial.print(i );
          Serial.print(" - ");
          Serial.print(add);
          Serial.print(" - ");
          Serial.println(res);
        }

check Start: 0
ID: 0 - -1 - 0
ID: 1 - 5 - 0
ID: 2 - -1 - 0
ID: 3 - -1 - 0
ID: 4 - -1 - 0
ID: 5 - -1 - 0
check Start: 0
ID: 0 - -1 - 0
ID: 1 - 5 - 0
ID: 2 - -1 - 0
ID: 3 - -1 - 0
ID: 4 - -1 - 0
ID: 5 - -1 - 0
check Start: 0
ID: 0 - -1 - 0
ID: 1 - 5 - 0
ID: 2 - -1 - 0
ID: 3 - -1 - 0
ID: 4 - -1 - 0
ID: 5 - -1 - 0

PPS: That's crazy, i found two different documentations here and here

I update the function like

          char toWrite[4] = {3,2,1,2};
          int add = mesh.getAddress(i);
          bool res = add > 0 ? mesh.write(toWrite, 1, 4, i) : false;

and now it seems to work, in any case mesh.checkConnection() is not

meshTest.ino (2.2 KB)

RF24 Test.ino (5.04 KB)

I have no experience with the RF24 Mesh library but I just wonder if you really need it.

What needs to communicate with what? And over what distance?

...R
Simple nRF24L01+ Tutorial

I have to communicate over ~30m open field and i have like 6 bases.

Is there a big difference between antenna orientation?

brazoayeye:
I have to communicate over ~30m open field and i have like 6 bases.

Is there a big difference between antenna orientation?

In an open field you should be able to communicate between a pair or Ardunos over 30m - I have had a pair of the low power modules (with PCB antenna) working at 110m out doors. With the high power modules (with external antenna) that range would be even easier to achieve.

Why would a master-to-several-slaves system not work?

A diagram showing what you want to do and a description of the data flows would be a great help. And simply telling us what the project is.

...R

I have a PC that perform an audio FFT analysis and send results to 6 arduinos over 30+ meters.

I started with mesh because master could be near the first or the last board so a dynamic repeating system could be useful...

I will send 9 bytes of data for each base at 30 Hz so traffic should not exceed 2kbps so i set speed at 250kbps

The problem i'm currently seeing is that many functions (idk if they are related to rf24network or other) blocks the script execution and that's not good for my purpose.

Probably i will use a multicast approach with a custom header to send data from master to slaves and a second multicast channel for data send form slaves to master. To do that i must disable the ack. In the future i will probably insert a repeater also in the slave code

Is there a better approach? Is it easier to get that result using rf24network (or will it slow down the communication too much)?

Thanks

PS: In any case the goal is to make a system with a dynamic configuration since idk the exact place of each station and if there could be a communication problem. I could also set the confiuration from the master node but it's very hard to recompile the software in all slaves for a communication problem...

Let me know if the following description of your requirement is correct - or if I am wrong please correct it

30 times per second ...
Your PC program sends 6 messages of (how many?) bytes each to the master Arduino
The master must interpret each message from the PC to figure out which slave should receive the data
The master sends 9 bytes to each slave
The slave sends (how many?) bytes of data to the master

Just doing some rough calculations if the master was to send separate messages to 6 slaves 30 times per second that would mean sending a message about once every 5 millisecs. That is very close to the capacity of the system.

The network and mesh libraries build on the basic RF24 library and add considerable overhead that will hugely reduce the throughput.

You have not told us what data the slaves need to send to the master.

More importantly you have not explained the project you are trying to implement so I cannot see why the performance is needed or whether some simple alternative might solve the problem.

...R

Sorry not to be explicit enougth, but since idk the harware limit i didn't make a choiche till now.

Each base has 3 rgb led strips connected

Fast communication******
During working the pc send 1 message (18 bytes) to arduino, data comes from a fft audio analysis and post processing and represents 6*3RGB channels, arduino update all clients regarding the new data received and this is what has to be repeated 30-60 Hz.

If the communication is very slow i suppose i will send all data in broadcast (maybe with an incremental counter, so ~20chars @ 30Hz) but this requires a "presetted slave" that uses only needed data.

If the communication can handle more data i can calculate on master node which data is required by every base and send it directly.

*************** Slow communication*********************
The idea is to use the wifi communication also to setup bases. These data are sent only for setup and diagnose purpose and not during standard work. Informations to be sent:

  • Ping to check if base is alive
  • Custom output configuration to check if harware is working propely
  • Other informations regarding packed forwarding, if it's needed

If I choose the "broadcast mode" for hi-speed communication I must add protocols to update slaves regarding which channel they should use; If i use a direct communication it's not needed and also point 2 above is trivial...

I thought to split all data in small packets (6packets9char) because i read that small packets improve stability but if it could be better i could pack them in (2packets27char). In the same way i can choose the programming level (RF24, RF24network, RF24Mesh) knowing the hardware limitation...

Thanks for help

I don't think your Reply #6 has added any clarification beyond telling us that you want to send RGB data and you only need 2-way communication occasionally when you are changing settings for a slave.

You have also added the significant complication that you might want to send 60 messages per second.

The simplest way to send data is to have all the slaves listening on the same address and then the master just sends all the data to all the slaves. That just requires 30 or 60 messages per second which is well within the capacity of an nRF24. However you will have to disable acknowledgements and just trust that the system is reliable.

Suppose there is 18 bytes of colour data then you could actually send a slightly longer message to all the slaves with (say) another byte that can indicate to the slave that it should change its behaviour and switch to configuration mode in which it listens on a different address and activates the autoAck process. When you have finished the configuration you could send a message to a slave to tell it to go back to the standard "listen-for-colour" mode.

...R

I wrote a low level code, without client repeating packing data for all clients in 2*29char packets and now it's running (very small distance) at 110Hz -> 4ms/packet without losses

I also implemented a small ping test to check if it's alive, all hardware test can be performed only changing the master settings.

I'll test in a long distance the system, in any case some packets can be lost without a visual impact

Thanks for help

brazoayeye:
I wrote a low level code, without client repeating packing data for all clients in 2*29char packets and now it's running (very small distance) at 110Hz -> 4ms/packet without losses

Where has the 2 x 29 come from? I thought you said 18 characters earlier?

...R

1 (char for packet type) + 1 (char as incremental number) + 3 (bases / packet) * 9 (char / bases)

In this way with 2 packets of 29 char i can command all 6 bases keeping them "stupid"

My question in Reply #9 was really trying to find out how come you did not mention all that data earlier :slight_smile:

It's hard to give useful advice without all the info.

...R

I thought to split all data in small packets (6packets9char) because i read that small packets improve stability but if it could be better i could pack them in (2packets27char)

Yes, i'm sorry because i didn't explained it better but, as mentioned, I took some decision (also to use Mesh library) without knowing exactly the hardware limitation of that module. When i wrote the first post I didn't know that 5ms for a packet transmission is little for that hardware.