[SOLVED] NRF24L01 Freezes When Driving a Mosfet

Hello. I am making an LED driver with Nrf24 network controll.

My schematic :

My Code :

#include <SPI.h>
#include "RF24.h"

RF24 radio(7, 8);
byte address[][6] = {"1ABCD"};
byte data[32];

void setup() {
  pinMode(3, OUTPUT);
  digitalWrite(3, HIGH);
  radio.setRetries(0, 0);
  radio.openReadingPipe(1, address[0]);


void loop() {

  while (radio.available()) {
    byte len = radio.getDynamicPayloadSize();
    radio.read(data, len);
    if (data[0] == 102) {
      if (data[1] == 1) {
        data[0] = 103;
        data[1] = 1;
        data[2] = 75;
        data[3] = 0;
        radio.write(data, 4);

Node connects to my server if I disconnect LEDs from circuit.

If I delete digitalWrite(3, HIGH) again it connects without a problem.

If I replace digitalWrite with analogWrite(3, 100), it works with a little lag, but Im sacrificing LED light.

Li-Po drops from 8.4 volt to 7.5 volt under load when I connect LEDs to circuit.

I measured the LM1117’s output, it was 3.3 Volts both before and after connecting LEDs.

I am using NRF24L01+ PLA/LNA module with aluminum shielding and 0.1uF capacitor soldered.

Each LED is powered through 10R resistor and 8 of them should consume 2,4 A.

3A Step-Down Buck Converter is powering them.

Thanks in advance guys, I’ve been stuck for 11 hours debugging.

Your LEDs really take 350mA? A typical LED uses about 30mA. I'd swap them out and save a ton of current

Given the information you provided I see at least 2 possibilities:

  1. The common (aka ground) from the 5V switcher is wired such that current from the LEDs to the common of the switching regulator is upsetting the "ground" power of the NRF and Nano.

  2. More likely, switching noise from the 5v switcher is causing excessive RF noise and interfering with the NRF.

Suggestion for 1)

Check to see where the common of 5V switcher is connected to the circuit. It should be as close to the battery common as possible.

Note: This may sound a little condescending but there is no such thing as ground. I've found the word "ground" gives folks the impression of some absolute condition. It is not. I believe the term "return" best describes the function of what most call ground. Also used is common.

Also note, wires are really low value resistors. And fast switching times can result in current far above what most folks think. These two together can result in the instantaneous voltage on one physical end of a circuit to be vastly different from the other end. So look at your physical layout.

An common (physical) wiring scheme that often works well is the "star" connection. In your circuit the common of the NRF, Nano and LEDs would come together at the battery negative terminal.

Suggestion for 2)

Add a 10µF and a 0.01µf in parallel as close to the 5V switcher input as possible. Repeat the same for the output.

Good luck

I appreciate your help, thank you! This solved my issue.

I added 10uF + 0.1uF ceramic capacitors to 5V Switching Regulator’s input.
Also added 10uF + 0.1uF ceramic capacitors to NRF24L01’s VCC/GND pins.

Latency dropped from 900ms to 60ms!

Glad it worked for you.

BTW of the two capacitors, the 0.1µf is the most important. The 10µf might be overkill (didn't know you component details) it could be 1µf or even left out. Give it a try if you want.


I tried only 0.1uF, latency dropped to 200. Then I added 10uF and it dropped to 60ms again.
10uF and 0.1uF seems to be the best combination for NRF24l01.

Thank you again!

That's great :slight_smile:

You might try a similar pair on the output of the 5V switcher. Even if it doesn't change the latency it might be a good idea. Sometimes noise and pop up periodically and cause hair loss.