so i bought 2 PA/LNA nRF24l01 modules off of amazon and i tried testing whether they work or not. i have a single arduino so i tried testing them one by one. AND both of them give "weird" values. I've rechecked my wirings multiple time, but still either i get this:-
so what's the problem? ive always plugged the VCC to 3.3v of my arduino uno. could it be power related? the arduino is connected to my laptop during compiling and uploading.
An extra capacitor should not be necessary when using the adapter but VCC on the adapter should go to 5V on the Arduino. The adapter has an on board 3.3V regulator
Try this simple program, it tests that the NRF24L01 can be accessed via the SPI bus. No RX or TX is done so there are no special requirements fo the power supply. Its a standalone program so no NRF24L01 library is needed.
/*******************************************************************************************************
Program Operation - This program is stand alone, it is not necessary to install a NRF2401 library.
Connect the SPI SCK, MOSI and MISO pins as normal.
The program checks that the NRF2401 can be written to and read from over the SPI bus. To read a
register its first necessary to write the address across the SPI interface.
The contents of the NRF2401 registers from 0x00 to 0x19 are read and printed to the serial monitor.
If the connections are OK then the printout should look like something like this;
57_NRF24L01_Is_It_There ?
Print registers 0x00 to 0x1F
Reg 0 1 2 3 4 5 6 7 8 9 A B C D E F
0x00 00 3F 02 03 5F 4C 27 42 00 00 E7 52 C3 C4 C5 C6
0x10 E7 00 20 00 00 00 00 12 00 00
Note that this is just a 'is it there' type check, the CE pin is not used or needed for this simple check.
If the device is faulty, not present or wired incorrectly the register contents will likely be all 00s or
FFs. The program makes no attempt to turn on the RF transmitter or receiver so there are no special
requirements for the power supply.
Serial monitor baud rate is set at 9600.
*******************************************************************************************************/
#include <SPI.h>
#define CSN_PIN 10 //this is the pin used for the NRF2401 CSN pin
#define CMD_R_REGISTER 0x00
#define CMD_W_REGISTER 0x20
void loop()
{
Serial.println(F("Print registers 0x00 to 0x19"));
printRegisters(0, 0x19);
Serial.println();
delay(5000);
}
void printRegisters(uint16_t Start, uint16_t End)
{
uint16_t Loopv1, Loopv2, endLoopv2, RegCount, RegData;
RegCount = End - Start + 1;
Serial.print(F("Printing "));
Serial.print(RegCount);
Serial.println(F(" registers"));
Serial.println();
Serial.print(F("Reg 0 1 2 3 4 5 6 7 8 9 A B C D E F"));
Serial.println();
for (Loopv1 = Start; Loopv1 <= End;) //32 lines
{
Serial.print(F("0x"));
if (Loopv1 < 0x10)
{
Serial.print(F("0"));
}
Serial.print((Loopv1), HEX); //print the register number
Serial.print(F(" "));
if (RegCount < 16)
{
endLoopv2 = RegCount - 1;
}
else
{
endLoopv2 = 15;
}
for (Loopv2 = 0; Loopv2 <= endLoopv2; Loopv2++)
{
RegData = readRegister(Loopv1);
RegCount--;
if (RegData < 0x10)
{
Serial.print(F("0"));
}
Serial.print(RegData, HEX); //print the register number
Serial.print(F(" "));
Loopv1++;
}
Serial.println();
}
}
uint8_t readRegister(uint8_t reg)
{
uint8_t result;
digitalWrite(CSN_PIN, LOW);
SPI.transfer(CMD_R_REGISTER | reg);
result = SPI.transfer(0xff);
digitalWrite(CSN_PIN, HIGH);
return result;
}
void setup()
{
Serial.begin(9600);
pinMode(CSN_PIN, OUTPUT);
Serial.println();
Serial.println(F("57_NRF24L01_Is_It_There ?"));
Serial.println();
SPI.begin();
}
i should mention that holding the arduino side jumper wire ends made the output change a bit, my arduino UNO is a bit old, but it works fine, could it be some sort of hidden connection issue?
well the nrf24l01 with the adapter is connected to arduino UNO which for now is only connected to my laptop. although you told me to use VCC 5v, so i put the VCC pin to 5V
hmm, ive ordered some new wires, ill try using those and see what happens. i dont think the arduino ports are faulty case those digital pins do work. if even with new wires, its still bad that means the nrf modules are faulty. btw this happened with both the modules
personally, this has left a bad impression of nrf on me, ive been scratching my head on this for 3 days now.
i was going to make a Tank using the nrf modules for a project. should i just settle on using NodeMCU instead of arduino + nrf. or buy new nrf modules?