Arduino Forum

Using Arduino => General Electronics => Topic started by: firashelou on Nov 16, 2019, 08:36 pm

Title: Problem with NRF24L01 low current on some pins ! help ! [SOLVED]
Post by: firashelou on Nov 16, 2019, 08:36 pm
Hello everyone,
thanks for taking the time to read my post and try to help.
I am using NRF24L01 with Antenna long range module 1100 meters. So what i am trying to do is send a potentiometer value from one to the other where I am Serial.print on the receiver side. My pot connections are good i sent Serial.print and tested it I received the values on the controller monitor. But I am not receiving the value on receiver side. I am using arduino Nano on the controller side with D13 pin on the left side and arduino Uno for the receiver side. My connections are:

Pins of NRF24L01:
pin1 to GND
pin2 to VCC 3.3V on arduino
pin3 to pin 7 of arduino
pin4 to pin8 of arduino
pin5 to pin13 of arduino
pin6 to pin11 of arduino
pin7 to pin12 of arduino
pin8 to nothing

this setup is on both the receiver and the controller.

I took my multimeter and tested the pins of the module, i got 3.3V on vcc but some of the pins i got 0.33V and other 0.1V on the receiver and controller and on the controller I got 0V on the CE pin of the module. So I need your help to determine what is the problem please.

Edit
RX on the controller side is flashing too fast and I added a picture of my setup

I am using an old sketch which I have used in a robot project and works fine.

here are my sketches:

Controller:
Code: [Select]

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

//1st byte is for throttle value from pot

int msgTX[2]; //Message to be transmitted, can contain up to 2 array elements, 2 bytes
int ackMessage[2]; //Acknowledgment message, means the message that will be received from the receiver or the car, 1 element for the moment

//Defining radio object for the RF24 function
RF24 radio(7, 8); // CE, CSN
//const byte address[6] = "00001";

//Defining the radio variables and values
const uint64_t pipe = 0xE8E8F0F0E1LL; //pipe address
const rf24_datarate_e dataRate = RF24_250KBPS; //Data rate defined in the documentations, RF24_250KBPS, RF24_1MBPS or RF24_2MBPS

//Throttle potentiometers
const byte Throttle = A0;

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.setDataRate(dataRate);
  //radio.openWritingPipe(address);
  radio.enableAckPayload(); //enables receiving data from receiver side
  //radio.setPALevel(RF24_PA_MIN); //Power Amplifier (PA) level to one of four levels RF24_PA_MIN, RF24_PA_LOW, RF24_PA_HIGH and RF24_PA_MAX
  //radio.stopListening();
  
}
void loop() {
  int ThrottleValue = analogRead(Throttle);  // read the value from the sensor
  
  Serial.print("Throttle : ");
  Serial.println(ThrottleValue);
  
  radio.openWritingPipe(pipe);
  msgTX[0] = ThrottleValue;
  //msgTX[1] = SteeringValue;
  radio.write(msgTX, sizeof(msgTX)); //Sends the Data
  AcknowledgmentDATA();
  
}

//DATA Receiving from the Receiver part, Acknowledgment Data
void AcknowledgmentDATA(){
    
    while ( radio.isAckPayloadAvailable() ){
        //Serial.println("Ack Available");
 radio.read(ackMessage, sizeof(ackMessage));
        int value = ackMessage[1];

   }
  
}


And Receiver:

Code: [Select]

#include <SPI.h>
//#include <nRF24L01.h>
#include <RF24.h>

int msgRX[2]; //Message to be transmitted, can contain up to 2 array elements, 2 bytes
int ackMessage[2]; //Acknowledgment message, means the message that will be received from the receiver or the car, 1 element for the moment

RF24 radio(7, 8); // CE, CSN

//const byte address[6] = "00001";

//Defining the radio variables and values
const uint64_t pipe = 0xE8E8F0F0E1LL; //pipe address
const rf24_datarate_e dataRate = RF24_250KBPS; //Data rate defined in the documentations, RF24_250KBPS, RF24_1MBPS or RF24_2MBPS

int Throttle;


void setup() {
  
  Serial.begin(9600);
  radio.begin();
  radio.setDataRate(RF24_250KBPS);
  //radio.openReadingPipe(0, address);
  radio.openReadingPipe(1, pipe);
  //radio.setPALevel(RF24_PA_MAX);//Power Amplifier (PA) level to one of four levels RF24_PA_MIN, RF24_PA_LOW, RF24_PA_HIGH and RF24_PA_MAX
  radio.enableAckPayload();
  radio.startListening();
  
}
void loop() {
  //ackMessage[1] = 200;
  //radio.writeAckPayload(1, ackMessage, sizeof(ackMessage));
 
  if (radio.available()) {
    radio.read(msgRX, sizeof(msgRX));
    Throttle = msgRX[0]; //middle throttle value is 121
    Serial.print("Throttle: ");
    Serial.println(Throttle);
  }
}
Title: Re: Problem with NRF24L01 low current on some pins ! help !
Post by: MarkT on Nov 16, 2019, 08:56 pm
I very much doubt you'll get 1.1km range at 2.4GHz.  Far too much noise on the band from microwave ovens and WiFi.  Think 30m or so is more practical.

To debug what is happening with several logic signals at once really needs a logic analyzer, a multimeter can only show time-averaged voltages and that's not helpful at the timescales involved in sending a packet at 256kbaud or faster.

Start with known good example code for the library in question to test the hardware.
Title: Re: Problem with NRF24L01 low current on some pins ! help !
Post by: firashelou on Nov 16, 2019, 09:19 pm
I very much doubt you'll get 1.1km range at 2.4GHz.  Far too much noise on the band from microwave ovens and WiFi.  Think 30m or so is more practical.

To debug what is happening with several logic signals at once really needs a logic analyzer, a multimeter can only show time-averaged voltages and that's not helpful at the timescales involved in sending a packet at 256kbaud or faster.

Start with known good example code for the library in question to test the hardware.
I see, well for the sketches they work great on the other NRF24L01 without antenna
Title: Re: Problem with NRF24L01 low current on some pins ! help !
Post by: MarkT on Nov 16, 2019, 09:42 pm
Then perhaps its a power issue, or interference from the transmitting antenna?  Can you show a picture of how its all hooked up?
Title: Re: Problem with NRF24L01 low current on some pins ! help !
Post by: firashelou on Nov 16, 2019, 10:15 pm
Then perhaps its a power issue, or interference from the transmitting antenna?  Can you show a picture of how its all hooked up?
MarkT, well before asking me i removed the modules with antenna and placed modules without antenna the low range ones, so at first when i connected them a signal showed on the monitor but stuck at value of 2 of pot so i removed the connections and plugged them again and no signal :/ so what do you think might happens ? seems some connection maybe broken or something ?
Title: Re: Problem with NRF24L01 low current on some pins ! help !
Post by: MarkT on Nov 16, 2019, 10:27 pm
You are well away from any WiFi router?
Title: Re: Problem with NRF24L01 low current on some pins ! help !
Post by: firashelou on Nov 16, 2019, 10:29 pm
You are well away from any WiFi router?
i am in the living room where there is no wifi rooter but in the next room there is but even that it should work as I built another project last year and all went great and i am in same place as last year and rooter in same place too
Title: Re: Problem with NRF24L01 low current on some pins ! help !
Post by: raschemmel on Nov 16, 2019, 10:56 pm
Did place the receiver 3 feet away from the transmitter and try the sketch without the long range antenna ?
Title: Re: Problem with NRF24L01 low current on some pins ! help !
Post by: firashelou on Nov 17, 2019, 06:39 am
Did place the receiver 3 feet away from the transmitter and try the sketch without the long range antenna ?
yes i did tried that, but at the moment i am testing the low range modules and seems voltage is 0 on the CE and CSN pin 3 and 4 of the NRF24L01 on the controller but on the receiver there is voltage
Title: Re: Problem with NRF24L01 low current on some pins ! help !
Post by: raschemmel on Nov 17, 2019, 03:31 pm
The question was does it work ? (yes or no)
I can't tell what you answer was.
Please answer "yes" ir "no" , so we can rule out
range issues.
Title: Re: Problem with NRF24L01 low current on some pins ! help !
Post by: firashelou on Nov 17, 2019, 03:39 pm
The question was does it work ? (yes or no)
I can't tell what you answer was.
Please answer "yes" ir "no" , so we can rule out
range issues.
no it does not :/
Title: Re: Problem with NRF24L01 low current on some pins ! help !
Post by: raschemmel on Nov 17, 2019, 04:02 pm
"no it does not"

Tnen you can forget about range until it does, then you can do a range test with th he antennas
and test every 100 m until it stops working,
then reduce the distance testing every 25 meters
until it works reliably. For the time being
you should forget everything you thought
you knew about what is good and what isn't and
either reexamine the circuit in detail or tear it
apart and rebuild it from scratch after testing
every component first.
What ever you thought you knew is wrong
or you wouldn'tbe here.


They say the hardest part is "letting go"
( of a loved one or a circuit you loved")
We've all experienced that pain of loss as
you tear apart a circuit you spent hours or
days getting to work, only to start over from scratch and rebuild it. Anyone who hasn't
experienced that wouldn't understand how
it makes you feel doing a tear- down and
rebuild. Suffice it to say it's not "fun".
Title: Re: Problem with NRF24L01 low current on some pins ! help !
Post by: firashelou on Nov 17, 2019, 05:35 pm
"no it does not"

Tnen you can forget about range until it does, then you can do a range test with th he antennas
and test every 100 m until it stops working,
then reduce the distance testing every 25 meters
until it works reliably. For the time being
you should forget everything you thought
you knew about what is good and what isn't and
either reexamine the circuit in detail or tear it
apart and rebuild it from scratch after testing
every component first.
What ever you thought you knew is wrong
or you wouldn'tbe here.


They say the hardest part is "letting go"
( of a loved one or a circuit you loved")
We've all experienced that pain of loss as
you tear apart a circuit you spent hours or
days getting to work, only to start over from scratch and rebuild it. Anyone who hasn't
experienced that wouldn't understand how
it makes you feel doing a tear- down and
rebuild. Suffice it to say it's not "fun".
Ok i retested the range again to make sure no results, so i rebuilt the circuit, it is very simple anyway just the modules and 1 pot but i ignored the put and took a sketch from an online tutorial and tested it no results, by the way i showed my circuit picture in original post attached. I am using jumper wires with the modules might that create a problem a broken wire or something ?

Or maybe the layout of the pins is different which i hardly doubt it is the case, I got the modules from aliexpress from china by the way. The arduinos are both new out of the box still so it can't be the case of a broken arduino pin.

I took my multimeter and tested the pins of the module, all have voltages except pin5 which is the SCK has a voltage of 0.15V other pins from 1.5V to 3.3V
Title: Re: Problem with NRF24L01 low current on some pins ! help !
Post by: groundFungus on Nov 17, 2019, 05:41 pm
Robin2's simple rf24 tutorial  (https://forum.arduino.cc/index.php?topic=421081.0)has information and known good code that may help you to get the radios working.  That tutorial helped me a lot.

One thing to note is that the Uno's 3.3V regulator often will not provide the current needed by the radios.  Sometimes a 10uF cap across the 3.3V supply to the radio will help by supplying the required current when the radio transmits (but sometimes not).   I always use a separate 3.3V regulator (LM1117 3.3) supplied by the Uno 5V regulator to power my radios.
Title: Re: Problem with NRF24L01 low current on some pins ! help !
Post by: firashelou on Nov 17, 2019, 08:21 pm
Robin2's simple rf24 tutorial  (https://forum.arduino.cc/index.php?topic=421081.0)has information and known good code that may help you to get the radios working.  That tutorial helped me a lot.

One thing to note is that the Uno's 3.3V regulator often will not provide the current needed by the radios.  Sometimes a 10uF cap across the 3.3V supply to the radio will help by supplying the required current when the radio transmits (but sometimes not).   I always use a separate 3.3V regulator (LM1117 3.3) supplied by the Uno 5V regulator to power my radios.
thank you so much groundFungus !!!! IT WORKED !!
The problem was the capacitor, when I added it, it just fired up like a new engine !! Karma++ !
Title: Re: Problem with NRF24L01 low current on some pins ! help !
Post by: raschemmel on Nov 17, 2019, 09:05 pm
Good catch Groundfungus
+1
Title: Re: Problem with NRF24L01 low current on some pins ! help !
Post by: firashelou on Nov 17, 2019, 09:18 pm
Good catch Groundfungus
+1
raschemmel thanks for trying to help and thanks for everyone :)
Title: Re: Problem with NRF24L01 low current on some pins ! help ! [SOLVED]
Post by: raschemmel on Nov 17, 2019, 09:53 pm
Quote
raschemmel thanks for trying to help and thanks for everyone
I have used the NRF24L01 many times but I never noticed this issue because I have been
automatically adding electrolytic caps to my power lines since I started in electronics 40
years ago so I would never have tried to use it before going through this routine ritual
when setting up the breadboard. I typically use 10uF for the Reset pin and 47uF or
greater for power rails. (100uF is a good round number that is usually enough). You
can never have too much capacitance on your power rails.
Title: Re: Problem with NRF24L01 low current on some pins ! help ! [SOLVED]
Post by: firashelou on Nov 19, 2019, 09:21 am
I have used the NRF24L01 many times but I never noticed this issue because I have been
automatically adding electrolytic caps to my power lines since I started in electronics 40
years ago so I would never have tried to use it before going through this routine ritual
when setting up the breadboard. I typically use 10uF for the Reset pin and 47uF or
greater for power rails. (100uF is a good round number that is usually enough). You
can never have too much capacitance on your power rails.
So you suggest the best choice is to use 100uF between VCC and GND ?
Title: Re: Problem with NRF24L01 low current on some pins ! help ! [SOLVED]
Post by: raschemmel on Nov 19, 2019, 09:43 am
I wouldn't think twice..
Title: Re: Problem with NRF24L01 low current on some pins ! help ! [SOLVED]
Post by: firashelou on Nov 20, 2019, 09:40 am
I wouldn't think twice..
ok will use a 100uF, meanwhile karma++ :D