I'm new here and I'm currently testing two NRF24L01-modules, cause I want to use them to control a drone. To try out the modules, I did copy two little scetches in which a short text or a number should be transmitted.
As transmitter I'm using an Arduino Due as shown in the following picture:
It's my first time trying to set up a wireless connection via Arduino. Unfortunately, the topic causes me a little more problems than I thought.
The both NRF24L01-modules appear to be connected, but the received data is incorrect. If I transmit "Hello World" as shown in the example, I get weird signs on the receiver:
If I transmit the number "1", I get the number "9" in the received data.
After many researches I installed a 100 µF capacitor between VCC & GND to equalize fluctuations in the power supply. Furthermore I did test many programm examples to get the radio transmission to work and searched in a lot of forums to get a solution. But without success. The problem always persisted.
Does anyone have a tip or an approach for me, please?
I would be grateful for every tip!
Welcome. It probably isn't the kind of tip you were looking for, but you missed the part of the introduction about posting code. Please post it in inline text, using code tags. Not screen shots.
How much current can the MKR supply on 3.3V output?
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
//create an RF24 object
RF24 radio(7, 8); // CE, CSN
//address through which two modules communicate.
const byte address[6] = "00001";
void setup()
{
radio.begin();
//set the address
radio.openWritingPipe(address);
//Set module as transmitter
radio.stopListening();
}
void loop()
{
//Send message to receiver
const char text[] = "Hello World";
radio.write(&text, sizeof(text));
delay(1000);
}
For the receiver:
//Include Libraries
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
//create an RF24 object
RF24 radio(6, 4); // CE, CSN
//address through which two modules communicate.
const byte address[6] = "00001";
void setup()
{
while (!Serial);
Serial.begin(9600);
radio.begin();
//set the address
radio.openReadingPipe(0, address);
//Set module as receiver
radio.startListening();
}
void loop()
{
//Read the data if available in buffer
if (radio.available())
{
char text[32] = {0};
radio.read(&text, sizeof(text));
Serial.println(text);
}
}
I measured 7 mA. Thanks for this notice! Maybe the current is to low. According to the datasheet the NRF24L01-modules need until 45 mA for receiving and until 115 mA for transmitting.
But there are many examples where the radio modules should work with an Arduino UNO R3, where the current according to the datasheet only is 20 mA and it seems to work, although the current is to low. Then how is this even possible?
How did you measure that? The maximum current that a source can produce, can only be determined by short circuiting the output (since otherwise, the current is determined by the load device). Did you do a short circuit measurement? I doubt it. Also you can't really measure it directly, if there is output circuit protection in the form of current limiting. Instead, I was hoping you would check the specs.
thanks for your answers!
I checked a new datasheet of the NRF24L01+ and noticed, that the current of the modules has to be about 12 mA. Now I did take two of the Arduino Uno R3 with >20 mA and the radio connection works!
I will try the radio transmission of some sensor data.