I have 2 transceivers and 2 Arduino Uno boards. I'm trying to send sensor data from 1 Arduino to the other using the transceivers. when i do it at home it works fine no matter how many times i use it. however, sometimes it stops working. when i test to see if the transceivers are powered on by doing a quick if(radio.begin()) test its on but I'm not getting any data. sometimes it works then stops working sometimes it works fine then sometimes it doesn't work at all.
I'm attaching the board and the transceiver to the back of the a steel bar. is it a faulty transceiver or is it something with my code. if it was something with my code it wouldn't run at all.
How do Yo that? Posting the code might help us..... Note: Please use autoformatted code pasted using code tags, </>.
Hi eliasm
A couple of points to note when using the nRF24L01 modules - All based on my personal experiences.
1. It’s worth noting that power supply noise is one of the most common issues people experience when trying to make successful communication with the nRF24L01 modules. Generally, RF circuits or radiofrequency signals are sensitive to power supply noise. Therefore, it’s always a good idea to include a decoupling capacitor across the power supply line as close to the nRF24L01 module as possible. The capacitor can be anything from 10uF to 100uF. I used a small 47uF soldered across the power pins on both the receiver & transmitter nRF24L01's
2. I've also found adding the following settings in the nRF24L01 Setup on both the receiver & transmitter. This helped improve reliability considerably -
radio.setDataRate(RF24_2MBPS); // Set the speed of the transmission to the quickest available
radio.setChannel(124); // Use a channel unlikely to be used by Wifi, Microwave ovens etc
radio.setPALevel(RF24_PA_MAX); // Set radio Tx power to MAX
HTH?
It is doing what I would expect. The datasheet of arduino uno states that maximum 3.3v output current of the UNO uno is 50mA. The nRF24L01 states the Nominal current is 50mA. When you go into high power it draws more causing the Arduino regulator to get hot and starts to shut down by dropping the voltage. This can cause the regulator to desolder from the board. I believe the best solution is to use an external power supply or set it at low power and hope it keeps on working. For more information check this link: nRF24L01 Module Pinout, Features, Circuit & Datasheet.
Which is wrong.
It comes from the time that 3.3volt was stolen from the USB chip (which the classic Nano still does).
The Uno, and Mega, are now using a dedicated 150mA regulator.
But nobody can be bothered to update the datasheet.
Leo..
I am using a 10uF capacitor. I do have the power set to minimum. I'll try to set it to max and see if that works
Hi,
Can you post some images of your project and how you have mounted them on a steel bar?
Thanks.. Tom...
If your code is written like this then it could explain things......
I have a very similar problem. I have 4 NRF, one working as a receiver and three as trasmitter. They work completly randomly and the only thing I found out is that if I restart the power supply (which is the one you can find in the arduino's kit) only two transmitters work even though the code is the same for all three.
Receiver code
#include <SPI.h>
#include <RF24.h>
#include <RF24Network.h>
#define CE_PIN 9
#define CSN_PIN 10
RF24 radio(CE_PIN, CSN_PIN);
RF24Network network(radio);
const uint16_t nodeRX = 00;
int dataReceived; // this must match dataToSend in the TX
//invio un int così dal numero so chi lo ha inviato
bool newData = false;
//===========
void setup()
{
Serial.begin(9600);
Serial.println("SimpleRx Starting");
SPI.begin();
radio.begin();
network.begin(124, nodeRX); //canale, indirizzo nodo
radio.setDataRate(RF24_250KBPS);
radio.startListening();
}
//=============
void loop()
{
network.update();
while (network.available()) //Non vi entra se non vi sono dati
{
RF24NetworkHeader header;
network.read(header, &dataReceived, sizeof(dataReceived));
switch (dataReceived)
{
case 1: Serial.println("From TX1");
break;
case 2: Serial.println("From TX2");
break;
case 3: Serial.println("From TX3");
break;
default: Serial.println("Error");
break;
}
}
}
Transmitter code
#include <RF24.h>
#include <RF24Network.h>
#define button 2
#define CE_PIN 9
#define CSN_PIN 10
RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
RF24Network network(radio);
const uint16_t nodeTX1 = 01;
const uint16_t nodeRX = 00;
const int dataToSend = 1;
void setup()
{
Serial.begin(9600);
pinMode(button, INPUT);
SPI.begin();
radio.begin();
network.begin(124, nodeTX1);
radio.setDataRate(RF24_250KBPS);
radio.startListening();
}
//====================
bool flag = false;
void loop()
{
network.update();
if (digitalRead(button) == LOW)
{
if (!flag)
{
Serial.print("Pulsante premuto:");
sendData();
flag = true;
}
}
else
{
flag = false; //Debounce
}
}
//====================
void sendData() {
bool rslt;
RF24NetworkHeader header(nodeRX); //(nodo destinatario)
rslt = network.write(header, &dataToSend, sizeof(dataToSend));
if (rslt) //Verifica che il ritorno della funzione "write" sia true, ovvero ACK è stato ricevuto
{
Serial.println(" Acknowledge received");
}
else
{
Serial.println(" Tx failed");
}
}
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.