nRF24 / CircuitPython_nRF24L01

CircuitPython driver library for the nRF24L01 transceiver.
http://circuitpython-nrf24l01.rtfd.io/
MIT License
45 stars 11 forks source link

nrf.send( ) sending successfully but return failed or time out #19

Closed akeelwall closed 3 years ago

akeelwall commented 3 years ago

Awesome library, I am using it with RPi 4 and RPi zero and all fine. however, when i was testing with the master mode ( sending ) in simple test script I always get send() failed or timed out dispite the fact that the sending is successful. Any Idea why this is happening? many thanks Adam

2bndy5 commented 3 years ago

Usually this symptom means that the slave() node is not able to send ACK responses back to the master() node. Usually this is because of a power problem; make sure that you have a parallel capacitor of 100 microfarads between (& as close as possible to) the nRF24L01's VCC and GND pins.

what type of nRF24L01 modules are you using (store link please)?

I ask because recent testing for the nRF24L01+PA+LNA modules don't work as master() nodes (nor send ACK responses as slave() nodes). The nRF24L01+PA+LNA also require electromagnetic shielding (which is not added by manufacturers). See my test results as noted in the docs. Note that the RPi (any version) doesn't supply enough current on the 3V pin to allow using the nRF24L01+PA+LNA.

akeelwall commented 3 years ago

Thanks for getting back on this. I got the module from amazon, here is a link to the product page https://www.amazon.co.uk/gp/product/B06WD17WLS/ref=ppx_yo_dt_b_asin_title_o01_s00?ie=UTF8&psc=1 I will add capacitor and shield the module and see how it goes. Many thanks

2bndy5 commented 3 years ago

@adamedan thanks for the store link. Those modules will most definitely require a separate power source. The RPi's 5V and 3V pins do not provide enough current for TX operations with that specific module (I spent a lot of time trying to make those work before releasing v1.2.0 of this library). You need to wire up a 3V regulator with a current limit of more than 500 mA to a separate power source. It is IMPORTANT that you remember to tie the RPis GND pin with the 3V regulators GND pin.

If you feel that wiring a 3V regulator is beyond your skill level, you can use a specially designed breakout board for the nRF24L01+PA+LNA modules. Those breakout boards use a AMS1117 3V regulator. I recently purchased a pack from amazon, but they haven't come in yet (I'm not a prime member and I opted for the cheapest shipping 😄 ). Be careful to not purchase a breakout board designed for the ESP8266-01 modules as it doesn't look like they have a 3V regulator soldiered in (and the pinout concerning VCC & GND pins is incompatible with the nRF24L01 anyway).

Shielding is also required even with a 3V regulator.

You're the first person to raise this common issue on this library. Would you find it more helpful if I added a note to the repo's README? I just want this info to be known before other people raise the same issue.

2bndy5 commented 3 years ago

@adamedan Did you run master() on the RPi4 or the RPi0? I find it a little surprising that the payloads from the master() node were transmitted at all. Maybe the RPi4 has more current on the 3V pin than my RPi2's 3V pins?!

akeelwall commented 3 years ago

Hi @2bndy5 sorry for the late reply, I was waiting for the adapters as suggested. So ok I added the adapters to both master and salve and all working fine without shielding. I am planning to make RPi communicate with Arduino, finger-cross it works on Arduino as I used radio head library and I couldn't get it to compile with my UNO WIFI so will use TMRh20 and see what happens.

Many thanks

2bndy5 commented 3 years ago

so will use TMRh20 and see what happens

Yes! I often recommend TMRh20's library as an alternative to this CircuitPython library. I've also recently started helping that library. HINT: I've written an example script that demonstrates how to use this library with the TMRh20 library, but the v1.2.3 updates to that example have more explanations (about different library behaviors) in the comments.

So ok I added the adapters to both master and salve and all working fine without shielding

I still highly recommend to add shielding (it would only improve performance). I used electrical tape with foil wrapped around the electrical tape. Be sure that the foil does not touch any current carrying parts (like the GPIO pins and the soldier joints for the antenna and the antenna connector). image image

akeelwall commented 3 years ago

Hi @2bndy5. amazing many thanks very clear shielding instruction. what I was saying in my last comment is that I will use TMRh20 only on Arduino, on RPi I will continue using this python library as all my code on RPi is python also I like what you did, Awesome work many thanks.

2bndy5 commented 3 years ago

@adamedan can I close this? Did you have any further questions? I have pinned this issue so it can still attract attention (even if it is closed).