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.