Grade 10 · Connected devices

Set up your ESP32 and blink an LED

Connect the classroom ESP32 to Arduino IDE, prove that it runs your code, and control an external LED.

For this lesson

4 pages · Use the handout for the complete instructions, examples and response spaces.

Related assignments

Submit in Toddle. The assignment instructions above specify what to hand in.

Work through the lesson

1. Install Arduino IDE and ESP32 support

Open Arduino IDE 2 on the Windows computer. In File → Preferences, add https://espressif.github.io/arduino-esp32/package_esp32_index.json to Additional Boards Manager URLs. Open Boards Manager, search for esp32, and install “esp32 by Espressif Systems”.

2. Select your board and port

Connect the classroom ESP32-WROOM board with a USB data cable. Select ESP32 Dev Module. Choose its COM port under Tools → Port. To identify the port, compare the list with the board unplugged and plugged in; the newly appearing port belongs to your board.

3. Prove the connection with Serial Monitor

Upload this sketch, open Serial Monitor and set it to 115200 baud. You should see “My ESP32 works!” repeat.

void setup() {
  Serial.begin(115200);
}

void loop() {
  Serial.println("My ESP32 works!");
  delay(1000);
}

4. Wire the external LED

Use the ESP32, breadboard, LED, a 220Ω or 330Ω resistor, and jumper wires. Connect GPIO 23 → resistor → the LED’s long positive leg. Connect the short negative leg → GND. The resistor is in series with the LED.

5. Upload the blink program

Upload the sketch below. The LED should stay on for one second, off for one second, and repeat. LED names GPIO 23; pinMode makes it an output; digitalWrite sets its level; delay pauses for a number of milliseconds.

const int LED = 23;

void setup() {
  pinMode(LED, OUTPUT);
}

void loop() {
  digitalWrite(LED, HIGH);
  delay(1000);
  digitalWrite(LED, LOW);
  delay(1000);
}

6. Change the pattern

Try making the blink five times faster. Then try two quick flashes followed by a longer pause, an SOS pattern of short and long flashes, and your own repeating signal. Ask a partner to describe your pattern before seeing the code.

7. Troubleshoot one thing at a time

If no port appears, check the USB connection and data cable. If upload fails, check the selected board and port and ask for help with the BOOT button. If the code uploads but the LED does not light, check its direction, GPIO number, GND connection and breadboard rows. Change one thing at a time.

8. Explain the system

Describe how code makes the microcontroller produce an electrical signal and a physical output. An ESP32 controlling an LED is an embedded system; the connected-service part of the IoT project comes later.

Keep this evidence

  • A successful Serial Monitor test
  • A working external LED blink
  • Modified light patterns
  • An explanation of code → microcontroller → signal → output
Read the handout text online

For diagrams, visual examples and the full layout, open the handout above.

ESP32: SETUP + FIRST BLINK

GRADE 10 DESIGN • HARDWARE LAB 01

MISSION: Get your Windows computer talking to the ESP32, prove your code is running, then control a real LED.

✓ IDE READY✓ BOARD FOUND✓ SERIAL WORKS✓ LED BLINKS

LAB RULE: USB power only today. Do not connect batteries, motors, relays, or unknown voltages. ESP32 GPIO uses 3.3 V logic.

1SET UP ARDUINO IDE
1Open Arduino IDE 2.
2File → Preferences → Additional Boards Manager URLs.
3Paste the URL below and click OK.
https://espressif.github.io/arduino-esp32/package_esp32_index.json
4Tools → Board → Boards Manager → search "esp32".
5Install "esp32 by Espressif Systems".
2CONNECT YOUR ESP32
1Plug the ESP32 into the computer with a USB-C DATA cable.
2Tools → Board → ESP32 Arduino → ESP32 Dev Module.
3Tools → Port → select the COM port that appears when your board is plugged in.

TIP: unplug the board, check the port list, plug it back in. The new COM port is usually yours.

3PROVE THE CONNECTION

Upload this before wiring anything:

void setup() { Serial.begin(115200);}void loop() { Serial.println("My ESP32 works!"); delay(1000);}

Open Tools → Serial Monitor and set 115200 baud. You should repeatedly see:

My ESP32 works!My ESP32 works!My ESP32 works!

CHECKPOINT: Show this working before moving on.

4WIRE ONE EXTERNAL LED
FROMTONOTE
GPIO 23220Ω / 330Ω resistorlimits current
resistorLED long leg (+)positive
LED short leg (−)GNDnegative
USB-Ccomputerpower

LED polarity: LONG leg = + (anode). SHORT leg = − (cathode).

5MAKE IT BLINK
const int LED = 23;void setup() { pinMode(LED, OUTPUT);}void loop() { digitalWrite(LED, HIGH); delay(1000); digitalWrite(LED, LOW); delay(1000);}
const int LED = 23;Give GPIO 23 the name LED.
pinMode(LED, OUTPUT);Make the pin an output.
digitalWrite(LED, HIGH);Turn the output ON.
delay(1000);Wait 1000 ms = 1 second.

STOP FOLLOWING INSTRUCTIONS

LEVEL 1 — FASTMake the LED blink five times faster.
LEVEL 2 — HEARTBEATMake: flash-flash … pause … repeat.
LEVEL 3 — SOSSignal ... --- ... with short and long flashes.
LEVEL 4 — YOUR SIGNALInvent your own repeating pattern.
6TROUBLESHOOT LIKE AN ENGINEER
NO COM PORTUnplug/replug → different USB port → different DATA cable → different ESP32 → Device Manager.
UPLOAD STUCK AT CONNECTINGCheck board and COM port. If needed, hold BOOT as upload begins; release when it starts connecting.
LED DOESN'T LIGHTCheck LED direction → GPIO 23 → GND → resistor → breadboard row → try another LED.
SERIAL TEXT IS GARBLEDSet Serial Monitor to 115200 baud.

EXIT CHECK

□ Arduino IDE + ESP32 board package installed

□ Correct board and COM port selected

□ Serial Monitor test works

□ External LED blinks

□ I completed at least one challenge

Is this IoT yet? NO — today you built an embedded system. Soon: sensor → ESP32 → Wi-Fi → service/user.

One thing I got working: ________________________________________________

One thing I want to try next: _____________________________________________