NRF24L01 WITH ANTENNA DEVICE IS NOT WORKING

Hello

I am using NRF24L01 to transfer data between two arduino.

Transmitter side i am using NRF24L01 radio without antenna and power supply is 3v

Receiver side i am using NRF24L01 with antenna and power supply is 3.3v.

if i use NRF24L01 with antenna on receiver side communication is not happening. so i tired to use nrf24l01 without antenna on both the side then it is working fine.

if i want to use nrf24l01 with antenna on receiver side do i need to make any changes?

You have not posted your programs or a wiring diagram or details of the power supplies so it is hard to suggest anything.

Have a look at this Simple nRF24L01+ Tutorial.

Wireless problems can be very difficult to debug so get the wireless part working on its own before you start adding any other features.

The examples are as simple as I could make them and they have worked for other Forum members. If you get stuck it will be easier to help with code that I am familiar with. Start by getting the first example to work

If the HIGH POWER module is too close to the other one it can cause problems.

...R

please find attachment for the code.
what wiring diagrams you need?

i have just connected nrf24l01 to arduino

vcc to vcc
gnd to gnd
CE To 7
CSN to 8
MOSI to 11
SCK to 13
MISO to 12

with this i have made sleep mode but still transmitter arduino pro mini device is consuming 1.8mAH. i have removed both led and voltage regulator. i have posted the code please check and help me if there are any corrections.

My previous question was device is communicating if both transmitter and receiver are connected with NRF24L01 without antenna module. if i change receiver to NRF24L01 with antenna it is not working.

proj_transmitter.ino (8.96 KB)

onereceiverfina.ino (5.22 KB)

This question was pretty much answered in your previous thread- a coin cell can't supply enough current to drive the high-power NRF modules.

BJHenry:
This question was pretty much answered in your previous thread- a coin cell can't supply enough current to drive the high-power NRF modules.

I am not using coin battery now.

using LS 14500 3.6v lithium battery.

bmg1234:
Transmitter side i am using NRF24L01 radio without antenna and power supply is 3v

Receiver side i am using NRF24L01 with antenna and power supply is 3.3v.

bmg1234:
using LS 14500 3.6v lithium battery.

?

bmg1234:
i have posted the code please check and help me if there are any corrections.

First of all get your nRF24s working with one of the examples in my Tutorial. If you have a problem it will be much easier to help with code that I am familiar with.

Do you have a third nRF24 that you can try - just in case one of them is faulty?

And please provide a diagram showing ALL the connections. It is much to easy to misunderstand a written description.

...R

Thank you all it is working fine.

But my transmitter device is consuming 1.8mAH. i have made code for sleep mode. but device is consuming more power.

I request someone please help me.

please let me know what changes i should make with the code.

one_transmitter.ino (8.98 KB)

onereceiverfina.ino (5.2 KB)

The first change you should make is to your post- please post the code using code tags, rather than making people download your sketch to look at it.
How much power does it use when you run the exact same sketch and circuit but with the NRF module disconnected?

BJHenry:
How much power does it use when you run the exact same sketch and circuit but with the NRF module disconnected?

Same 1.8mAH after disconnecting nrf24l01

bmg1234:
Same 1.8mAH after disconnecting nrf24l01

Do you mean 1.8 mA or 1.8mAh - there is a big difference between them.

...R

I've never dabbled with the low-power side of things, but since the OP sent me a PM asking for help I thought I'd check in here.
First off, please post your code in the thread using code tags. The guide is step #7 here. Please also provide a link to any low-power library that you are using.

Have you tried using an example sketch from the library with no other hardware connected? How much power was the board using then?

here is my transmitter code

#include <avr/sleep.h>
#include <avr/power.h>
#include <avr/wdt.h>
#include <SPI.h>
#include "RF24.h"

// Changing transmitter num
#define TRANSMITER_NUM    0 // or 1
#define TILT_PIN          3
//#define SERIAL_PRINT

// Radio pipe addresses for the nodes to communicate.  Only ping nodes need
// dedicated pipes in this topology.  Each ping node has a talking pipe
// that it will ping into, and a listening pipe that it will listen for
// the pong.  The pong node listens on all the ping node talking pipes
// and sends the pong back on the sending node's specific listening pipe.
const uint64_t talking_pipes[2] = { 0xF0F0F0F0D4LL, 0xF0F0F0F0C5LL };
const uint64_t listening_pipes[2] = { 0x3A3A3A3AD4LL, 0x3A3A3A3AC5LL };

struct DataPacket {
  int voltage;
  bool tilt;
};

bool volatile interruptTriggered = false;

RF24 radio(7,8);

/***************************************************
 *  Name:        TiltPinInterrupt
 *
 *  Returns:     Nothing.
 *
 *  Parameters:  None.
 *
 *  Description: Service routine for TiltPin interrupt  
 *
 ***************************************************/
void TiltPinInterrupt(void)
{
  /* This will bring us back from sleep. */
  
  /* We detach the interrupt to stop it from 
   * continuously firing while the interrupt pin
   * is low.
   */
  sleep_disable();
  detachInterrupt(digitalPinToInterrupt(TILT_PIN));

  interruptTriggered = true;
}

// Set watchdog to trigger every 8 sec.
void watchdogSetup(void)
{
  wdt_reset();
  /*
  WDTCSR configuration:
  WDIE = 1: Interrupt Enable
  WDE = 1 :Reset Enable
  See table for time-out variations:
  WDP3 = 0 :For 1000ms Time-out
  WDP2 = 1 :For 1000ms Time-out
  WDP1 = 1 :For 1000ms Time-out
  WDP0 = 0 :For 1000ms Time-out
  */
  // Enter Watchdog Configuration mode:
//  WDTCSR |= (1<<WDCE) | (1<<WDE);
  WDTCSR = bit (WDCE) | bit (WDE);
  // Set Watchdog settings:
  //WDTCSR = bit (WDCE) | bit (WDE) | bit (WDIE) | bit (WDP3) | bit (WDP0);    // set WDIE, and 8 seconds delay
  WDTCSR = bit (WDCE) | bit (WDE) | bit (WDIE) | bit (WDP3);    // set WDIE, and 4 seconds delay
  //WDTCSR = bit (WDCE) | bit (WDE) | bit (WDIE) | bit (WDP2) | bit (WDP1) | bit (WDP0);    // set WDIE, and 2 seconds delay
  //WDTCSR = bit (WDCE) | bit (WDE) | bit (WDIE) | bit (WDP2) | bit (WDP1);    // set WDIE, and 1 seconds delay
}

// Disable hardware to consume battery energy
void disableHardware() {
//  radio.sleep();          // Set the radio transceiver in sleep mode
  radio.powerDown();              // NOTE: The radio MUST be powered back up again manually
  power_spi_disable();    // Disable the Serial Peripheral Interface module.
  power_timer0_disable(); // Disable the Timer 0 module..
  power_timer1_disable(); // Disable the Timer 1 module.
  power_timer2_disable(); // Disable the Timer 2 module  
  power_twi_disable();    // Disable the Two Wire Interface module.  
  power_usart0_disable(); // Disable the USART 0 module.
//  ADCSRA &= ~(1 << ADEN); // Ensure AD control register is disable before power disable
  power_adc_disable();    // Disable the Analog to Digital Converter module
}

// Enable hardware
void enableHardware() {
  power_spi_enable();    // Enable the Serial Peripheral Interface module.
  power_timer0_enable(); // Enable the Timer 0 module..
  power_timer1_enable(); // Enable the Timer 1 module.
  power_timer2_enable(); // Enable the Timer 2 module  
  power_twi_enable();    // Enable the Two Wire Interface module.  
#ifdef SERIAL_PRINT
  power_usart0_enable(); // Enable the USART 0 module.
#endif
  power_adc_enable();    // Enable the Analog to Digital Converter module

  radio.powerUp();                                // Power up the radio after sleeping
}

/***************************************************
 *  Name:        enterSleep
 *
 *  Returns:     Nothing.
 *
 *  Parameters:  None.
 *
 *  Description: Enters the arduino into sleep mode.
 *
 ***************************************************/
void enterSleep(void)
{
  sleep_enable();

  //disableHardware();

  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  //set_sleep_mode(SLEEP_MODE_IDLE);

  //cli(); // disables all interrupts on the microcontroller so that configuration is never disrupted and left unfinished
  noInterrupts();

  // clear various "reset" flags
  MCUSR = 0;
  watchdogSetup();
//  sleep_bod_disable();

  attachInterrupt(digitalPinToInterrupt(TILT_PIN), TiltPinInterrupt, CHANGE);

//sei(); // reenable interrupts
  interrupts();

 
  sleep_cpu();
  // wake up here 
  sleep_disable();

  //enableHardware();
}


/***************************************************
 *  Name:        setup
 *
 *  Returns:     Nothing.
 *
 *  Parameters:  None.
 *
 *  Description: Setup for the Arduino.           
 *
 ***************************************************/
void setup()
{
  Serial.begin(9600);

  // Setup the pin direction.
  pinMode(TILT_PIN, INPUT_PULLUP);

  radio.begin();

  // set power level of the radio
  radio.setPALevel(RF24_PA_MAX);
  // set RF datarate
  radio.setDataRate(RF24_250KBPS);
  // set radio channel to use - ensure it matches the target host
  radio.setChannel(0x50);

  // Ensure autoACK is enabled
  //radio.setAutoAck(true);

  // Each node has a talking pipe that it will transmit into, and a listening
  // pipe that it will read for response.
  
  // Write on our talking pipe
  radio.openWritingPipe(talking_pipes[TRANSMITER_NUM]);
  // Listen on our listening pipe
  radio.openReadingPipe(1,listening_pipes[TRANSMITER_NUM]);

  // Start listening
  radio.startListening();

  // Dump the configuration of the rf unit for debugging
//  radio.printDetails();

  //delay(2000);
  getBandgap();
#ifdef SERIAL_PRINT
  Serial.println("Initialisation complete.");
#endif
}

// watchdog interrupt
ISR (WDT_vect) 
{
   wdt_disable();  // disable watchdog
}  // end of WDT_vect

const long InternalReferenceVoltage = 1100;  // Adjust this value to your board's specific internal BG voltage

// Code courtesy of "Coding Badly" and "Retrolefty" from the Arduino forum
// results are Vcc * 100
// So for example, 5V would be 500.
int getBandgap () 
{
  // REFS0 : Selects AVcc external reference
  // MUX3 MUX2 MUX1 : Selects 1.1V (VBG)  
   ADMUX = bit (REFS0) | bit (MUX3) | bit (MUX2) | bit (MUX1);
   ADCSRA |= bit( ADSC );  // start conversion
   while (ADCSRA & bit (ADSC))
     { }  // wait for conversion to complete (toss this measurement)
   ADCSRA |= bit( ADSC );  // start conversion
   while (ADCSRA & bit (ADSC))
     { }  // wait for conversion to complete
   int results = (((InternalReferenceVoltage * 1024) / ADC) + 5) / 10; 
   return results;
} // end of getBandgap

/***************************************************
 *  Name:        loop
 *
 *  Returns:     Nothing.
 *
 *  Parameters:  None.
 *
 *  Description: Main application loop.
 *
 ***************************************************/
int cnt=0;
void loop()
{
  bool sendValue = false;
  DataPacket data;
  
  cnt++;
  if (cnt >= 1) {
    cnt = 0;
    sendValue = true;
  }

  if (interruptTriggered) {
    sendValue = true;
    interruptTriggered = false;
  }

  if (sendValue) {
    cnt = 0;
    data.voltage = getBandgap();
    data.tilt = digitalRead(TILT_PIN);
    //TODO: send data and wait for ACK
    
    int resend = 0;
    do {
      resend++;
      
      radio.stopListening();

      // Take the time, and send it.  This will block until complete
      if (radio.write( &data, sizeof(data) )) {
        // Now, continue listening
        radio.startListening();

        // Wait here until we get a response, or timeout (250ms)
        unsigned long started_waiting_at = millis();
        bool timeout = false;
        while ( ! radio.available() && ! timeout )
          if (millis() - started_waiting_at > 250 )
            timeout = true;
    
        // Describe the results
        if ( timeout )
        {
#ifdef SERIAL_PRINT
          Serial.println("Failed, response timed out.\n\r");
#endif
        }
        else
        {
          // Grab the response, compare, and send to debugging spew
          unsigned long dummy;
          radio.read( &dummy, sizeof(unsigned long) );
    
          // Spew it
#ifdef SERIAL_PRINT
          Serial.println("Got response");
#endif
          resend = 0;
        }
      } else {
#ifdef SERIAL_PRINT
        Serial.println("Error sending values");
#endif
      }
    } while ((resend > 0) && (resend <= 3));
  }
#ifdef SERIAL_PRINT
  Serial.println(data.voltage, DEC);
  Serial.println(data.tilt, DEC);

  delay(100);
#endif
  enterSleep();
}

Robin2:
Do you mean 1.8 mA or 1.8mAh - there is a big difference between them.

...R

i checked using multi meter between the vcc of arduino and positive of power supply.

bmg1234:
here is my transmitter code
(snip)

That's a good step, unfortunately it is too much for me to troubleshoot cold. In this sort of situation you should try a bare minimum sketch- start from blank, just add the low-power code, and see what sort of power use you get. If that is different to the 1.8mA you are getting now then you can gradually add parts of your original code into your bare minimum code and see what exactly makes it use more power.

BJHenry:
That's a good step, unfortunately it is too much for me to troubleshoot cold. In this sort of situation you should try a bare minimum sketch- start from blank, just add the low-power code, and see what sort of power use you get. If that is different to the 1.8mA you are getting now then you can gradually add parts of your original code into your bare minimum code and see what exactly makes it use more power.

Hi

I tried simple low power code. When device was in sleep mode it was consuming 0.04mAH

Ok. So now you can start adding parts from your old code in, and by process of elimination you can work out which part is making it draw more power.

When measuring current with your meter, the units are mA (milliAmperes), not mAH (milliAmpere Hours). They are two distinctly different things with mA being current and mAH being energy.

WattsThat:
When measuring current with your meter, the units are mA (milliAmperes), not mAH (milliAmpere Hours). They are two distinctly different things with mA being current and mAH being energy.

Now if i measure with meter it is showing 0.2mA. Battery capacity is 2600mA. 3.6V lithium battery.

How can i calculate how many days my battery will work?

I bet the battery capacity is 2600 mAh. Then (in theory) the time to deplete it is 2600 / 0.2 = 13,000 hours. I think it would be much safer to assume half of that, which is still about 9 months.

Also, over such a long time you have to take account of losses due to self-discharge of the battery - sorry, I have no idea how much that might be.

...R