The nRF24L01 - Wireless Joystick for Arduino Robot Car with nRF24L01+
Here is a picture of my setup, as described above.
This is for the reliable datagram demo, with the xmit on the left, with its USB0 serial monitor above the code. On the right is the receiver sketch, with its USB1 serial monitor above it.
So, the "client" side gets some joystick values, tries to send them, and then reports failure of sendtoWait(). On the right, the "server" side starts up OK, far as I can tell, but never receives any transmissions. The "Receiver loop() begin" note appears every 10 minutes, just so I can know it is actually connected.
I should mention that I did get a successful transfer, two datagrams in all these trials. So I'm not sure what to think.
In theory, theory and practice are the same.
In practice, they're different.
I am new at this. tThe tutorials are usually pretty easy. Walking into a fairly complex youtube project was difficult.
Anyone having issues with this project should:
Use the capacitor close to the transmitter. I put 100uF 16v across the 3.3v on the adapter.
The other issue I had was with the jumper wires that came with the elegoo kit.
I recently purchased some of the NRF24L01P + PA + LNA modules with the aim of creating a telemetry solution for a family member with a very long driveway to monitor among other things, mailbox status, vehicle entry etc. As a starting point however, I planned on using this wireless joystick project to familiarise myself with the radio side of things, and result in a fun toy for my grandkids. I was provided with the PCB antenna version in error, but the supplier corrected this and let me keep both versions (rare service).
Anyway, I'm using a Nano clone and with the setup documented in this video and website, I was able to get the "Reliable Datagram Client & Server" configuration done and operating correctly ... but only with the PCB antenna version.
So to summarise ...
1. Client PCB Antenna & Server PCB Antenna
2. Client External Antenna & Server PCB Antenna
Not working :
1. Client PCB Antenna & Server External Antenna
2. Client External Antenna & Server External Antenna
It appears that my Rx is not working in the External Antenna versions, but they're Pin compatible and should work.
I've swapped in spares for each in case I had hardware failures.
I've set the DataRate and TransmitPower lower (using the setRF() function from the RadioHead library) in case I was overloading the Rx but no change
I've powered my breadboards with batteries to make them portable and added some LEDs that are blinked when data is received so that I can "monitor" both ends while I only have one of them connected to the Arduino Serial Monitor to be able to read the messages
I'm stumped - any ideas ???
The only issue I remember having with them (It's been awhile) was it depended on what one you turned on first in order to get them to talk to each other. I think it was server first then client. Hope this helps as it cause me a lot of frustration.
@scott Hi Scott, did you get this resolved? I had this exact problem and solved it.
@frogandtoad In reply to "how did I solve the servo with nrf radio" problem.
I was building a magic trick for a student I was mentoring and needed to have radio communication between 2 Arduinos and one of the Arduinos, a Uno, would use a servo. I had successfully used Reliable Datagram with the Dronebot Joystick Robot Car project. I called the NRF24 radio driver constructor with the default
Next I built my trick with 2 NRF24 radios and a servo. I used the simplest NRF24 code and the standard Servo library. This worked, but I wanted to be sure that the radio communication was working and show that with a "green means go" led. So, I replaced the basic NRF24 code with the reliable data gram.
This created a conflict on pin 9 between the Reliable Datagram Library and the standard Arduino Servo library.
Arduino documentation for Servo says, "On boards other than the Mega, use of the library disables
analogWrite() (PWM) functionality on pins 9 and 10, whether or not there is a Servo on those pins."
This explained why my previously perfectly good servo and radio code broke when I used the reliable data gram. The default radio driver wanted pin 9.
The first thing I tried was to create my own version of reliable datagram. I was moderately successful with this but my own reliable data gram was not truly reliable. I ended up with a lot of complex code that didn't always work.
I went back and tried to figure a way to use the original reliable datagram and give pin 9 to the servo.
Library PWMServo allowed me to use pin 9 to control the servo.
Calling RH_NRF24 radioDriver(CE, CSN); with CE = 8 and CSN = 10 let me use the NRF24 without pin 9. I just made a guess that calling the constructor with these values would assign those pins. I think I looked at the ReliableDataGram header file.
So, after a lot of effort the solution was:
call the Radio Driver with parameters for CE and CSN. Wire the radio appropriately.
Use library PWMServo and connect the servo to pin 9.
Thanks for that, it'll be a good reference for someone else should they encounter the same issue.