nRF24L01 Arduino Tutorial Code & Schematic

Posted on

nRF24L01 Arduino Tutorial

nRF24L01 Arduino Tutorial – Various electronic devices are made as small as possible for portable needs. One such communication device is the nRF24L01.

This device works on the ISM (Industrial, Scientific and Medical) 2.4 – 2.5 GHz frequency.

The nRF24L01 chip made by Nordic Semiconductor has a data rate specification of 1 or 2Mbps.

This means that by using this chip you can transmit data of 1 mega (1,000,000) or 2 mega (2,000,000) data bits per second.

This nRF24L01 chip can be used as a transceiver, receiver or bi-directional (transceiver and receiver simultaneously).

This nRF24L01 wireless chip can communicate with 125 other nRF24L01 devices in one location.

nRF24L01 Arduino Tutorial Code & Schematic

How can we make this nRF24L01 device able to communicate with that large number? does it not confer data with each other when sent?

The answer is no, because each device must be given an Address (pipe) or an address first.

Based on the datasheet provided, this chip uses a power supply of 1.9 – 3.6 volts, but in addition to the power supply pins such as the data pin, a voltage of 5 volts can be given.

This chip requires a current of 11.3 mA when sending data and 12.3 mA when receiving data.

For Arduino nRF24L01 communication, this chip uses the SPI (Serial Peripheral Interface) protocol. The SPI data transmission speed on this chip is 0 to 8Mbps.

Arduino nRF24L01 Wiring

Now we will try this module by setting the module that is connected to our arduino set as the sender, while the arduino pro mini on the right is the receiver.

We will create a program that can send this word “Hello Word” for one second.

If the receiver receives data from the sender, the receiver will display the data to the Arduino serial monitor.

nRF24L01 Arduino Tutorial Code & Schematic

nRF24L01 Library

This program requires a library called RF24. Please download below.

Once downloaded, enter the library into the Arduino IDE and create two programs, namely the sender and receiver program with the following code:

nRF24l01 Code

Transmitter

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(9, 10); // CE, CSN
const byte address[6] = "00001";

void setup() {
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();
}
void loop() {
  const char text[] = "Hello World";
  radio.write(&text, sizeof(text));
  delay(1000);
}

Receiver

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(9, 10); // CE, CSN
const byte address[6] = "00001";

void setup() {
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();
}
void loop() {
  const char text[] = "Hello World";
  radio.write(&text, sizeof(text));
  delay(1000);
}

If you want to see more of this chip, please download the datasheet below.

I hope this article is useful.

Leave a Reply

Your email address will not be published.