Hi friends,
I am wondering that can NRF24L01 communicate with multiple receivers?
As I read following thing in its datasheet
At 2Mbps the channel occupies a bandwidth wider than the resolution of the RF channel frequency setting. To ensure non-overlapping channels in 2Mbps mode, the channel spacing must be 2MHz or more. At 1Mbps and 250kbps the channel bandwidth is the same or lower than the resolution of the RF frequency. The RF channel frequency is set by the RF_CH register according to the following formula: F0= 2400 + RF_CH [MHz] You must program a transmitter and a receiver with the same RF channel frequency to communicate with each other.
So can I use 8 NRF24l01 for making 4 transmitter pair lying in 1 meter range and still effectively establish the communication when all 3 transmitter sending data on same time!(which is not possible at 433 MHZ band tx/rx)
I have experimented successfully with two nRF24 pairs both working on the same channel but using different device IDs (pipe numbers).
Both pairs were sending data at 100msec intervals without any attempt at synchronization to avoid conflicts.
...R
If you use different channels for the pairs, it should work without problems.
If the data to be send is infrequent enough, it should work on the same channel.
But it depends on the way the acknowledge features are used.
Does any one have any link which is easy and can help me in designing it, also which is best NRF24 module?
Sorry I am too new in this module, but yes I have tried 433Mhz and 15Mhz module but it looks quite different than those.
The examples below are the code I used. This is a simplified version of code to control a model train. The TrackControl is the master and the Handcontrol is the slave.
Note where it explains in the code that I made a small change to the RF24.cpp library file.
...R
TrackControl.ino (1.9 KB)
HandController.ino (1.69 KB)
Hey guys May be it looks like foolish but as we have to set registers and all for 24l01 do we need separate burner too or are we deal with it using SPI of uC only?
Robin can u post code directly over here without uploading cause I am unable to open it up!
This is the HandController code
// HandController - the slave or the receiver
// http://maniacbug.github.io/RF24/classRF24.html
//~ - CONNECTIONS: nRF24L01 Modules See:
//~ http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
//~ 1 - GND
//~ 2 - VCC 3.3V !!! NOT 5V
//~ 3 - CE to Arduino pin 9
//~ 4 - CSN to Arduino pin 10
//~ 5 - SCK to Arduino pin 13
//~ 6 - MOSI to Arduino pin 11
//~ 7 - MISO to Arduino pin 12
//~ 8 - UNUSED
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
// NOTE the file RF24.cpp has been modified by commenting out the call to powerDown() in the write() function
// that is line 506 in my copy of the file
#define CE_PIN 9
#define CSN_PIN 10
// NOTE: the "LL" at the end of the constant is "LongLong" type
const uint64_t deviceID = 0xE8E8F0F0E1LL; // Define the ID for this slave
int valChange = 1;
RF24 radio(CE_PIN, CSN_PIN);
int dataReceived[2];
int ackData[2] = {12,0};
byte ackLen = 2;
void setup() {
Serial.begin(9600);
delay(1000);
Serial.println("Hand Controller Starting");
radio.begin();
radio.setDataRate( RF24_250KBPS );
radio.openReadingPipe(1,deviceID);
radio.enableAckPayload();
radio.writeAckPayload(1, ackData, ackLen);
radio.startListening();
}
void loop() {
if ( radio.available() ) {
bool done = false;
done = radio.read( dataReceived, sizeof(dataReceived) );
Serial.print("Data0 ");
Serial.print(dataReceived[0]);
Serial.print(" Data1 ");
Serial.println(dataReceived[1]);
radio.writeAckPayload(1, ackData, ackLen);
ackData[0] += valChange; // this just increments so you can see that new data is being sent
}
}
and this is the TrackControl code
// TrackControl - the master or the transmitter
// http://maniacbug.github.io/RF24/classRF24.html
//~ - CONNECTIONS: nRF24L01 Modules See:
//~ http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
//~ 1 - GND
//~ 2 - VCC 3.3V !!! NOT 5V
//~ 3 - CE to Arduino pin 9
//~ 4 - CSN to Arduino pin 10
//~ 5 - SCK to Arduino pin 13
//~ 6 - MOSI to Arduino pin 11
//~ 7 - MISO to Arduino pin 12
//~ 8 - UNUSED
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
// NOTE the file RF24.cpp has been modified by commenting out the call to powerDown() in the write() function
// that is line 506 in my copy of the file
#define CE_PIN 9
#define CSN_PIN 10
// NOTE: the "LL" at the end of the constant is "LongLong" type
// These are the IDs of each of the slaves
const uint64_t slaveID = 0xE8E8F0F0E1LL;
RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
int dataToSend[2];
unsigned long currentMillis;
unsigned long prevMillis;
unsigned long txIntervalMillis = 1000;
int txVal = 0;
int ackMessg[4];
byte ackMessgLen = 2;
void setup() {
Serial.begin(9600);
Serial.println("Track Control Starting");
radio.begin();
radio.setDataRate( RF24_250KBPS );
radio.enableAckPayload();
radio.setRetries(3,5); // delay, count
}
//====================
void loop() {
currentMillis = millis();
if (currentMillis - prevMillis >= txIntervalMillis) {
radio.openWritingPipe(slaveID); // calls each slave in turn
dataToSend[0] = txVal; // this gets incremented so you can see that new data is being sent
txVal += 1;
dataToSend[1] = txVal;
txVal += 1;
bool rslt;
rslt = radio.write( dataToSend, sizeof(dataToSend) );
Serial.print("\nRSLT ");
Serial.println(rslt);
Serial.print("Data Sent ");
Serial.println(dataToSend[0]);
if ( radio.isAckPayloadAvailable() ) {
radio.read(ackMessg,ackMessgLen);
Serial.print("Acknowledge received: ");
Serial.println(ackMessg[0]);
}
prevMillis = millis();
}
}
...R
Thanks