ESP32 expansion board first test
Build it step by step
0 of 7 doneSeat the ESP32
USB end at the marked edge, pins lined up, press gently.
Wire the LED
Long leg through 330 ohms to the S terminal of GPIO23, short leg to G.
Wire the button
One leg to S of GPIO22, the other to G.
Connect USB
To the ESP32's own socket.
Upload the sketch
The LED blinks twice a second.
Open the Serial Monitor
At 115200.
Press the button
The count goes up by one each press.
How do you build an ESP32 expansion board first test?
A 38-pin ESP32 board sits in a screw-terminal expansion board, and a short sketch blinks an LED and counts button presses, as a first test of the board and its power supply. You need ESP32 expansion board (38-pin), ESP32 DevKit V1, LED 5 mm red, Resistor 330 Ω and Tactile push button 6 mm. It takes 7 steps and about 90 minutes.
- Level
- Beginner
- Time
- About 90 min
- Parts
- 5
Parts list
- InterfacesBuy
- Development BoardsBuyESP32 DevKit V1 × 1
- SemiconductorsBuyLED 5 mm red × 1
- PassivesBuyResistor 330 Ω × 1
- SwitchesBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| LED long leg | 330 ohm resistor to terminal S of GPIO23 | LED output |
| LED short leg | Terminal G beside it (GND) | Return |
| Button leg 1 | Terminal S of GPIO22 | Input with the internal pull-up |
| Button leg 2 | Terminal G beside it (GND) | Pressed pulls the pin low |
Code
An expansion board is a carrier for a 38-pin ESP32 development board that brings every pin out to screw terminals, usually in rows of signal, power and ground, so wires can be fixed without soldering or a breadboard. This test checks the whole chain: the board is seated the right way round, the USB cable and port work, the sketch uploads, an output pin drives an LED and an input pin reads a button. The LED blinks using a timer instead of a delay, so the program can still watch the button, and the button uses the internal pull-up, so it needs no resistor and reads low when pressed. The resistor protects the LED. Seat the ESP32 with its USB end at the marked edge of the board and do not force it, as pins that do not line up can bend. Power the setup from the ESP32's USB socket. If the expansion board has a barrel jack or voltage setting, leave it alone and do not connect an outside supply until you have read the board's own markings. Avoid pins that matter at start-up, such as GPIO0, 2, 12 and 15, for your own wires, and keep to the two pins used here.
Runs on a virtual ESP32 Dev Module in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
const int LED = 23;
const int BUTTON = 22;
int presses = 0;
bool lastButton = HIGH;
unsigned long lastBlink = 0;
bool ledState = false;
void setup() {
pinMode(LED, OUTPUT);
pinMode(BUTTON, INPUT_PULLUP);
Serial.begin(115200);
Serial.println("ESP32 expansion board test");
}
void loop() {
if (millis() - lastBlink >= 500) { // blink twice a second without blocking
lastBlink = millis();
ledState = !ledState;
digitalWrite(LED, ledState);
}
bool b = digitalRead(BUTTON);
if (b == LOW && lastButton == HIGH) {
delay(20); // short wait for the contacts to settle
if (digitalRead(BUTTON) == LOW) {
presses++;
Serial.print("Button presses: ");
Serial.println(presses);
}
}
lastButton = b;
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual ESP32 Dev Module with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
ESP32 expansion board test
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| After upload | LED blinks twice a second |
| Press the button | Count goes up by one |
| Hold the button | Only one count per press |
| Unplug and plug in | Blinks again, count back to zero |
| Look at the board | Power light on, nothing hot |
If it does not work
Port does not appear
Try another USB cable and install the CH340 or CP210x driver.
Upload fails
Hold BOOT while it connects.
LED never lights
Check the leg direction and that the wire is in the S terminal of GPIO23.
Count jumps
Check the button wiring and the common ground.
Board is hot
Unplug, check no terminal is shorted and the board is seated correctly.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the ESP32 expansion board first test?
ESP32 expansion board (38-pin), ESP32 DevKit V1, LED 5 mm red, Resistor 330 Ω and Tactile push button 6 mm.
How long does the ESP32 expansion board first test take to build?
About 90 minutes for a beginner maker, in 7 steps.
How do I know the ESP32 expansion board first test works?
After upload: LED blinks twice a second. Press the button: Count goes up by one. Hold the button: Only one count per press.
Port does not appear: what should I check?
Try another USB cable and install the CH340 or CP210x driver.
Upload fails: what should I check?
Hold BOOT while it connects.
LED never lights: what should I check?
Check the leg direction and that the wire is in the S terminal of GPIO23.
Count jumps: what should I check?
Check the button wiring and the common ground.
