How to use the NRF24L01 2.4GHz wireless module with an Arduino

Home/Tutorials/How to use the NRF24L01 2.4GHz wireless module with an Arduino

How to use the NRF24L01 2.4GHz wireless module with an Arduino

TUTORIAL

Using the NRF24L01 2.4GHz wireless module to light up some lights
–

OVERVIEW

There are many ways to add wireless capability to your Arduino projects.

WiFi modules like the ESP8266 makes that possible, but you need to be somewhat close to a WiFi signal, and the code will need to be reconfigured if you want to connect to a different WiFi router, since the password would probably be different.

Bluetooth modules will kinda achieve the same thing, but using Bluetooth communication instead.

But sometimes you might just want to be able to send or receive without having to use WiFi or Bluetooth, well then the NRF24L01 would be a good choice.

Unlike the others it uses radio wave to communicate between modules, the same type used in cordless phones in your house.

In this tutorial we will keep it simple and use a regular cherry switch, that when clicked will send a value that will then be picked up by another module and will light up a WS2812 LED stick different colours based on that value received.

TRANSMITTER CONNECTIONS

The transmitter portion of this tutorial, which is the one the Cherry Switch is connected to is based on the Arduino NANO board.

As you can see we are connecting a NRF24L01 module and a Cherry Switch.

Here are the connections:

The Switch is connected to the GND and Pin 8 on the NANO

The NRF24L01 pins:

MISO connects to pin 12 of the NANO

MOSI connects to pin 11 of the NANO

SCK connects to pin 13 of the NANO

CE connects to pin 9 of the NANO

CSN connects to pin 10 of the NANO

GND and VCC of the NRF24L01 are connected to GND and 3.3V of the NANO

The NRF24L01 uses the SPI communication protocol, so you need to make sure that you are using the SPI pins of the version of the Arduino board you will want to use.

RECEIVER CONNECTIONS

The Receiver portion of this tutorial, which is the one that has the WS2812 LED stick and will receive the information sent by the Transmitter uses the Arduino UNO board.

Here are the connections:

The WS2812 RGB Stick DI (digital In) pin is connected to Pin 8 on the UNO

GND and VCC are connected to the GND and 5V of the UNO

The NRF24L01 pins:

MISO connects to pin 12 of the UNO

MOSI connects to pin 11 of the UNO

SCK connects to pin 13 of the UNO

CE connects to pin 9 of the UNO

CSN connects to pin 10 of the UNO

GND and VCC of the NRF24L01 are connected to GND and 3.3V of the UNO

THE CODE – TRANSMITTER

For this tutorial we will have 2 separate codes: 1 for the Transmitter and one for the Receiver.

The Transmitter or Client will be the one with the Switch connected that will send information to the Server which has the RGB stick connected.

In this tutorial we only have 1 switch connected but we could connect more switches or sensor if we wanted and just change the information sent based on those, which the Server will do an action based on that.

As always, Don’t forget to watch our Tutorial videos on the left side of this page for more information.

But I have a problem. When I use A as Tx and B as Rx, It worked. When I use B as Tx and A as Rx, It didn’t work. When I use C (C-C,A-C,B-C all combinations) , It didn’t worked.
what is the wrong. Please help.

You really make it appear so easy together with your presentation but I in finding this matter to be really something that I think I would
by no means understand. It sort of feels too complicated and very huge
for me. I am looking ahead on your next publish, I will try to get
the grasp of it!

Thanks for your comment, like anything new, at first it seems daunting, but just keep at it, start with simple things, then you can apply what you learn in the harder ones. Hope you check out more of my tutorials and learn at your own pace!