[SOLVED]Arduino <-> Pi using RF24 Modules

Good afternoon guys, first time poster here :blush:

So I'm going to jump straight into where I started in terms of meeting problems. I have configured the Arduino Nano and RPI with a RF24 module each and used the getting started example from maniacbug's github (GitHub - nRF24/RF24: OSI Layer 2 driver for nRF24L01 on Arduino & Raspberry Pi/Linux Devices).

I have them both with the config as shown below:

Raspberry Pi -

pi@raspberrypi ~/rf24libs/RF24/examples_RPi $ sudo ./gettingstarted
RF24/examples/GettingStarted/
================ SPI Configuration ================
CSN Pin          = CE0 (PI Hardware Driven)
CE Pin           = Custom GPIO22
Clock Speed      = 8 Mhz
================ NRF Configuration ================
STATUS           = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0x65646f4e32 0x65646f4e31
RX_ADDR_P2-5     = 0x33 0xce 0x3e 0xe3
TX_ADDR          = 0x65646f4e32
RX_PW_P0-6       = 0x20 0x20 0x20 0x20 0x20 0x20
EN_AA            = 0x3e
EN_RXADDR        = 0x3e
RF_CH            = 0x4c
RF_SETUP         = 0x07
CONFIG           = 0x0e
DYNPD/FEATURE    = 0x00 0x00
Data Rate        = 1MBPS
Model            = nRF24L01+
CRC Length       = 16 bits
PA Power         = PA_MAX

 ************ Role Setup ***********
Choose a role: Enter 0 for pong_back, 1 for ping_out (CTRL+C to exit)
>0
Role: Pong Back, awaiting transmission

Arduino -

RF24/examples/GettingStarted/

*** PRESS 'T' to begin transmitting to the other node

STATUS		 = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1	= 0x65646f4e32 0x65646f4e31
RX_ADDR_P2-5	= 0xc3 0xc4 0xc5 0xc6
TX_ADDR		 = 0x65646f4e32
RX_PW_P0-6	= 0x20 0x20 0x00 0x00 0x00 0x00
EN_AA		 = 0x3f
EN_RXADDR	= 0x03
RF_CH		 = 0x4c
RF_SETUP	= 0x07
CONFIG		 = 0x0f
DYNPD/FEATURE	= 0x00 0x00
Data Rate	 = 1MBPS
Model		 = nRF24L01+
CRC Length	 = 16 bits
PA Power	 = PA_MAX

I then return back to the Raspberry pi to find that there are very few packets being received in relation to those being sent out, with both systems showing the following results over around 3 minutes of testing:

Raspberry Pi -

 ************ Role Setup ***********
Choose a role: Enter 0 for pong_back, 1 for ping_out (CTRL+C to exit)
>0
Role: Pong Back, awaiting transmission

Got payload(4) 26384992...
Got payload(4) 39111664...
Got payload(4) 48020348...
Got payload(4) 74702184...
Got payload(4) 81065536...
Got payload(4) 115378964...
Got payload(4) 122988696...
Got payload(4) 140802128...
Got payload(4) 143298848...
Got payload(4) 144567592...
Got payload(4) 170020936...
Got payload(4) 178903316...
Got payload(4) 191626084...
Got payload(4) 201754348...
Got payload(4) 222054984...
Got payload(4) 224565104...
Got payload(4) 235952660...
Got payload(4) 262625624...
Got payload(4) 265113420...
Got payload(4) 275223824...
Got payload(4) 278975384...

Arduino (This continues to just show the same result for the whole 3 minutes-

*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK

Now sending 

failed.

Failed, response timed out.

Now sending 

failed.

Failed, response timed out.

Now sending 

failed.

Failed, response timed out.

Now sending 

failed.

Failed, response timed out.

Now sending 

failed.

Failed, response timed out.

Now sending 

failed.

Failed, response timed out.

Now sending 

failed.

Failed, response timed out.

Now sending 

failed.

Failed, response timed out.

Now sending 

failed.

Failed, response timed out.

Now sending 

failed.

Failed, response timed out.

Now sending 

failed.

Failed, response timed out.

Now sending 

failed.

Failed, response timed out.

So from here I decided to try out the 'Scanner' example in the github I provided at the start to see if the timeouts were caused from interference and got the following from the Arduino:

RF24/examples/scanner/

00000000000000001111111111111111222222222222222233333333333333334444444444444444555555555555555566666666666666667777777777777777

0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef

00011212213224233232100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00022212213213333232100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00022212212113233232100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00022322212113233243200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00023323212113233243200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00023323212112122242200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00023323112132122242300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00023324223122123242300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

00024324223122121132300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Now, from guess work I'm guessing that this printout shows that I'm receiving some interference from channels 0 and 1. But like I said, I'm guessing. If someone could help me out here I would really appreciate it!

Thanks in advance, Sam.

Just to let you guys know, I've now soldered a 100uf capacitor over the VCC and GND pins of the two RF24 modules. Still no luck, however I do believe its a config error on my behalf but I'm struggling to see where about it is in the files I'm using.

Do we still have no suggestions floating around here? :frowning:

I have seen this 'type' of communication between two arduinos.

It was caused by the library, putting the transmitter side in the power off state before and directly after a transmit,
hindering the reception of the acknowledge (a 'feature' of the original library).

After removing the power cycles it worked a lot better.

Whandall:
It was caused by the library, putting the transmitter side in the power off state before and directly after a transmit,
hindering the reception of the acknowledge (a 'feature' of the original library).

After removing the power cycles it worked a lot better.

So you would recommend me editing the library? Sorry if i've gotten the wrong understanding.

Sam.

It seems you are using a fork of the library that already takes care of that problem, sorry.

I was confused by your 'maniacbug's github' text and the link to a fork of that library.

Ahh right okay, well at least you shined some sort of light onto my issue. I'll keep attempting to figure something out. I don't think i have a hardware issue because i've got communication to the RF module itself, just cant et one to talk to the other. I have a weord feeling its something to do with my piping configs.

Thank you though, really appreciate your help!

I can confirm that I have all the config settings correct for both the Arduino and the RPi to talk to their nRF24L01 modules. To confirm this, correct me if i'm wrong, I have changed the pin numbers and ran the Scan file that came inside of the Libraries, they are both picking up my wireless router signals (I move the channel around inside of my router config page and the scanner picks the movement up).

Am I correct in thinking that this means that both of my devices are talking to their modules, and therefor I can concentrate my efforts into finding an error in the communication side now, not whether or not my modules are actually working with their controllers?

The Pi receives (very few) packets, the Arduino fails to detect any acknowledgements.

What happens if you make the Pi side send?

So the modules seem to 'work' on both sides (at least a bit),
but that does not mean that the configuration is correct.

Whandall:
The Pi receives (very few) packets, the Arduino fails to detect any acknowledgements.

The Pi did receive a few packets, however for some reason it doesn't now. When I said i believe the config is correct, I meant that i believe that the config for the device (arduino or RPi) is talking to its own nRF24L01 module properly. Do you feel that i could still be having an issue where that is not properly happening still?

Waggly connections, breadboard connections, sockets and long wires can be an issue,
having modules (too) close together can be problematic, EMV, metallic surfaces, ...

High power versions with antenna seem to need shielding of the PCB.

You are running the standard modules?

I'm running with nRF24L01+ modules, on a breadboard with jumper cables. I'm going to move the connections around now and see what i get.

There are quite a lot of different modules with the NRF24L01+... New(ish) design NRF24L01+ radio boards

I assume you are using the 'standard' (cheapest) PCB-antenna type without PA, right?

I'm using just the standard one, PCB without the antenna.

Whandall:
There are quite a lot of different modules with the NRF24L01+... New(ish) design NRF24L01+ radio boards

I assume you are using the 'standard' (cheapest) PCB-antenna type without PA, right?

This is the version i'm using: http://www.ebay.co.uk/itm/131305487284?_trksid=p2057872.m2749.l2649&var=430602953460&ssPageName=STRK%3AMEBIDX%3AIT

I run some very very similar, if not identical modules here.

They needed a cap (2,2µF +) directly on the module (connector pins) to work,
without caps they showed a similar behaviour as you are seeing,
from time to time a packet gets through...

In connection with the older library I started with,
I had a hard time making the modules work.

Did you swap/exchange the modules?

Are your caps new or (like mine) from the junk box?

My caps are brand new. However i'm pleased to say that i have the two devices talking to each other now! I'm streaming my system build live each and every time I work on developing it further. When i go live next i will drop the link in here and we can have a chat on there or even skype at some point regarding how I'm currently doing with the project, maybe we can share some information between us to help each other.

samuel235:
However i'm pleased to say that i have the two devices talking to each other now!

Wiggling the connections did the trick?

Enlighten me please.

It did indeed, and i thank you for advising me to attempt that fix again.

Solder them to a PCB (with Nano or Pro Mini) or some prototype shield for other Arduinos,
if you want to experiment with different types use a socket. :wink: