NRF24L01 working intermittently - Page 1
Forum section: electronics / beginners

author: pwnell
author_rank: Regular Contributor
timestamp: December 26, 2024, 07:01:24 pm
content: Hi,I know this is a n00b mistake I have made, please be gentle. I have designed my own PCB for a simple ESP 8266 based temperature sensor. It has an ESP8266 DEV board, ADS1115 ADC board and an NRF24L01 2.4GHz board that plugs in to the PCB I designed - along with an DHT20 and LM35. This design works with an NRF24L01 board I purchased 2 years ago from Amazon. It does NOT work with a similar board I purchased a couple of weeks ago. The boards are very similar, caps are different physical sizes and the chip has a different number, though the same model.The idea is that every 30 seconds I transmit the temperature and humidity to another device that listens using a NRF24L01. The problem is, the radio gets configured properly in my code (no error), but sending results in radio.write() failing (radio is an instance of RF24 in my code). The issue is not code - the issue is my PCB design. Here is the board:If I raise the NRF24L01 board by about 1", it works. If I plug it directly in to the socket, it fails. If I plug it in to the socket and place a thick metal sheet between the NRF24L01 and the PCB, it works mostly. If I connect the NRF24L01 using jumper wires and have it 20cm away from the PCB, it always works.This tells me that either the VCC line I have running underneath the NRF24L01's antenna, or the ground plane I have on the bottom of the 2 layer PCB, is causing the issue with the antenna.Since this works 100% reliable with the NRF24L01 off of the PCB using jumpers, I know it is not related to bypass capacitors.Is it the VCC line, the ground plane or something else that is causing this? How do I fix it?

author: Psi
author_rank: Super Contributor
timestamp: December 26, 2024, 07:53:29 pm
content: Quote from: pwnell on December 26, 2024, 07:01:24 pmWith the NRF24L01 off the PCB the current flowing through the ground/VCC traces is less and switching noise is less, so less filtering is needed, without any bypass caps as soon as you add the module the ground/power quality gets worse and that maybe crashing or glitching things.Currently you have no bypass caps. And adding them is one of the primary rules, "Thou must add decoupling caps on VCC to GND near power pins for any IC/Modules"Add a 1uF or similar between the VCC/GND pins for both NRF module and ADS module. should be able to solder it between the two through hole pins.Another issue I noticed is that you have the temp sensor powered by VIN on the ESP, pretty sure that VIN is a 5V input pin to power the ESP, not output.If your temp sensor is working its probably getting powered from leakage current through diodes, not from an actual power rail.(If VIN is also USB5V output then the temp sensor will only work correctly when USB is connected, but i think it's an input only.)You don't seem to have any I2C pullups on your PCB, do any of your devices/modules that use I2C have their own i2c pullups? They are required for I2C to work correctly.If it still doesn't work, try adding a 100ms startup delay in the ESP code, perhaps the NRF or ADS module is on the verge of not being ready for communication at boot and the ESP is trying to communicate with it a bit too soon and causing intermittent glitches at startup.

author: pwnell
author_rank: Regular Contributor
timestamp: December 26, 2024, 09:48:25 pm
content: Thank you for the input.The DHL20 has internal pullup resistors as per the component's datasheet:QuoteThe ADS1115 also seems to have pullups on SCL and SDA. They both function well.Why do you say current is less when the NRF is off the PCB? Due to increased wire resistance? Or reduced coupling to the ground plane?QuoteI am very familiar with that dictum. That said I did not follow it here (my bad, but I thought the two bypass caps on the board was sufficient) - when I did add a bypass cap during testing it did not seem to make a difference, though I tried a 10µF cap and not 1µF. I added a 1µF tantalum capacitor directly to the pins 1 and 2 of the NRF module and it works now. That said, it is not 100% reliable, but works mostly.Here are the two bypass caps that are standard on the board:I measured them combined in parallel as 560nF, though I measured in circuit... They are connected between VCC and GND.The LM35 draws very little current and I am powering the device using USB. I believe the protection diode between USB+ and VIn has enough current carrying capability to support this one device that draws about 50µA according to its datasheet.Thanks again.

author: Psi
author_rank: Super Contributor
timestamp: December 26, 2024, 10:40:23 pm
content: Quote from: pwnell on December 26, 2024, 09:48:25 pmBecause the NRF draws additional current on your PCB when connected and makes any powersupply issues worse.So that maybe why it works "100% reliable with the NRF24L01 off of the PCB"

author: pwnell
author_rank: Regular Contributor
timestamp: December 26, 2024, 10:43:40 pm
content: Maybe I did not explain myself well enough when I said "off of PCB". I meant: I used 2" jumper wires from the PIN header on the PCB to the NRF and then it works reliably. So exactly the same electrical connections and power supply. Just moved physically further from the PCB.

author: Psi
author_rank: Super Contributor
timestamp: December 26, 2024, 10:45:54 pm
content: ah, i thought it was on pin headers and unpluggable.

author: Psi
author_rank: Super Contributor
timestamp: December 26, 2024, 10:46:29 pm
content: Another thing you should check is that you're not having issues due to using 'special' GPIO.The ESP8266 has some IO pins that behave in odd ways due to being 'special' Like you cannot hold them in some starts at power up. Or they don't have pullups etc..https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/D3 and D4 look to stop it booting if held low at startup.and D0 is high at startup

author: xvr
author_rank: Frequent Contributor
timestamp: December 27, 2024, 12:54:36 pm
content: Did you use ESP WiFi ? If yes, it can interfere with NRF

author: pwnell
author_rank: Regular Contributor
timestamp: December 27, 2024, 04:07:34 pm
content: I do but wifi and NRF are never on at the same time.