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.

image-20260604183015430

1 Framework


Click the link below to download the code used in this lesson.

CrowPanel-Advance-2.4-HMI-ESP32-S3-AI-Powered-IPS-Touch-Screen-320x240/example/V1.1_and_V1.2/Arduino_Code/lesson-06 at master · Elecrow-RD/CrowPanel-Advance-2.4-HMI-ESP32-S3-AI-Powered-IPS-Touch-Screen-320x240

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.

We use a size of 2.4 as a role for sending messages and a size of 3.5 as a role for receiving messages.

img

2 An nRF2401 is responsible for sending messages


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

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.

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

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 2.4 inches.

1_15

3 An nRF2401 is responsible for receiving messages


You can click the link below to download the corresponding version of the code for this lesson.

(Lesson06)Code link:

2.8-inch / 2.4-inch V1.0

https://github.com/Elecrow-RD/CrowPanel-Advance-2.8-HMI-ESP32-S3-AI-Powered-IPS-Touch-Screen-320x240/tree/master/example/V1.0/Arduino_Code

2.8-inch / 2.4-inch V1.1/V1.2

https://github.com/Elecrow-RD/CrowPanel-Advance-2.8-HMI-ESP32-S3-AI-Powered-IPS-Touch-Screen-320x240/tree/master/example/V1.1_and_V1.2/Arduino_Code

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

Open the READ folder.

Select the corresponding size code to open.

image-20260604183358441

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

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.

img

Send messages using the 2.4-inch device and receive messages using the 3.5-inch device.

img

If your code compiles incorrectly, you can check if the ESP32 version number is correct. The ESP32 version number we need for this lesson is 3.0.2.

new-1

Secondly, please pay attention to replacing the corresponding size library file.

Select the appropriate library file based on the product screen size

Click the link below to download the relevant library files.

Library file link:

CrowPanel-Advance-2.4-HMI-ESP32-S3-AI-Powered-IPS-Touch-Screen-320x240/example/V1.1_and_V1.2/Arduino_Code/libraries at master · Elecrow-RD/CrowPanel-Advance-2.4-HMI-ESP32-S3-AI-Powered-IPS-Touch-Screen-320x240

If you are not sure where to place the library files and how to configure them properly so that the code can correctly recognize these library files, please refer to the operation steps in the first lesson.