Full disclosure: I'm a newbie.

I've got an Arduino Nano and a Mega, and a pair of NRF24L01+ PA modules (exactly these: http://www.elektrotedarik.com/Images/Urun/11122013173429.jpeg)

I'm trying to get them to work. I am on this tutorial with the RF24 library: https://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo

On Arduino Nano, it works perfect. I wire everything as told, and set up my radio:

const uint64_t pipe = 0xE8E8F0F0E1LL;
RF24 radio(CE_PIN, CSN_PIN);
fdevopen( &my_putc, 0);
radio.begin();
radio.setPALevel(RF24_PA_MAX);
radio.setDataRate(RF24_250KBPS);
radio.openWritingPipe(pipe);

When I call radio.printDetails(); I get a nice output in serial monitor:

STATUS       = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1    � = 0xe8e8f0f0e1 0xc2c2c2c2c2
RX_ADDR_P2-5    � = 0xc3 0xc4 0xc5 0xc6
TX_ADDR      = 0xe8e8f0f0e1
RX_PW_P0-6  � = 0x20 0x00 0x00 0x00 0x00 0x00
EN_AA        = 0x3f
EN_RXADDR   � = 0x03
RF_CH        = 0x4c
RF_SETUP    � = 0x27
CONFIG       = 0x0c
DYNPD/FEATURE   � = 0x00 0x00
Data Rate    = 250KBPS
Model        = nRF24L01+
CRC Length   = 16 bits
PA Power     = PA_HIGH

Everything as expected. If I remove a wire (for testing), it displays all zeroes, when I plug it back, it displays right again, so I assume that it's in working condition. I then try the same with Mega, but even after re-checking the wiring after 4 times, it's not working. Here's what I get with the same code:

STATUS       = 0x00 RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=0 TX_FULL=0
RX_ADDR_P0-1    � = 0x0000000000 0x0000000000
RX_ADDR_P2-5    � = 0x00 0x00 0x00 0x00
TX_ADDR      = 0x0000000000
RX_PW_P0-6  � = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA        = 0x00
EN_RXADDR   � = 0x00
RF_CH        = 0x00
RF_SETUP    � = 0x00
CONFIG       = 0x00
DYNPD/FEATURE   � = 0x00 0x00
Data Rate    = 1MBPS
Model        = nRF24L01
CRC Length   = Disabled
PA Power     = PA_MIN

Tried many times, no avail. Then I've came upon several threads talking about the different pins. Changed the pins to match Mega's MOSI, MISO, SCK, CE, CSN pins, no avail. I've tried exact same configuration with people who say that it's working, no avail. Then I've stumbled upon that Mega ironically can't supply enough current from the 3V3 pin (while Nano perfectly can) and it can't power the NRF24L01+ PA. I've tried drawing 3V from my power supply (my power supply has either 3 or 4.5 volts, I can't risk burning my transceiver with 4.5 volts). It still doesn't work, and it became extremely hot in seconds (the one attached to my nano doesn't heat up at all). I immediately turned it off, thought that I've burned something, swapped with the Nano's transceiver, and it (fortunatelly) works. So there's no problem with the NRF24L01+ PAs. Why would it not work with Mega (I've also tried the lowest power setting too), and why would it get extremely hot when attached to an external power supply? What else can I do?

UPDATE: I've added a 470uF decoupling capacitor to the receiving end (the one attached to Mega), it seems to be worse.

A very interesting observation: If I touch the receiver when it's not working, it starts receiving the signal excellently. If I let it go, signal is lost again.

UPDATE 2: Nevermind the last "when I touch..." update, it appears to be related to wiring (haven't soldered them yet, just using jumper wires)

UPDATE 3: My initial assumption is correct, something happens when I touch the cables. Something more weird is going on. I soldered my module on a prototype board, and my module sometimes works even without CE pin plugged in. When I touch the cable, it transmits, and stops. Here, TX pin lighting up means it's receiving the signal (I'm writing data to serial). It receives the data (and yeah, the correct data) when I touch the CE pin's cable:

enter image description here

How on Earth is this possible? Does the CE pin/cable (and myself) act as an antenna? Makes no sense.

UPDATE 4: If I plug that pin to 5V, the whole receiver starts working absolutely perfectly, with no errors/drops at all. But I can't get it: why? And would it overheat/short something?

migrated from electronics.stackexchange.com Aug 4 '15 at 19:20

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • Lack of power sounds right, getting hot sounds wrong. Even when not working correctly when powered from the 3v3 pin, did you have a 10uF cap across the nRF power pins? – Roger Rowland Aug 4 '15 at 13:22
  • What is the init code that you use on your mega? – MathieuL Aug 4 '15 at 14:26
  • @RogerRowland Nope, I didn't have a cap, should I? by the way, I've tested the power supply and it appears to be a bit off. It outputs about 4 volts in 3V mode. It would explain why it was getting hot, and possibly not working. – Can Poyrazoğlu Aug 4 '15 at 14:59
  • @MathieuL the same as Nano with the exception of CE and CSN, which are 40 and 53 respectively. – Can Poyrazoğlu Aug 4 '15 at 15:01
  • 1
    @CanPoyrazoğlu try Ce = 8 , CSN = 53 , SCK = 52 , MOSI = 51, MISO = 50 – MathieuL Aug 4 '15 at 15:20

I have a NRF24L01 - not that exact model, mine looks like this:

NRF24L01 with aerial

Pin-outs:

NRF24L01 pin-outs

I hooked it up to my Mega2560 like this:

NRF24L01     Mega2560
----------   ----------------

  VCC         3.3V pin
  Gnd         Gnd
  CSN         D10 
  CE          D9
  MOSI        D51 - (MOSI) 
  SCK         D52 - (SCK)  
  IRQ         N/C
  MISO        D50 - (MISO)

I used the RF24 library. Then I hit a number of issues.

For one thing, the "Getting Started" sketch doesn't seem to work too well, even between two Unos, for reasons I haven't worked out.

However the "pingpair" sketch worked OK between two Unos. But not when one device was moved to the Mega2560! I tried various things including a separate power supply, and moving the CSN/CE pins around, but to no avail.

Then I had a look at Vcc/Gnd using the scope:

NRF24L01 Vcc

That's over half a volt of ripple! I soldered on a 0.1 µF capacitor between Vcc and Gnd on the NRF24L01 and the problems went away. Using the pingpair sketch I now have:

Now sending 56...ok...Got response 56, round-trip delay: 23
Now sending 1080...ok...Got response 1080, round-trip delay: 21
Now sending 2103...ok...Got response 2103, round-trip delay: 21
Now sending 3126...ok...Got response 3126, round-trip delay: 21
Now sending 4148...ok...Got response 4148, round-trip delay: 22
Now sending 5171...ok...Got response 5171, round-trip delay: 22
Now sending 6194...ok...Got response 6194, round-trip delay: 22
Now sending 7217...ok...Got response 7217, round-trip delay: 22
Now sending 8240...ok...Got response 8240, round-trip delay: 21
Now sending 9263...ok...Got response 9263, round-trip delay: 21
Now sending 10286...ok...Got response 10286, round-trip delay: 21

So, my suggestion is a decoupling capacitor on the NRF24L01.


Extra

I still had some weird issues where the above results actually came from a NRF24L01 without the aerial. The one with the aerial had much more marginal results.

These are the results with the aerial:

Now sending 181378...ok...Failed, response timed out.
Now sending 182581...ok...Failed, response timed out.
Now sending 183784...failed.
Failed, response timed out.
Now sending 185047...failed.
Failed, response timed out.
Now sending 186309...ok...Got response 186309, round-trip delay: 26
Now sending 187336...ok...Got response 187336, round-trip delay: 22
Now sending 188359...ok...Failed, response timed out.
Now sending 189561...ok...Got response 189561, round-trip delay: 22

Still, I think it is worth trying the decoupling capacitor.


and why would it get extremely hot when attached to an external power supply?

Did you have the grounds connected?

  • Nope, didn't have the grounds connected, moreover, it was a faulty supply, in 3V mode I saw about 4-4.2V in voltmeter. I think those combined explain it. – Can Poyrazoğlu Aug 5 '15 at 7:21
  • 1
    Whatever else you do, always connect the grounds. Otherwise you may have some massive voltage which happens to be the difference in the grounds in your house wiring appearing at your processor chip. – Nick Gammon Aug 5 '15 at 7:36
  • You are definitely right, and I actually knew about that (and it does make perfect sense intuitively too, GNDs should be equal). My newbie-ness and lack of experience made me forget about that :) – Can Poyrazoğlu Aug 5 '15 at 7:37

An old thread.
But I want to share my fix when hooking nRF24 with MEGA. I forgot the website where I got the solution.

It is simply adding a pinMode(x, OUTPUT) in the setup, where x is the CSN pin you choose.

I believe the issue is only on pin 53 only on MEGA.
However, add this in all my sketches with or without MEGA just for precaution.

New contributor
Muhammad is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.