Level 3Unit A · Session 1
1

Unit A · On the network

A new board

What we are making: nothing new — a blink. But on a board you have never used, through a toolchain that is not yet installed. That is the whole session, and it is not a waste of one.

Photo: an ESP32 dev board next to an Arduino Uno for scale, both on the bench
Photo: an ESP32 dev board next to an Arduino Uno for scale, both on the bench

The idea

Every professional project starts exactly like this: get the smallest possible thing running on the real hardware, before you write a line of the thing you actually care about. If you cannot blink an LED, nothing you write afterwards will tell you anything useful, because you will never know whether the problem is your code or your setup.

New words
ESP32The board. Dual core, WiFi and Bluetooth built in, 3.3V.
Board managerThe part of the IDE that knows how to compile for a particular chip.
GPIOGeneral Purpose Input Output — a numbered pin. GPIO 2, not 'pin 2 on the header'.
ToolchainEverything between your text and the running board: compiler, uploader, drivers.
Boot modeThe state the chip is in while it starts. Some boards need a button held.

Install the board support

Once per computer. It takes a while and downloads a few hundred megabytes, so start it and read on while it runs.

  1. Open the Arduino IDE. Go to File → Preferences.
  2. In Additional Board Manager URLs, paste the ESP32 URL your teacher gives you. Click OK.
  3. Go to Tools → Board → Boards Manager. Search esp32.
  4. Install esp32 by Espressif Systems. Wait. It really does take that long.
  5. Now Tools → Board → ESP32 Arduino → ESP32 Dev Module.
  6. Plug the board in. Tools → Port — pick the one that appeared when you plugged it in.
⚠ Careful
If no new port appears when you plug the board in, it is almost always one of two things: a charge-only USB cable, or a missing USB-to-serial driver (CP210x or CH340 — your teacher will know which your boards use). Try a different cable first. It is free.

The code

Familiar, with one difference: the pin number.

Your program
1const int LED = 2; // the onboard LED on most ESP32 boards
2 
3void setup() {
4 Serial.begin(115200); // faster than the Uno's 9600. Set the monitor to match.
5 pinMode(LED, OUTPUT);
6 Serial.println("Board is alive");
7}
8 
9void loop() {
10 digitalWrite(LED, HIGH);
11 delay(500);
12 digitalWrite(LED, LOW);
13 delay(500);
14}
  • Line 1 — const int means a number with a name that never changes. Better than typing 2 everywhere.
  • Line 4 — 115200, not 9600. The ESP32 talks faster. If your serial monitor is set to 9600 you get unreadable rubbish, and it looks like the board is broken.
  • Line 6 — print something in setup(). Now you can always tell a fresh boot from a frozen board.
Pins used2GND3V3

Try it

Press upload. Watch the output window. On many ESP32 boards you will see Connecting........ and then it goes.

Upload output — this is what success looks like
Connecting........_____
Chip is ESP32-D0WD-V3 (revision v3.0)
Writing at 0x00010000... (100 %)
Hard resetting via RTS pin...
🔧 If it goes wrong
If it sits on Connecting........_____ and fails: hold down the BOOT button on the board, press upload, and keep holding until you see 'Writing at'. Some boards need this every single time. It is normal and it is not your fault.

What breaks it

Three things, and you will meet all three today or in Session 2.

What you seeWhyWhat to do
Unreadable characters in the monitorBaud mismatch.Set the monitor dropdown to 115200.
Connecting........ then timeoutBoard not in boot mode, or bad cable.Hold BOOT while uploading. Then try another cable.
Uploads fine, nothing blinksYour board's LED is not on GPIO 2.Try 2, then 5, then 16. Or wire an external LED with a 220Ω resistor.
Board resets over and overBrown-out — not enough current from that USB port.Use a different port, or a powered hub. Laptop front ports are often weak.

What you learned

  • Prove the toolchain before you build anything on it.
  • The ESP32 is 3.3V and talks at 115200.
  • A print in setup() tells you a boot happened. You will use that all year.
  • 'It will not upload' is usually cable, port or boot button — rarely code.
Challenge optional — only if you finish early
  • Find out how much memory the ESP32 has compared with the Uno. Write down both numbers.