Skip to content

Lesson01_Serial_Communication: Serial Output of Hello World

1. Course Introduction

This lesson uses the ESP32-S3 USB serial interface to initialize serial communication at 115200 bit/s, output Hello World once immediately after the device starts, and then repeat the output approximately every 1 second. Learners will open the project, compile and upload it, and observe the Serial Monitor, establishing the serial debugging methods required for subsequent lessons.

2. Learning Objectives

  • Select the ESP32-S3 development board and the correct serial port in the Arduino IDE.
  • Explain the relationship between Serial.begin(115200) and the baud rate of the Serial Monitor.
  • Compile and upload the program, and determine whether the startup output and periodic output are normal.

3. Preparation

  • One ESP32-S3 2.1-inch development board.
  • One USB cable that supports data transfer; connect it to the board's native USB/serial interface.
  • Arduino IDE (version to be supplemented based on the actual environment) and ESP32 Arduino Core (version to be supplemented).
  • Project file /Examples/2.1_Lesson01-Print_Hello_World/Lesson01-Print_Hello_World.ino.

Code download link: https://github.com/Elecrow-RD/CrowPanel-2.1inch-HMI-ESP32-Rotary-Display-480-480-IPS-Round-Touch-Knob-Screen/tree/master/example/Arduino/Examples/

4. Software Operation Steps

When using the board for the first time, complete the configuration in the order described in this section. First confirm the development environment and project, then connect the hardware, select the board and port, and finally compile and upload.

4.1 Confirm the Arduino IDE Version

Launch the Arduino IDE, open Help > About Arduino IDE, and confirm that you are using Arduino IDE 2.x. The version number shown in the screenshot is for demonstration only, and does not need to match the screenshot exactly.

Software installation: Download_Arduino_IDE - Elecrow Wiki

4.2 Install the ESP32 Board Support Package

After the installation is completed, open the Arduino IDE. First, randomly open a project.

lesson01_1

Go to "Preferences"

lesson01_2

Configure "Additional Boards Manager URLs"

lesson01_3

Add this in

https://jihulab.com/esp-mirror/espressif/arduino-esp32/-/raw/gh-pages/package_esp32_index_cn.json

Remember to save!

lesson01_4

  1. Click Board Manager on the left side.
  2. Search for esp32.
  3. Locate esp32 by Espressif Systems, select the version required by the course, and install it.
  4. After installation, close the Board Manager; if the corresponding version already shows as installed, there is no need to reinstall.

The reference image shows the entry point, search, and version status of the Board Manager. For this P4 lesson, version 3.3.8 should be installed.

lesson01_5

4.3 Create or Open the Complete Project

In the Arduino IDE, select File > New Sketch and save it as Lesson01-Print_Hello_World; alternatively, you can directly open Lesson01-Print_Hello_World.ino from the course code.

An Arduino sketch requires the project folder name to match the main .ino file name. For example:

Lesson01-Print_Hello_World/
└── Lesson01-Print_Hello_World.ino

If the IDE prompts you to automatically create a folder with the same name, confirm and proceed.

lesson01_6

Write the following code into the sketch and save it:

void setup() {
  Serial.begin(115200);
  delay(300);
  Serial.println("Hello World");
}

/**
 * @brief Print a heartbeat message at a readable interval.
 *
 * @return Nothing.
 * @note Called repeatedly by the Arduino framework.
 */
void loop() {
  delay(1000);
  Serial.println("Hello World");
}

4.4 Connect the Board Using USB

Connect a USB-C cable that supports data transfer to the port labeled USBoard, then connect it to your computer.

lesson01_7

4.5 Select the Board and Port

Open Tools > Board > esp32 and select ESP32S3 Dev Module.

lesson01_8

Then open Tools > Port and select the COM port that newly appears after connecting the board. If you are unsure which port to choose, unplug the data cable to observe which port disappears, then reconnect and select the port that reappears.

4.6 Verify the Upload Parameters

Check each item in the Tools menu:

  • Board: ESP32S3 Dev Module
  • USB CDC On Boot: "Enabled"
  • Flash Mode: QIO 80MHz
  • Flash Size: 16MB (128Mb)
  • Partition Scheme: elecrow_s3 (10.0MB APP with OTA/1.31MB SPIFFS)
  • PSRAM: "OPI PSRAM"
  • Upload Mode: UART0 / Hardware CDC
  • USB Mode: Hardware CDC and JTAG
  • Port: the COM port that actually corresponds to the board

lesson01_9

4.7 Import the Library Files We Need to Use

Open File > Preferences and note the "Sketchbook location".

lesson01_10

Close the Arduino IDE, then confirm that the libraries folder exists in that directory.

lesson01_11

Library file link for this project: https://github.com/Elecrow-RD/CrowPanel-2.1inch-HMI-ESP32-Rotary-Display-480-480-IPS-Round-Touch-Knob-Screen/tree/master/example/Arduino/Examples/

After determining the location where the library files are stored Copy all the library files contained in the downloaded "libraries" file to the "C:\Users\Username\Documents\Arduino\libraries" folder on your local computer.

lesson01_12

How to add the library files: https://www.elecrow.com/wiki/Arduino_IDE_Library_Import_Guide.html

Note: The course dependency libraries need to be placed in the libraries directory under the Arduino Sketchbook folder. After copying is complete, restart the Arduino IDE to prevent the IDE from continuing to use the old library index.

Note: If there is no "libraries" folder in your path, please create one yourself.

4.8 Verify Compilation Before Uploading

  1. Click the Verify (checkmark) button in the upper left corner.
  2. Wait for the output area to show that compilation is complete; if errors appear, resolve them first and do not upload directly.
  3. Click the Upload (right arrow) button.
  4. Wait until writing reaches 100%, and see the upload complete or auto-reset message.

lesson01_13

If it stays stuck at Connecting... for a long time, first confirm the UART0 connection, the data cable, and the COM port; if it still cannot connect, hold down the BOOT button on the board and release it once writing begins.

4.9 Open the Serial Monitor to Verify the Result

Click the Serial Monitor in the upper right corner and set the baud rate to 115200. The baud rate must match Serial.begin(115200).

lesson01_14

lesson01_15

Under normal conditions, the monitor will continuously display:

Hello World
Hello World
Hello World
Hello World

Adjacent lines are spaced about 1 second apart.

5. Hardware Operation Steps

  1. With the power off, check that the USB cable is securely connected, then connect the development board to the computer. Use an interface that supports data transfer; do not use a charge-only cable. Connect the development board
  2. After the upload is complete, wait for the development board to reset and observe the first Hello World in the Serial Monitor. Observe the startup output

6. Explanation of Key Code

void setup() { Serial.begin(115200); delay(300); Serial.println("Hello World"); }
void loop() { delay(1000); Serial.println("Hello World"); }
  • setup() executes only once after power-on or reset. Serial.begin(115200) configures the serial communication speed. The Serial Monitor must use the same speed; otherwise, garbled text will appear.
  • delay(300) provides a short interval for the USB serial connection to initialize and the monitor to open. The program will usually still run if it is removed, but the earliest startup message may be missed.
  • loop() executes repeatedly. It outputs once after a 1000 ms delay, so during stable operation there should be approximately one line per second.
  • When 115200 is changed to another value, the Serial Monitor must be changed accordingly. Modifying only one side will result in garbled text. Changing delay(1000) to delay(200) produces a higher output frequency, but logs should not be sent too densely for extended periods.

7. Experimental Results

After uploading and resetting, the Serial Monitor should display Hello World at a baud rate of 115200. The program then outputs one line of the same text approximately every 1 second. If there is no output, first check the serial port number, the monitor baud rate, whether the USB cable supports data transfer, and whether the development board has been reset.

8. Code Download

https://github.com/Elecrow-RD/CrowPanel-2.1inch-HMI-ESP32-Rotary-Display-480-480-IPS-Round-Touch-Knob-Screen/tree/master/example/Arduino/Examples/