Practical uses of nRF24L01 wireless modules?

I just bought a few nRF24L01 modules, although I have no project in mind. I used Library Manager to install the RF24 library of TMRh20 and tested them with the GettingStarted example that came with the library. (For those who’ve not seen that, all it does is get micros() on ArduinoA, sends it to ArduinoB for an echo back, gets a new micros() on ArduinoA and reports the trip time. Nothing fancy, but proves it works.)

Next step is to add code at each end to (say) generate a random number on ArduinoA (or read a pot) and send that to ArduinoB to be the interval of a blink or speed of a motor, or something. (Random number and blink will be dead easy, don’t even need to hook up any gear.)

So I’m curious to know what anyone does with these things in real life? (Talking of, what’s a practical distance to work over, both outdoors and indoors with a few brick walls?)

They're used for all kinds of wireless communication.
Possibly most commonly to send sensor data across.
Typical range: about the same as WiFi (same frequency).

wvmarle:
Possibly most commonly to send sensor data across.

Yeah but I meant what kind of actual data? I could imagine weather sensors out in the fields sending wind speed etc back to the barn...

wvmarle:
Typical range: about the same as WiFi (same frequency).

Is it possible to attach some numbers? (Not that it matters since right now they're about 50cm apart; in fact I'm more concerned about them being too close :wink: )

I use them for radio control for model trains. I have made some units for my model railway club that take the place of wired controllers so folk aren't tripping over the wires. And I have some installed in my own trains for battery powered radio control.

I have tested a pair of the low power nRF24 modules (with PCB antenna) at a range of 110metres outdoors with clear line of sight. I suspect they would have worked at a longer range but I could not see any farther - badly designed experiment :slight_smile:

I have not used the high power devices (with external antenna) but they should have a much longer range. AFAIK they (or their Cypress equivalents) are what is used in off-the-shelf model aircraft RC equipment.

2.4GHz wireless is much more easily affected by obstacles than lower frequencies. Wet leaves (on plants) are a major problem.

...R
Simple nRF24L01+ Tutorial

Robin2:
I use them for radio control for model trains. And I have some installed in my own trains for battery powered radio control.

Excellent. Presumably with a pretty small Arduino like a nano or perhaps a processor chip on a purpose-made pcb?

Robin2:
I have tested a pair of the low power nRF24 modules (with PCB antenna) at a range of 110metres outdoors

I had no idea they could talk so far, interesting. I'll see if I can get on to the local school.

Robin2:
Simple nRF24L01+ Tutorial

I have that bookmarked already, thanks. In fact I used your wiring diagram. Just thought I'd use the library's getting started first time round.

On that though @Robin2, the library (from TMRh20, v1.3.1 as installed via Library Manager), examples only include RF24.h, while you include RF24L01.h as well. What's that about?

Willpatel_Kendmirez:
Excellent. Presumably with a pretty small Arduino like a nano or perhaps a processor chip on a purpose-made pcb?

I use an Attiny 1634. I don’t have space for a PCB. :slight_smile:
DSCF4525 cropped.jpg

On that though @Robin2, the library (from TMRh20, v1.3.1 as installed via Library Manager), examples only include RF24.h, while you include RF24L01.h as well. What’s that about?

I don’t know. I have never used the Library Manager.

Do my examples work for you?

…R

Thanks for reply.

Robin2:
I use an Attiny 1634.

So is that the ATtiny soldered on an nRF24?

Robin2:
Do my examples work for you?

Next step is to try those.

Willpatel_Kendmirez:
So is that the ATtiny soldered on an nRF24?

I fixed it upside-down on the nRF24 with a double-sided sticky-pad.

I use the nRF24 pins for connecting to my programmer when necessary. One of the wires sticking out the back is the reset connection for programming. They are held on with a blob of epoxy.

In a more recent version I have used lacquered wire (as used in a transformer or electric motor) as it is smaller and easier to work with - apart from the tedium of removing the lacquer at the ends for soldering.

...R

Robin2:
I fixed it upside-down on the nRF24 with a double-sided sticky-pad.

Tres cunning

Robin2:
I use the nRF24 pins for connecting

Talking of which, I see the nRF24 is another example of non-breadboard-friendly pins

Willpatel_Kendmirez:
Talking of which, I see the nRF24 is another example of non-breadboard-friendly pins

Because use in breadboards by Arduino experimenters is a ridiculously trivial part of their usage.

Just get some adaptors.

I think the functionality of these is used with, or incorporated into all of the current range of 2.4 GHz RC toys (and such) which require you to "sync" both the controller and the model so that the pilot LEDs stop flashing, so they obviously have the bi-directional connectivity.

Looking into the RC flipping car that my granddaughter is presently using, I notice everything - Wireless transceiver and motor drivers - is in just one single chip!

Paul__B:
Because use in breadboards by Arduino experimenters is a ridiculously trivial part of their usage.

I daresay that's true: I'm jut annoyed that my local supplier catalogues them as DIP. I have since disabused them of the idea that just because the pins are in dual lines, doesn't make it DIP.

Paul__B:
Just get some adaptors.

Good idea, thanks.

Dupont cables are an easy way to connect the nR24 modules

...R

Robin2:
Dupont cables are an easy way to connect the nR24 modules

Yep that's what I did actually. (Well, generic Dupont "style")

Willpatel_Kendmirez:
(Well, generic Dupont "style")

That is indeed what I meant :slight_smile:

I have a few nRF24s with a 5-strand piece of Dupont cable connected using the same colours in each. I have arranged the connections so they just plug into an Uno on pins 9 to 13. Makes it easy to use the Uno for other things and then quickly connect the nRF24 when needed.

...R

Robin2:
Dupont cables are an easy way to connect the nR24 modules


(Link!)

Robin2:
Do my examples work for you?

TL/DR: they didn’t but now yes, mysteriously with me doing nothing

The below is struckthrough but left for completeness’ sake.

Hmmm well this is a bit strange.
Manage Libraries installed RF24 v1.3.1 which as I said above worked with its own examples. Then I copy and pasted your simple tx/rx sketches both of which compiled and started running. Then although the rx side did say it received message0, the tx side said there was a failure. Tx carried on sending message0 (no increment), rx kept saying it got it, tx side kept saying a failure.That said to me that the automatic acknowledgement of receipt wasn’t working, which if I read your tut correctly is part of the RF24 protocol.
So naturally I assumed that was a fault in the RF24 library version 1.3.1 as installed by Manage Libraries, perhaps one of the old problems your tut mentioned, so I deleted it and downloaded the zip from the github link in your tut, and installed that via the Add .zip library option in the IDE.
Guess what: it says now 1.3.1 is installed, so the one it installed originally and the one in your link are the same. (That didn’t surprise me: the link in your tut and the More info link in Manage Libraries go to the same page.)
And then of course I got the same symptoms when I ran simple tx and rx, that tx is saying a failure although rx actually got the message.
I put a serial print inside the if ( radio.available() ) {} on the rx side just to prove it was happy with the receipt, and it printed, and so presumably sent the required ack which tx didn’t get or didn’t like.
So to answer your question “Do my examples work for you?”, yes in that they compile and run, no in that the tx and rx are in disagreement about the success of the conversation! And I have no idea if this is a code slash library related thing, or hardware. (I do know from the RF24 library’s own Gettingstarted examples, which allows for role switching so either end can be the primary transmitter, that what is the Rx in your examples is capable of transmission and so should be able to send the ack back.

The below is struckthrough but left for completeness' sake.

PS to above: I then deliberately corrupted thisSlaveAddress on the Rx side so it no longer matched the one on the Tx. Rx, correctly, then never went beyond the "starting" message, and the Tx side continued to spew that it was sending but failing, which in this case makes sense.

PPS and mysteriously it's started working correctly.

One thing to be aware of is that the nRF24 does not reset when the Arduino resets. The nRF24 only resets when power is disconnected. It is a good idea to depower everything briefly after uploading a new program to the Arduino.

...R

Yes, I saw that thanks.

One thing I think I did verify, fwiw, is that the RF24 library to which you link from your tut, is the same one as installed by Manage Libraries. The latter method may be preferable to some users than the download zip way.