Experiment 7 How to Use NRF24L01

Share for us

Overview:

This routine is divided into sending and receiving parts. The sending terminal consists of the SunFounder Mega 2560, five buttons, and NRF24L01 module. The receiving terminal consists of SunFounder Nano, 4-channel relay module, and NRF24L01 module. The five keys on the sending terminal are defined as sw1, sw2, sw3, sw4, and sw5. The first four keys are corresponding to the four channels on the relay module of the receiving terminal. The sw5 key is a close key. When any keys are pressed on the sending terminal, the corresponding relay channel on the receiving terminal will be energized. When sw5 is pressed, all the relays will be disconnected.

Components:

-1 * SunFounder Mega 2560

-1 * SunFounder Nano

-2 * NRF24L01

-1 * 4-channel relay module

-1 * Breadboard

-1 * USB Cable for Mega 2560

-1 * USB Cable for Nano

-Several jumper wires

-5 * Buttons

Experimental Procedures

Step1: Build the circuit

Sending Terminal

 1)The wiring between the five buttons and SunFounder Mega 2560 is as follows:

ButtonsSunFounder Mega 2560
Sw12
Sw23
Sw34
Sw45
Sw56
GNDGND

2)The wiring between NRF24L01 and SunFounder Mega 2560 is as follows:

NRF24L01SunFounder Mega 2560
CE22
CSN24
SCK26
MOSI28
MISO30
IRQ32
GNDGND
VCC5V

Receiving Terminal

1)    The wiring between NRF24L01 and SunFounder Nano is as follows:

NRF24L01SunFounder Nano
CE8
CSN9
SCK10
MOSI11
MISO12
IRQ13
GNDGND
VCC5V

2)The wiring between 4-Channel Relay Module and SunFounder Nano is as follows:

4-Channel Relay ModuleSunFounder Nano
IN16
IN25
IN34
IN43
VCC3.3V
GNDGND

Step2: Program

Step3: Compile

Step4: Burn nrfTest_send into SunFounder Mega2560 and nrfTest_receive into SunFounder Nano

Summary

When you press button 1 on the sending board, relay 1 of the 4-channel relay module on the receiving board will be energized and IN1 will light up. When you press button 2, relay 2 will closed and IN2 will light up. The same as for button 3, button 4 and button 5.