I've followed the tutorial by Robin2 (which as been a great help).
I've made some slight changes, They seem to work very well while there close to each other in another room on the same level.
But when I move the TX unit downstairs in the Kitchen I start to miss some counts.
Now I've searched the internet and found some stuff to try like from these places
https://blog.blackoise.de/2016/02/fixing-your-cheap-nrf24l01-palna-module/
https://blog.blackoise.de/2016/03/building-a-lc-filter-for-your-nrf24l01-palna-module/
This has made some improvements but still missing some counts may be not as many, Hs you can see
Data received Message 7
Data received Message 8
Data received Message 9
Data received Message 0
Data received Message 1
Data received Message 2
Data received Message 3
Data received Message 4
Data received Message 5
Data received Message 6
Data received Message 7
Data received Message 8
Data received Message 9
Data received Message 0
Data received Message 2
Data received Message 3
Data received Message 4
Data received Message 5
Data received Message 6
Data received Message 7
Data received Message 8
Data received Message 9
Data received Message 0
Data received Message 1
Data received Message 2
Data received Message 3
Data received Message 4
Data received Message 5
Data received Message 6
Data received Message 7
Data received Message 8
Data received Message 0
This is the TX code
// SimpleTx - the master or the transmitter
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
const uint64_t pipeOut = 0xE8E8F0F0E1LL; //IMPORTANT: The same as in the receiver
#define CE_PIN 9
#define CSN_PIN 10
RF24 radio(CE_PIN, CSN_PIN);
//#define DATARATE RF24_2MBPS
// #define DATARATE RF24_1MBPS
#define DATARATE RF24_250KBPS
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( DATARATE ) ;
radio.setPALevel( RF24_PA_MAX ) ;
radio.setChannel(0x6C);
radio.enableDynamicPayloads() ;
radio.enableAckPayload(); // not used here
radio.setRetries(0, 15); // Smallest time between retries, max no. of retries
radio.setAutoAck( false ) ;
radio.printDetails(); // Dump the configuration of the rf unit for debugging
radio.powerUp();
radio.openWritingPipe(pipeOut);
}
//====================
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 code
// SimpleRx - the slave or the receiver
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
//#define DATARATE RF24_2MBPS
// #define DATARATE RF24_1MBPS
#define DATARATE RF24_250KBPS
#define CE_PIN 9
#define CSN_PIN 10
const uint64_t pipeIn = 0xE8E8F0F0E1LL;
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( DATARATE ) ;
radio.setPALevel( RF24_PA_MAX ) ;
radio.setChannel(0x6C);
radio.enableDynamicPayloads() ;
radio.enableAckPayload(); // not used here
radio.setRetries(0, 15); // Smallest time between retries, max no. of retries
radio.setAutoAck( false ) ;
radio.openReadingPipe(1, pipeIn);
radio.printDetails(); // Dump the configuration of the rf unit for debugging
radio.powerUp();
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;
}
}
It's still the same even if I use the original code in the tutorial I get the same results.
Now if I was to use the one with the aerial version for the TX would this improve the range to the RX unit without the an aerial ?
Or would I need to use both with aerial's ?
If I could get away with only using it on the TX unit this would be better for me,