What you will learn
- Install support for a classic ESP32 and select its board and port.
- Distinguish compiling a sketch from uploading it to a device.
- Explain setup(), loop(), and serial communication.
- Change a message and reporting interval, then check the result.
Before you start
No programming experience is required. Basic familiarity with files and installing software on a computer is sufficient.
Reference setup
- Board in Arduino IDE
- ESP32 Dev Module
- Arduino-ESP32
- 3.3.12
- Serial Monitor
- 115200 baud
This is a reference profile, not an identification of the pictured board. Adapt the GPIO mapping and verify the circuit before using ESP32-C3/S2/S3 or a differently labelled board.
What you will build
Connect an ESP32 to a computer and run a program that sends a greeting, followed by information approximately once per second. Watch a message counter and elapsed time: your first demonstration of loading a program and observing its output.
There is no external circuit in this course. The activity does not depend on whether your development board has a programmable built-in LED. The computer displays the messages; the program runs on the ESP32.
Learning objectives
- Prepare Arduino IDE for a classic ESP32 board.
- Distinguish the board selection from the communication port.
- Upload a sketch and use Serial Monitor.
- Explain the roles of
setup()andloop(). - Change a message and its reporting interval.
Prerequisites
No programming experience is required. You should be able to download files and extract archives. Allow about 60 minutes; installation may take longer on a slow connection.
The reference hardware is a development board with a classic ESP32/ESP32-WROOM-32. This profile does not cover ESP32-C3, S2, or S3 boards, which need a separately adapted board selection and wiring profile for subsequent courses.
Equipment
| Component | Quantity | Specification and notes |
|---|---|---|
| Development board with a classic ESP32-WROOM-32 module | 1 | Match the reference GPIO labels; check physical header positions on the actual board. |
| USB data and power cable | 1 | Use the connector fitted to your board; the pictured kit lists Micro-USB. |
Use a USB cable that carries data. A charging-only cable can power the board without providing a communication port. Arduino recommends checking the cable and connecting directly to the computer when a board is not detected: USB connection checks.
How it works
An Arduino program is often called a sketch. The IDE translates its text into instructions the ESP32 can execute, then transfers those instructions to the device. Verify checks compilation; Upload also transfers the program. Successful verification alone does not show that the sketch reached the board or behaved correctly.
setup() prepares the program each time it starts. After that, loop() repeats. Serial communication lets us inspect information produced by the program. The speed selected in the sketch and in Serial Monitor must match: this course uses 115200 baud.
Connections
Wiring diagram
The drawing shows electrical connections by GPIO label, not the board’s physical header layout. Power the board through USB.
| From | To | Connection |
|---|---|---|
COMPUTER.USB | ESP32.USB | USB data cable provides power and serial communication. |
- Place the board on a clean, nonconductive surface and remove jumper wires from its pins.
- Connect the appropriate USB plug to the board and the other end directly to the computer.
- Wait for the operating system to detect the device.
USB is the only power source in this activity. Do not connect an additional supply. Check connector and button labels on your own board. Espressif's DevKitC guide describes typical USB, EN, and BOOT functions.
Arduino setup
- Install Arduino IDE 2.x from the official Arduino website.
- Open Preferences and add
https://espressif.github.io/arduino-esp32/package_esp32_index.jsonto Additional Boards Manager URLs. - In Boards Manager, find “esp32 by Espressif Systems” and select version 3.3.12, the target version for this course package. See Espressif's installation instructions.
- Select ESP32 Dev Module and the port belonging to the connected board. If unsure, compare the port list before and after disconnecting its USB cable.
- Download the Arduino example (.zip) and extract it. Keep
first_program.inoinside the folder namedfirst_program, then open it.
No additional libraries are required. The board selection determines how to compile the program; the port identifies the connected device. These are separate settings even when the IDE presents them together: Arduino board and port selection.
Program
The displayed sketch and downloadable file share the same source. Run the original before saving a separate copy for experiments.
#include <Arduino.h>
constexpr uint32_t REPORT_INTERVAL_MS = 1000;
uint32_t lastReportMs = 0;
uint32_t counter = 0;
void setup() {
Serial.begin(115200);
Serial.println("Hello from WB Maker Bridge!");
Serial.println("ESP32 is ready. Watch the counter and uptime.");
lastReportMs = millis();
}
void loop() {
const uint32_t now = millis();
// Subtraction keeps this timer working across millis() rollover.
if (now - lastReportMs >= REPORT_INTERVAL_MS) {
lastReportMs = now;
counter++;
Serial.print("Counter: ");
Serial.print(counter);
Serial.print(" | Uptime (s): ");
Serial.println(now / 1000);
}
}
Code walkthrough
Find Serial.begin(115200) near the beginning. It configures serial communication. The greeting is printed during setup, so it does not appear on every pass through loop().
The program remembers when it last sent a periodic message. millis() provides elapsed milliseconds. The difference between the current and previous time is compared with REPORT_INTERVAL_MS. One thousand milliseconds equal one second. Once the interval has elapsed, the program prints a new line and updates the saved time. This approach leaves the loop available for other activities; Arduino's Blink Without Delay example illustrates the same scheduling principle.
The message counter and elapsed seconds mean different things. They initially increase at similar rates because one message is sent every second. Changing the reporting interval changes their relationship.
Run and expected results
Click Verify and wait for compilation to finish successfully. Click Upload. Once the transfer finishes, open Serial Monitor from Tools and select 115200 baud. If you missed the greeting, briefly press EN/RESET with the monitor open.
You should see the greeting and new lines about once per second. Count five consecutive updates. Pressing reset restarts the program and restores its initial values. Closing the monitor is not an intentional reset command, although opening or changing a connection can reset some boards.
Observation record
| Action | What to record |
|---|---|
| Watch five periodic updates | Are they approximately one second apart? |
| Press EN/RESET | Does the greeting return and the counter restart? |
| Disconnect and reconnect USB | Does the stored program run without another upload? |
Troubleshooting
| Problem | Check and next step |
|---|---|
| No port appears | Try a known data cable and another USB socket. Check whether the operating system detects the device. |
| ESP32 Dev Module is missing | Confirm that the Espressif board package is installed. |
| Upload cannot access the port | Select the port again and close other applications using it. |
| Upload cannot connect | After checking cable and port, try holding BOOT while “Connecting” appears; release it when transfer starts. If manual download mode is required, hold BOOT, briefly press EN, then retry Upload. |
| Unreadable text | Select 115200 baud in Serial Monitor. |
| Empty monitor | Check the port, wait a few seconds, and press EN/RESET. |
Independent challenge
Save a copy of the sketch. Change the greeting to include your name and “WB Maker Bridge”. Then change the interval to two seconds. Before uploading, predict how many periodic messages you will receive in approximately ten seconds and how the elapsed-time value will change.
Check your understanding
- Which part runs once after a reset?
- Why is selecting the correct board insufficient for Upload?
- Does changing the reporting interval change how quickly time passes?
Answer guidance
For the challenge, change the greeting and set REPORT_INTERVAL_MS to 2000 milliseconds. Expect around five periodic messages in ten seconds. The counter advances by one while elapsed seconds advance by approximately two. Measure time from device startup.
Answers: setup() runs at startup; the port selects the connected device; the interval changes reporting frequency. Restore the original interval and repeat the upload independently before moving to the next course.
