Problems with nrf24l01 + pa lna

hello. i'm trying to use an arduino as a transmitter and an esp32 as the receiver. i have tried if these modules work and i can confirm they do, as i soldered 2 positive and 2 negative wires to try them with a single battery. now i'm trying to use them on separate circuits.
i got two 3.7v battery, one is 7800 mAh and the other 2800mAh. the circuit is basically the same on the transmitter side as the receiver:
3.7v battery > stepup (5v) > stepdown (around 3.24v in one of the stepdowns bc it has larger jumps and when i try to regulate it to 3.4 it jumps to 3.8v. the other is regulated in 3.4) > nrf24l01.
the stepups are intended to power the arduino and the esp32 but i'm not wiring it rn bc i'm powering it with usb as i load the code. i used protoboard wires, stripped them and soldered them to the stepup and stepdown pins, but i didn't solder over the arduino, nrf or esp32 pins. i tried using male and female jumper wires but i had the same result. this sounds complicated but i had to resort to an external power supply bc the 3.3v pin of the esp32 and arduino didn't give enough current to my nrfs.

Data Sent Message 4  Acknowledge received
Data Sent Message 5  Tx failed
Data Sent Message 5  Tx failed
Data Sent Message 5  Tx failed
Data Sent Message 5  Tx failed
Data Sent Message 5  Tx failed
Data Sent Message 5  Tx failed
Data Sent Message 5  Tx failed
Data Sent Message 5  Tx failed
Data Sent Message 5  Tx failed

i sometimes get acknowledge even when some wires are disconnected, and when they're connected correctly get tx failed on the transmitter side. on the receiver side i just get data received rapidly showing up, which i've read that isn't a good thing.

i'm using this code from robin2 thread, slightly modified to fit the pins of my esp.

// SimpleTx - the master or the transmitter (ARDUINO NANO)

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


#define CE_PIN   9
#define CSN_PIN 10

const byte slaveAddress[5] = {'R','x','A','A','A'};


RF24 radio(CE_PIN, CSN_PIN); // Create a Radio

char dataToSend[10] = "Message 0";
char txNum = '0';


unsigned long currentMillis;
unsigned long prevMillis;
unsigned long txIntervalMillis = 1000; // send once per second


void setup() {

    Serial.begin(9600);

    Serial.println("SimpleTx Starting");

    radio.begin();
    radio.setDataRate( RF24_250KBPS );
    radio.setRetries(3,5); // delay, count
    radio.openWritingPipe(slaveAddress);
}

//====================

void loop() {
    currentMillis = millis();
    if (currentMillis - prevMillis >= txIntervalMillis) {
        send();
        prevMillis = millis();
    }
}

//====================

void send() {

    bool rslt;
    rslt = radio.write( &dataToSend, sizeof(dataToSend) );
        // Always use sizeof() as it gives the size as the number of bytes.
        // For example if dataToSend was an int sizeof() would correctly return 2

    Serial.print("Data Sent ");
    Serial.print(dataToSend);
    if (rslt) {
        Serial.println("  Acknowledge received");
        updateMessage();
    }
    else {
        Serial.println("  Tx failed");
    }
}

//================

void updateMessage() {
        // so you can see that new data is being sent
    txNum += 1;
    if (txNum > '9') {
        txNum = '0';
    }
    dataToSend[8] = txNum;
}
// SimpleRx - the slave or the receiver (ESPWROOM32S)

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

#define CE_PIN   4
#define CSN_PIN 5

const byte thisSlaveAddress[5] = {'R','x','A','A','A'};

RF24 radio(CE_PIN, CSN_PIN);

char dataReceived[10]; // this must match dataToSend in the TX
bool newData = false;

//===========

void setup() {

    Serial.begin(9600);

    Serial.println("SimpleRx Starting");
    radio.begin();
    radio.setDataRate( RF24_250KBPS );
    radio.openReadingPipe(1, thisSlaveAddress);
    radio.startListening();
}

//=============

void loop() {
    getData();
    showData();
}

//==============

void getData() {
    if ( radio.available() ) {
        radio.read( &dataReceived, sizeof(dataReceived) );
        newData = true;
    }
}

void showData() {
    if (newData == true) {
        Serial.print("Data received ");
        Serial.println(dataReceived);
        newData = false;
    }
}

and these are the connections.
https://europe1.discourse-cdn.com/arduino/original/4X/4/8/f/48ff0dc9c5cba648cf0bd7879e8bad7be9bfbe36.png

https://how2electronics.com/wp-content/uploads/2020/10/circuit-ESP32-nRF24L01.png

please help. why am i getting acknowledge received sometimes when i shouldn't? is it a false positive? sometimes when i used to have tx failed i also tried pressing the female/male head of the wires to make sure they were making contact correctly, but this isn't working.

Poor coding. It'll roll over during the first txIntervalMillis. It has no consequence in this case, but poor style nonetheless.

That's odd. TX only returns true if the sender receives an ACK from the receiver, which suggests a successful transfer.

That's good though isn't it? Every second new data coming in? Are the received data correct?

IDK; doesn't make sense to me.

Can you post a photo of your setup and a wiring diagram of both the sender and the receiver?

Please note that having two of these modules in close proximity can result in transfer problems because the signal basically 'blows out'; it's too 'loud'. It helps to dial the PA level back in such a case. Might be worth a try.

The fact that you're receiving something is a good sign.

First point is there is NO such thing as a 7800mAh 3.7V battery, it's a fake. Most are like your other battery at 2800. It's chemistry, we v=can not change that fact without the battery being physically bigger.
Second point. NEVER power sensor or especially radio boards from a pin on an arduino or esp32. You must use a separate PSU for those power hungry devices. The arduino/esp32 can be battery powered under the right conditions though. As to the rest of it we need to see a wiring diagram.

Try posting a schematic—your description is a bit hard to follow.

1 Like

i don't know what to tell you, that's what my battery says. i'm not an electronics expert so i just assumed it was a battery that can supply enough current to my circuit and last a while.

and about the power for the nrfs, yes, i learnt that because i have already tried to power my nrfs with the 3.3v pin and it wasn't enough, specially the ones i have with the antenna. i'm not using the 3.3v pin rn though, i am using a battery and a stepdown that can support 3A max.

i'll post the wiring below.

i'm relieved that that's a good sign. i've read on robin2's thread that getting just "data received" with less than a second of spacing was a bad thing. i'm also soldering things again with utp wires intead of dupont so the photos are a bit outdated. the diagrams are the idea of what i want to do, but right now i'm not connecting the esp or the arduino with the battery since i'm already powering it with an usb for the moment as i run code.

the final circuit will add a gps module, ublox neo6m specifically, i'll try to power everything with the battery once i can run a server on the esp32 so the coordenates of my gps are displayed on a page.

here's multiple photos of my wiring

i'm sorry if the pics look blurred, my phone doesn't have a good camera.

i'm sorry, here's a diagram and photos of my wiring. the diagram is what i want to do, but the esp32 and the arduino are not connected to the battery for the moment as i power it with an usb for the moment.

That battery is a fake. The 18mm x 65mm form factor only contains enough chemicals for a maximum 3,000 mAh and most are less. If they lie re the capacity, what else did they lie about?

It's important that the behavior you describe / your problem report matches with the circuit as built. I understand that things change as you try things out and do update, but for the rest of us (and even for you, arguably), it's just not possible to keep track of which hardware version produced which behavior.

1 Like

that's such a shame. i'll try to find another battery. supposedly, it SHOULD still work as i have the stepup regulated to 5v so it can supply my arduino/esp32 and the stepdown lowers it to 3.3v, but maybe it doesn't have enough current for the nrf? i'm gonna try to find one to test, thanks

yes, of course. the images and the circuit i've linked are how i wired everything and the circuit i was having problems with. i started soldering again today with utp wires as they're thicker than dupont wires. the dupont wires were cutting a LOT and i have soldered them a lot of times again but they're fragile and i have them in a box, so maybe that could be another reason it isn't working? i'll finish soldering and i'll try connecting everything as i did before and i'll get back to you.

Poor / intermittent contacts are a possible cause and can be very frustrating to troubleshoot.

i'm not sure if intermittent contacts are the problem anymore, as i press the wires and the problem persists.

i'm using female wires. i finished soldering, here's what my circuit looks like now. sorry if it's a bit more confusing but utp wires don't have black and red wires inside...

it's esencially the same as before. the connections with the nrf are also the same but i didn't take a pic since it looks messy. i have put insulating tape in the connections where i soldered the utp wires with the female heads of the dupont wires so it's more durable.

i tried running the code with this circuit, it still didn't work.
the only thing i have left to try is try powering with another 3.7v battery that isn't fake, buy another stepdown as i've heard the stepdown mp1684 isn't very good? it's cheaper and the trimpot isn't as good as the one in the lm2596 so maybe it could have problems to regulate the voltage, and the last thing would be soldering wires over the pins to avoid intermittent contacts, which is not what i want to do.

i also tested the voltage with a multimeter and everything seems ok. the nrfs don't seem to be fried as i get 3.2v on each.

That doesn't say much about what happened to them in the past.
However, the fact that they seem to be detected OK and they transmit data at least some of the time is encouraging.

How often do you get dropped frames, i.e. transmissions that don't make it to the receiving end?
And how often does the receiver report data coming in that could/shouldn't exist?

The UTP wire is OK; I'm not a huge fan of it because often it's solid-core, so liable to break. Braided wire is preferred.

they don't seem to be transmitting data right now. i used to get the acknowledge, but for some reason it isn't working now. when i connect them, this is what i get on my serial monitor.

Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed
Data Sent Message 0  Tx failed

multiple times, on my transmitter code.

on my receiver code i get "Data received" but in less than a second, so i don't think that's a good sign because the messages are being sent each second.

Is it followed by the data that can realistically be received (i.e. it matches the data sent from the TX sketch)?

Note the code also prints the received data to the Serial console:

You could add a line to this that also prints the size of the data packet received. This might generate a clue.

if the data i should receive on my receiver end is 0, 1, 2 and the rest of the numbers respectively, no, it just shpws data received repeatedly without any other text.

Have you tried setting the PA level to LOW on both sides (esp. TX though)?

yes, i have tried that with a simpler code. this is the code i've tried:

#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9,10); ///(CE,CSN)

///NRF TRANSMITTER

long weight;

void setup(){
  Serial.begin(9600);
  radio.begin();
  radio.setChannel(5); //Channel (0...127)
  radio.setDataRate (RF24_1MBPS); //RF24_250KBPS, RF24_1MBPS, RF24_2MBPS
  radio.setPALevel (RF24_PA_MIN); //RF24_PA_MIN=-18dBm, RF24_PA_LOW=-12
  radio.openWritingPipe (0x1234567890LL); //0x1234567890
}

void loop(){
  weight=13381;
  
  bool success = radio.write(&weight, sizeof(weight));
if(success){
    Serial.println("Data sent successfully");
} else {
    Serial.println("Failed to send data");
}

  delay(1000);
}
#include <RF24.h>
RF24 radio(4,5);

///NRF RECEIVER

long weight;

void setup(){
  delay(1000);
  Serial.begin(9600);
  Serial.println("Setup");
  radio.begin();
  radio.setChannel(5); //Channel (0...127)
  radio.setDataRate (RF24_1MBPS); //RF24_250KBPS, RF24_1MBPS, RF24_2MBPS
  radio.setPALevel (RF24_PA_MIN); //RF24_PA_MIN=-18dBm, RF24_PA_LOW=-12
  radio.openReadingPipe (1, 0x1234567890LL); 
  radio.startListening();
}

void loop(){
  if(radio.available()){
    radio.read(&weight, sizeof(weight));
    Serial.println(weight);
  }
}

i get "failed to send data" on the transmitter monitor and 0 on my receiver monitor.