Introduction: Getting Started With NRF24L01 Wireless Transceiver Module
In this project, we are going to learn how to use NRF24L01 Transceiver Module in order to make a wireless communication between two Arduino boards where using the PushButton at the first Arduino we will control the LED at the second Arduino.
The purpose is to discover the perfect way to communicate wirelessly between Arduino’s by using the NRF24L01 Wireless Transceiver Module.It alows us to remote things wirelessly.
Hardware components :
1. Arduino Uno × 2
2. NRF24L01 Transceiver Module × 2
3. Base module with voltage regulator × 2
4. PushButton
5. LED
6. Breadboard
7. Wires
Software apps :
1. Arduino IDE
Step 1: NRF24L01 Features and Specifications
Features of the NRF24L01 Wireless Transceiver Module :
- Cost (between 1$ to 3$ regarding to the type version)
- Range
- Availability
- Easy to use
Types of the NRF24L01 Wireless Transceiver Module :
There is two types of NRF24LO1 :
- NRF24L01 with antenna (About a Kilometer in openspace)
- NRF24L01 without antenna (About 50 meters in openspace)
Applications of the NRF24L01 Wireless Transceiver Module :
- Wireless home automation
- Drones remote control
- Remote sensors for temperature, pressure, alarms, much more
- Robot control and monitoring
The power consumption of the NRF24L01 Wireless Transceiver Module :
- The power consumption of this module is just around 12mA during transmission
- The operating voltage of the module is from 1.9 to 3.6V
Step 2: Watch the Video for More Details
Step 3: Problem to Be Overcome
Many users confront issues with NRF24L01 module.the source of these issues often come from the 3.3v Power.due to themodule does not have enough current capability.this is why I recommend to either use:
- Base module with voltage regulator and bypass capacitorsfor stability
OR
- 3.3 uF to 10 uF (MicroFarad) capacitor directly on the module from +3.3V to Gnd
Step 4: Schematic
CE and CSN pins can be connected to any digital pins. Then in RF24 library, you can specify which pins you used. I chose pins 8 and 9 because I will use them in the examples.
In our case we will use the Arduino Uno this is why you should follow this instructions (or follow the picture above) :
- MOSI is connected to the digital pin 11
- MISO is connected to the digital pin 12
- SCK is connected to the digital pin 13
- SS (not used)
Note: While using the NRF24L01 you have to remember that these digital pins won’t be available.
Kindly watch the video which explained all steps clearly.
Step 5: Download RF24 Library
In this project we used RF24 library, which can be downloaded on Github: RF24 library
1. First you need to click on “Download ZIP” button
2. Extract the zip file to your Arduino home directory: Arduino/libraries on Linux or Documents/ Arduino/libraries in Windows.
Step 6: Transmitter Arduino Code
Transmitter sketch will look like:
/** Arduino Wireless Communication Tutorial * Transmitter Code * * by Smart Technology, <a href="https://makesmarttech.blogspot.com/" rel="nofollow"> https://makesmarttech.blogspot.com/ </a> * * Library: TMRh20/RF24,<a href="https://tmrh20.github.io/RF24" rel="nofollow">https://tmrh20.github.io/RF24</a> */ #include <SPI.h> #include <nRF24L01.h> #include <RF24.h> #define button 7 RF24 radio(8, 9); // CE, CSN const byte address[6] = "00001"; boolean buttonState = 0; void setup() { pinMode(button, INPUT); radio.begin(); radio.openWritingPipe(address); radio.setPALevel(RF24_PA_MAX); radio.stopListening(); } void loop() { delay(5); radio.stopListening(); buttonState = digitalRead(button); radio.write(&buttonState, sizeof(buttonState)); }<br>
Attachments
Step 7: Receiver Arduino Code
Receiver sketch code will look like :
/** Arduino Wireless Communication Tutorial * Receiver Code * * by Smart Technology, https://makesmarttech.blogspot.com/* Library: TMRh20/RF24, https://tmrh20.github.io/RF24 */ #include <SPI.h>
#include <nrf24l01.h> #include<RF24.h> #define led 7 RF24 radio(8, 9); // CE, CSN const byte address[6] = "00001"; boolean buttonState = 0; void setup() { pinMode(7, OUTPUT); Serial.begin(9600); radio.begin(); radio.openReadingPipe(0, address); radio.setPALevel(RF24_PA_MAX); radio.startListening(); } void loop() { delay(5); radio.startListening(); while (!radio.available()); radio.read(&buttonState, sizeof(buttonState)); if (buttonState == HIGH) { digitalWrite(led, HIGH); } else { digitalWrite(led, LOW); } }
Attachments
Step 8: For Support
You can subscribe to the my YouTube channel for more tutorials and projects.
Subscribe for support. Thank you. Go to my YouTube Channel -link https://goo.gl/EtQ2mp
7 Comments
4 years ago
I guess we assume the resistors are 220 ohm. They aren't mentioned and it's too small in the pictures to read that color code.
5 years ago
This is a good start point .Pity about your link to utube ,it starts the video immediately and you have to get off the page to stop it downloading . I dont have the download capability.
Question : I have two radio boards like these and I see that the amp voltage capacity etc senders being sold on ebay use the same board . No doubt they have an arduino like chip in them controlling the radio board. I would like to see whats being transmitted by them in my serial terminal . Can you guide me on altering the receiver code to show what's coming in?
Reply 5 years ago
https://www.ebay.com.au/itm/VAC1100A-DC-120V-100A-LCD-Voltmeter-Ammeter-Power-Meter-Capacity-Coulomb-Counter/371825607133?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649
Question 5 years ago
How to do this using 8 buttons and 8 leds? thank you
Answer 5 years ago
For this, you have to modify the code of the transmitter and receiver.
Question 5 years ago on Step 7
Can you not just put the .ino files here for download?
Answer 5 years ago
It's done, Thank you for your feedback.