I have been testing "Hello world" communication between two NANO boards, each of them connected toe nRF24L01 units. However, it seems like the receiver does not respond. Each board is powered up from a computer located several meters from each other. The serial monitor for the transmitter shows "Hello worlds" once a second, but the receiver shows "no signal received from transmitter".
I am 100% sure the wiring between the NANO and the nRF24L01 is correct, so I don't think wrong wiring is causing the problem.
I have tested both NANO-boards as both receiver and transmitter. I have also tried several nRF24L01 units. The result is the same.
Really hope you can help me, since I have to solve this problem in order to get forward with my project.
Can you post an annotated schematic showing how you have connected each of the radios to there respective Arduinos. Most of the time is is wiring problems. How are you powering the radios, if from the Arduino's 5V or 3V3 supply, that is probably the problem. This has been posted many times but it will save you time and $$$.
Gil's Crispy Critter Rules, they apply to processor hardware:
Rule #1. A Power Supply the Arduino is NOT!
Rule #2. Never Connect Anything Inductive to an Arduino!
Rule #3 Don't connecting or disconnecting wires with power on.
Rule #4 Do not apply power to any pin unless you know what you are doing.
LaryD's Corollary's
Coro #1 when first starting out, add a 220R resistor in series with both Input and Output pins.
Coro #2 buy a DMM (Digital Multi-meter) to measure voltages, currents and resistance.
Violating these rules tends to make crispy critters out of Arduinos.
Hint: It is best to keep the wires under 25cm/10" for good performance.
I hope this schematic shows the connection for both the TX and the RX.
Both boards are powered up from two computers, one for each of the boards.. They are located som few meters from each other.
// ESP32 > NRF24L01 transmitter test
// ESP32 connections
// ESP32 SCK pin GPIO18 goes to NRF24L10_pin SCK
// ESP32 MISO pin GPIO19 goes to NRF24L10_pin MI
// ESP32 MOSI pin GPIO23 goes to NRF24L10_pin MO
// NRF24L10 CE to ESP32 pin GPIO4
// NRF24L10 CSN to ESP32 pin GPIO 5
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(4, 5); // CE, CSN pins
const byte address[6] = "00001"; // Address of the receiver
const uint64_t pipes = 0xF0F0F0F0E1LL;
void setup() {
Serial.begin(115200);
Serial.println("\n\nESP32 > NRF24L01 transmit test");
radio.begin();
if (radio.isChipConnected())
Serial.println("Transmitter NF24 connected to SPI");
else Serial.println("\n\nNF24 is NOT connected to SPI");
radio.openWritingPipe(pipes);
radio.setChannel(100);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
Serial.println(sizeof(int));
}
void loop() {
static char dataToSend[] = "hello world 0!";
radio.write(&dataToSend, strlen(dataToSend)+1);
Serial.println(dataToSend);
if (++dataToSend[12] > '9') dataToSend[12] = '0';
delay(1000);
}
nano receiver
// Nano > NRF24L01 receiver test
// UNO/Nano connections
// arduino SCK pin 11 goes to NRF24L10_pin SCK
// arduino MISO pin 12 goes to NRF24L10_pin MI
// arduino MOSI pin 13 goes to NRF24L10_pin MO
// NRF24L10 CE to arduino pin 9
// NRF24L10 CSN to arduino pin10
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
//create an RF24 object
RF24 radio(9, 10); // CE, CSN
//address through which two modules communicate.
const byte address[6] = "00001";
const uint64_t pipes = 0xF0F0F0F0E1LL;
void setup() {
Serial.begin(115200);
delay(3000);
Serial.println("\n\nNano > NRF24L01 Receive");
radio.begin();
if (radio.isChipConnected())
Serial.println("Receiver NF24 connected to SPI");
else {
Serial.println("NF24 is NOT connected to SPI");
while (1)
;
}
//set the address
radio.openReadingPipe(0, pipes);
radio.setChannel(100);
radio.setPALevel(RF24_PA_MIN);
//Set module as receiver
radio.startListening();
}
void loop() {
if (radio.available()) {
char data[32] = { 0 };
radio.read(&data, sizeof(data));
Serial.println(data);
}
}
transmitter serial monitor output
ESP32 > NRF24L01 transmit test
Transmitter NF24 connected to SPI
4
hello world 0!
hello world 1!
hello world 2!
hello world 3!
hello world 4!
hello world 5!
hello world 6!
hello world 7!
hello world 8!
hello world 9!
hello world 0!
hello world 1!
hello world 2!
hello world 3!
hello world 4!
hello world 5!
nano receiver serial monitor
Nano > NRF24L01 Receive
Receiver NF24 connected to SPI
hello world 1!
hello world 5!
hello world 7!
hello world 8!
hello world 4!
hello world 0!
hello world 2!
hello world 4!
hello world 5!
hello world 8!
hello world 9!
hello world 0!
hello world 5!
hello world 6!
hello world 8!
hello world 0!
hello world 1!
hello world 2!
hello world 5!
hello world 6!
hello world 7!
hello world 8!
each packet transmitted has a counter - the receiver output shows that packets are being lost
I have a lot of local WiFi 5GHz and 2.5GHz traffic which I assume is corrupting the NRF24L01 packets
I will try to see how my TX and RX are responding on this code.
I notice that you on the TX have connected CE to pin 4 and CSN to pin 5, While on the RX you have connected CE to pin 9 and CSN to pin 10. Is there a certain reason for this? Or does it not matter?
the transmitter is a ESP32 (pins 4 and 5) and the receiver is a Nano (pins 9 and 10)
one selects pins available on the specific microcontroller, e.g. pins 9 and 10 on the ESP32 used by the SPI flash
Nano > NRF24L01 Receive
Receiver NF24 connected to SPI
hello world 1!
hello world 2!
hello world 3!
hello world 4!
hello world 5!
hello world 7!
hello world 8!
hello world 9!
hello world 0!
hello world 1!
hello world 3!
hello world 5!
hello world 6!
hello world 7!
hello world 9!
hello world 0!
hello world 1!
hello world 2!
hello world 3!
hello world 4!
hello world 5!
hello world 6!
hello world 7!
hello world 8!
hello world 9!
hello world 2!
hello world 3!
hello world 4!
I have tried your code. The TX serial monitor shows same as yours. But the RX serial monitor shows only these two rows:
Nano > NRF24L01 Receive
Receiver NF24 connected to SPI
These rows also are shown even if the TX is not connected. The "Hello word" is not showing up on the RX monitor. So it appears like the RX is not receiving data from TX. Not with your code, and not with my code. I have tried another NANO as well as another NRF-unit, but the same issue happens.
Like I wrote in the previous post #10, the serial monitor writes: "Transmitter NF24 connected to SPI".
The monitor writes this message even if the TX is not powered!
I have not connected a uf10 capacitor across +3.3v and gnd. Is that of crucial importance? And has it to be exactly 10uf?
a capacitor in the 10uF range helps stabilize the supply voltage when the NRF24L01 radio is working - in particular on devices such as the nano which are not designed to support external modules which may require high currents
all that the Rx message indicates is that the library software is communicating OK with the attached NRF24L01
it can then wait to receive packets
if you see "NF24 is NOT connected to SPI" it indicates a wiring problem, dead NRF24L01, etc
Yep as I expected you are using the Arduino as a power supply, that may work at best with these modules many times not. Power the radios from an external power source and be sure they are at least a meter apart. Some boards will drive the radio, depending on the tolerance stack up. Sometimes adding a cap helps many times it does not.
I suspect that the Nano-boards might not be genuine Arduino boards, but copies. If they are copies, could this cause the communication issue?
The image in post #4 shows the actual Nano-board I am using.
A clone Nano will often come with a CH340 USB-serial IC. It has a low current 3.3V output (pin #4, V3) that the clone will use for the 3.3V pin on the Nano header.
From a cursory search, the CH340 can only supply about 30mA on the V3 pin. The nRF24L01 requires 50mA nominally, and up to 250mA during operations (source: components101.com).
Even a real Arduino Nano, using an FT232RL USB-serial IC, is only going to be able to supply 50mA at most on the 3.3V pin.
So the conclusion is that using nRF24L01 together with a Nano, is not a good choice? What is important for my application is to save weight. Every gram is important! Which should be the preferred one?
No, the conclusion is that trying to use the 3.3V pin on a Nano is not going to work to power an nRF24L01.
Free advice being worth what you pay for it, if your 5V supply is up to it, consider a 3.3V LDO regulator and a couple of caps. A TO-92 L4931, 1 ceramic 0.1uF and a tantalum 10uF comes in at a meager 0.4 grams. I'll take a SWAG and say that SMD components could get that down to 0.1 grams.
And if weight is truly that much of a concern, use a mini SMD nRF2401, or even an RF Nano with the nRF24L01 on the same board as the Nano.
what are your requirements? e.g. communication distance? data/sec? sensors? relays? etc etc
if you are looking for a small device with WiFi consider the ESP-01
if long distance look at the TTGO LoRa32 SX1276 OLED