nrf24l01 speed question

I’m wondering exactly how I would go about speeding up the data transmission on these modules.I’m using the example on the TMHR20 code of transmitting joystick data from one arduino to another but theres a severe delay.I’ve been reading all the information I can but I don’t understand all of it so I thought I’d see if anyone may know.I have it set to 250kbps on max power.Is there a certain part of code that determines the speed besides the kbps? I suppose the main question would be is if I move my joystick should my servo on the other end move with my movements or are these modules not fast enough for that.I’m building a controller for my robot that has 4 joysticks and switches so I’m trying to figure out how to speed things up.Thanks

workingTX.ino (6.05 KB)

workingRX.ino (7.87 KB)

Is there a certain part of code that determines the speed besides the kbps?

Probably. See this post.

How much of a delay?

I reckon 250kbps is plenty fast enough to get an immediate response from joysticks.

Post your code.
And please use the code button </>so your code looks like thisand is easy to copy to a text editor


Sorry forgot the attachments. It delays about 3 or 4 seconds and sometimes just doesnt do anything.I’m using an APM 2.6 autopilot which this reciever is plugged into for steering and esc control and the switches are for the mode switches.This controller ,if I get it working will also control an arm and lights and cameras. So to cap, 1 2560 for TX a 2nd for RX and an APM 2.6 for esc and steering, so the RX only needs to output PWM for esc and steering and diffrent PWM on the same pin for the modes.

this is what I'm trying to do.Basically building a rover with autonomous and additional functions

You don't need while (radio.available()). If there is data available it will all be available. It is not like Serial.available()

I don't immediately see where in your code you are measuring the latency that is causing a problem.

If this was my problem I would take everything out of the program except the bare minimum needed to test Tx and Rx.

I don't see any value in sending back the recieved data. The error checking in the nRF24 is such that if it is received it will be correct.

I use the ackPayload facility to send back data. It works nicely (and quickly) without any need for your code to switch between sending and receiving. It is used in The pair of programs in this link

I recommend using the TMRh20 version of the RF24 library - it solves some problems from the ManiacBug version


im using the example from the TMrh20 sending joystick data thats on the wiki page for the nrf24l01 , i just moddified it by adding 3 more joysticks and 4 more switches. If i only hook up one joystick this works so maybe the data struct is too much or do I not need to use two pipes? I see other code that only uses one pipe thought id try that. So if you think the code is ok then maybe somewhere Ive got something wired wrong or missing. Ill double check everything again.Thanx for the help

If you are communicating 1 to 1 you only need one pipe. Multiple pipes are for when you want one receiver to get messages from several devices nearly at the same time. Look at my example code which works 1 to 1.

Never make an example more complicated until you get it working! The joystick example is already too complicated IMHO.


Thanks alot,Im very new to coding and these radios and I couldnt find that answer in any text I read so thanks again going to go do this

OK I took your advice and severely downsized my code.Now it’s working much better ,now the only problem I have is it’s not a continual transmission.Meaning ,in order to go forward i have to keep moving the joystick up and down so it keeps telling it to go forward(hope this is making sense).It wont keep moving if I hold the joystick forward.I’ve tried adding more SoftwareServo::Refresh in diffrent places but no luck. Any idea what and where something needs inserted to continually update the code? It thought being in the main loop it would constantly update the positions but nope.It’s coming together so thank you for the assistance.
Heres my updated code(it’s much smaller)attached

workingRX.ino (5.62 KB)

workingTX.ino (2.82 KB)

You still have while (radio.available())

Maybe try the ServoTimer2 library rather than SoftwareServo

I would be surprised if SoftwareServo can do all that you require.

I can't see anything that would prevent you from using the regular servo library?


Robin2 I thank you much. I am up and running,very well I might add.I switched to the regular Servo.h library and it made all the difference.The original code said it wouldn't work that's why I didn't use it but since I cut all that out I'm good to go. Now interfacing to my APM is another issue I've gotta figure out but as far as having a functioning R/C TX and RX that can reach a good mile,I'm all good so again I say thank you for your time.

You are very welcome. Good to hear it is working.