Skip to content

6.nRF2401 communication

Welcome to Lesson 6 of this series - nRF2401 Wireless Communication.

We provide a total of four wireless modules for you to use.

1_ 1

ESP32-H2 and ESP32-C6 are predominantly utilized for Zigbee and Wi-Fi communication. Meshtastic, on the other hand, is mainly employed for LoRa communication.

As for NRF2401, it is chiefly used for RF communication.

For specific details of each size, please visit our official website

1_ 4

In this lesson, we will teach you how to use our nRF2401 wireless module.

To use our nRF2401 wireless module, you need to prepare two CrowPanel ESP32 Advance HMI Displays of any size.

1_ 2

One of the nRF2401 wireless modules is inserted into the W-M wireless module slot to perform the sending task;

Another nRF2401 wireless module is inserted into the W-M wireless module slot to perform the receiving task.

1_ 3

1 Framework


Open the code we provide

1_ 5

Divided into two folders:

The READ folder is the code responsible for receiving information for each CrowPanel ESP32 Advance HMI size;

The WRITE folder is the code responsible for sending information for each CrowPanel ESP32 Advance HMI size.

First, open the WRITE folder.

1_ 7

We use a size of 4.3 as a role for sending messages and a size of 7.0 as a role for receiving messages.

2 An nRF2401 is responsible for sending messages


Firstly, burn the "WRITE" function on the 4.3-inch product and open the corresponding code.

1_ 9

Initialize the pins SPI of the wireless module to enable it to work.

1_ 6

Set the relevant parameters of nRF2401 module

1_ 8

Store the message to be sent in the text variable, and call the radio. Write() function interface to send the text content.

1_ 10

Set up the code running environment and upload the code

1_ 12

1_ 11

Be careful:

① During the process of programming the product, please do not insert the nRF2401 wireless module into the W-M slot.

Because the BOOT pin of the CrowPanel ESP32 Advance HMI needs to be kept low, but after inserting the nRF2401 wireless module into the W-M slot, the IRQ pin of the nRF2401 wireless module will default to pulling up the BOOT pin, which can cause burning failure.

So it is necessary to upload the code to the CrowPanel ESP32 Advance HMI before inserting the nRF2401 wireless module into the W-M slot for use.

② When using 4.3 size, 5.0 size, and 7.0 size products, please remember to switch the mode to 0 1 wireless mode.

③ Before uploading the code, please remember to switch to using our library files. If you have forgotten, you can review the second lesson.

1_ 14

After waiting for the 4.3-inch code upload to be completed, press the RESET button.

1_ 16

Open the serial port debugging window

1_ 13

Set the baud rate to 115200, and you can see the relevant information through the serial port, so that you can know that the task of sending messages starts at 4.3 inches.

1_ 15

3 An nRF2401 is responsible for receiving messages


The task of sending messages in the 4.3 - inch device has been completed. Next, we will use the 7.0 - inch device to prepare for receiving messages sent in size 4.3.

Open the READ folder.

1_ 17

Select the corresponding size code to open.

1_ 18

1_ 19

Call the radio.read() function to receive data.

1_ 21

And it can display the received data on the screen.

1_ 23

Among them, the first and second parameters in the show_test function interface are the resolutions of products of different sizes used.

1_ 20

The third parameter is the starting coordinate of the horizontal axis displayed on the screen (0-800)

It can be observed that the maximum range of the starting horizontal and vertical coordinates should not exceed the maximum resolution.

Please reserve a certain spatial distance to display the text.

7.0 '' 5.0 '' 4.3 '' Horizontal coordinate range: 0-800

3.5 '' horizontal axis range: 0-480

2.8 '' and 2.4 '' horizontal axis range: 0-320

1_ 22

The fourth parameter is the starting coordinate of the vertical axis displayed on the screen. (0-480)

7.0 '' 5.0 '' 4.3 '' Vertical coordinate range: 0-480

3.5 '' vertical coordinate range: 0-320

2.8 '' and 2.4 '' vertical coordinate range: 0-240

1_ 24

The fifth parameter is the text content that needs to be displayed at the starting coordinates you have set.

1_ 26

Set up the code running environment and subsequently upload the code.

1_ 25

1_ 27

The precautions are the same as the above operation.

1_ 28

You can see that Hello World has received it.

1_ 30

4 Results Display


The code upload is complete. Next, let's see the actual effect.

After waiting for the code upload to complete, insert the nRF2401 wireless module into the W-M slot.

1_ 31

Send messages using the 4.3 - inch device and receive messages using the 7.0 - inch device.

1_ 29