Receiving radio packets with NRF24L01

Questions and discussion about running MicroPython on a micro:bit board.
Target audience: MicroPython users with a micro:bit.
User avatar
Posts: 972
Joined: Thu May 28, 2015 5:54 pm

Receiving radio packets with NRF24L01

Postby deshipu » Thu Mar 09, 2017 12:03 am

I've been trying to get a Micro:bit to communicate with an NRF24L01 module, connected to an ESP8266. As far as I can tell, they both are using the same proprietary Nordic protocol. With some help from a friend, we figured out the paramaters that *should* work:

Code: Select all

payload size = 32 bytes
channel = 7 (2.4Ghz + 7 * 1Mhz)
crc length = 2 bytes (also made sure the polynomial and initial value
match) data rate = 1M
address+group = b'ubit\x00'

And then I sat down and wrote some code that uses them (using the NRF24L01 driver ported to ESP8288 avialable here: ...

Code: Select all

import nrf24l01
from machine import SPI, Pin

radio = nrf24l01.NRF24L01(SPI(1), cs=Pin(15), ce=Pin(16),
                          channel=7, payload_size=32)
radio.set_power_speed(nrf24l01.POWER_3, nrf24l01.SPEED_1M)
radio.open_rx_pipe(0, b'ubit\x00')
while True:
    if radio.any():

Unfortunately, that only works in theory. I have been unable to receive any messages sent with a micro:bit with this, though I can receive messages sent with another NRF24L01 module set to the same settings. I pretty much ran out of ideas about what else I could try.

Any suggestions welcome.

User avatar
Posts: 972
Joined: Thu May 28, 2015 5:54 pm

Re: Receiving radio packets with NRF24L01

Postby deshipu » Fri Mar 10, 2017 1:07 am

Tonight I made some progress. By using code similar to the above, but with disabled CRC, and by spamming thousands of "abcdefgh" messages on the Micro:bit side, I managed to receive the following data:

Code: Select all


As you can see, this is complete garbage. However, it is regular in a way -- it always starts with the same characters, and then they become more and more different. Also, from thousands of messages, only those few got through.

From this I *suspect*, that my NRF24L01 modules (Chinese clones, of course) don't use exactly the same data rate as the NRF51822 chip on the Micro:bit, and as a result of the differences in their clocks the data gets corrupted. Occasionally they will align enough to get the address bytes correct, and then I will see a message, but of course the bits will lose alignment quickly afterwards, so the actual data is corrupted. This would also explain why the modules see each other without any problems -- they are both from the same source and probably have the same fault. I will try experimenting with different modules when i get them.

User avatar
Posts: 137
Joined: Mon Jun 15, 2015 8:03 am

Re: Receiving radio packets with NRF24L01

Postby mcauser » Mon Mar 13, 2017 2:34 am ... l-vs-fake/ ... e-emerging
Pretty sure ALL of my NRF24L01+'s are fakes!
I bought a few nRF905s (433-915MHz) and they all seem to be legit and reliable.

On close inspection of the chip markings on boards from the same provider, if the printed text moves around between modules, they are most likely fakes.

There doesn't seem to be a solid method for checking if a nRF24L01 is fake or not.
Some have claimed reading the registers can reveal fakes: ... r-if-fake/

Perhaps first try testing your nRF24s using a pair of Arduinos, using maniacbug's RF24 library.

I updated to use the machine syntax and am able to communicate between two ESP8266s.
Haven't tried a nRF24L01 to nRF51822 yet.

The nRF51822 doesn't have hardware ShockBurst (nor do some of the fake nRF24L01+'s).
Both the nRF51822 and nRF24L01 can communicate using the "Nordic Gazell 2.4g protocol stack", assuming both chips are legit.

If the nRF24L01 is auto-ACKing, you may run into issues when sending nRF51 to nRF24.
Try setting the nRF24L01 in backwards compatibility mode. The Nordic Developer Zone has a few related articles: ... thout-ack/ ... o-nrf24l01

User avatar
Posts: 1426
Joined: Fri Jul 18, 2014 8:01 am

Re: Receiving radio packets with NRF24L01

Postby pythoncoder » Mon Mar 13, 2017 7:46 am

@mcauser Thanks for that interesting and informative post, I didn't realise the market was awash with dodgy chips. I bought some cheap modules from a supplier I considered reputable, and found they had very limited range and didn't work on all channels. They ended up in the bin.

Sparkfun units (product code 1405) work perfectly for me. A little expensive, but I place some value on my time.
Peter Hinch

User avatar
Posts: 972
Joined: Thu May 28, 2015 5:54 pm

Re: Receiving radio packets with NRF24L01

Postby deshipu » Mon Mar 13, 2017 9:26 am

Thanks. As you can see, I'm using the absolutely dumbest and least magical mode here: no CRC, no ACKs, fixed payload size, etc. As far as I understand, that should give me anything that starts with the correct address.

During the weekend I tested with 2 more pairs of NRF24L01 modules from different sources, and I'm getting similar results -- they can communicate with each other fine (within the same pair), but communicating with the Micro:bit, or even with a module from a different pair, has the effect of only getting one or two messages out of 1000, and garbled.

Return to “The micro:bit”

Who is online

Users browsing this forum: No registered users and 1 guest