I have tried to solve by your tutorial, tx led started to blinking but radio.available() was return false. At the reciver i got something unknown characters. Also tried to put 100uF between VCC and GND but nothing. Any experience?
tmsbrndz:
I have tried to solve by your tutorial, tx led started to blinking but radio.available() was return false. At the reciver i got something unknown characters. Also tried to put 100uF between VCC and GND but nothing. Any experience?
You need to post the programs that YOU uploaded to YOUR Arduinos. Be sure to make it clear which program is on the Mega.
#include <nRF24L01.h>
#include <RF24.h>
#include <SPI.h>
#include <RF24_config.h>
// SimpleTx - the master or the transmitter
#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;
}
RX
// SimpleRx - the slave or the receiver
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define CE_PIN 9
#define CSN_PIN 10
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;
}
}
TX led lighting continuously, RX led nothing just blink once at start, also swapped the modules to another but still nothing. CNS and CE at good pin,100%
tmsbrndz:
TX led lighting continuously, RX led nothing just blink once at start,
Never mind the blinking lights. What appears on the Serial Monitors for the two programs?
Your code is NOT identical to my code. Fix that first.
Are you certain you have the correct RF24 library - the same as I use?
Have you tried disconnecting the power from the Uno after uploading the program to make sure that the nRF24 resets. The normal Arduino reset does not reset the nRF24.
Have you 10µF capacitors across Vcc and GND for the nRF24s?
Have you a spare nRF24 that you can use just in case one of the first pair is faulty?
I can't think of anything else to suggest. 100µF should be fine. Maybe you have a faulty nRF24.
I have had one faulty device among about 20 altogether. Apart from that I have found them very easy to work with.
How are you connecting the nRF24 to the Arduino. In another recent Thread someone said he had trouble with poor connections on dupont connectors - but I have not had that problem with my dupont connectors.
I know my code works because other Forum members have used it.
tmsbrndz:
I need to solder capacitors on modules or i can do this with breadbord?
They don't need to be soldered but there must be a reliable electrical connection and they should be as close as possible to the nRF24 pins. I presume you know that electrolytic capacitors need to be connected the right way round.
Buy another pair of nRF24s for testing. They are not very expensive.
So i think here we have 100% issue with wires, i moved them little while arduino running and TX/RX led not just lighting they started to blink and got this output. (RX is not blinking just light)