I have built and coded a low power NRF24L01 transmitter and receiver, for purposes of transmitting the temperature of the transmitter's environment. I have used an Atmega328P chip for the project. The project itself works well, but after some time, around 10 days or so, the transmitter goes silent. During my initial troubleshooting, I have concluded that the system hangs up during NRF transmission, and since it's stuck in the transmission phase, it eats up all the battery and dies. For this, I'm also transmitting battery usage, and I have added watchdog timers in my temperature sensing and transmission phases. This has not solved my problem, and I'm stuck as of now.

Some bits of code: My low power cycle:

 while (1) {
  wdt_reset();  //watchdog timer added for 8S. See the beginning of loop func for timer settings.
  Serial.print("Loop Start ");
    //Blink only at every wakeup
    digitalWrite(redLed, HIGH);
    setTime = millis() + ( 1 );
    while ( millis() <= setTime ) {
    digitalWrite(redLed, LOW);
    //Blink only at every wakeup

    Serial.println("Powerdown begins");
    LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
    Serial.println("Powerdown over");
     wdt_enable(WDTO_4S);     // enable the watchdog
  //Reenabling radio for test purposes

//end of radio edit
         Serial.print("Slept for ");
    if ( sleepCounter >= postPeriod || sleepCounter == -1 || interruptState == true ){       ///|| true ) {
      sleepCounter = 0;
      interruptState = false;




  //Serial.println("DEBUG nRf Test");

//  radio.powerUp(); //power up the nRF24

  digitalWrite(redLed, HIGH);

  Set_nRFTX_Data (1);

  nRF_Send ();

In the Set_nRFTX_Data() function, I'm writing my temperature value to the buffer, as such :

   nRF_BufferTX [23] = b1;             // 24th byte the first byte of a two-byte value for precision (msb)
    nRF_BufferTX [24] = b2;              // 25th byte the second byte of a two-byte value for precision (lsb)

And in the nRF_Send() function, I'm sending it over NRF:

void nRF_Send () {


  bool isDataTransfer;
  radio.write(nRF_BufferTX, 32);

  radio.openReadingPipe(1, address);

If anyone's interested, I may share circuit specifications as well.

  • is setTime unsigned long?
    – Juraj
    Dec 11, 2019 at 10:37
  • @Juraj Yes, I define it as unsigned long setTime = 0;
    – bassumex
    Dec 11, 2019 at 11:31
  • 1
    There is a known common problem with some cheap chinese clones of the nRF24L01+ whereby they get stuck in TX mode waiting for an auto-ACK that never arrives. The only way out of it is to reset the nRF24L01+ board through the power-down/up commands.
    – Majenko
    Dec 11, 2019 at 12:42
  • 1
    @Juraj , no real purpose other than having the code halt for 1 ms.
    – bassumex
    Dec 12, 2019 at 7:25
  • 1
    @Majenko Hi, thanks for the valuable info, but I'm already using radio.powerDown(); in my void loop cycle for low power modes. Wouldn't this turn it on and off every cycle anyway?
    – bassumex
    Dec 12, 2019 at 7:28


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.