Meet the ESP32 Dev Board
Welcome to the first lesson of the course. You are holding (or about to order) a small blue board with a metal square on it. Before you write a single line of code, let's make sure you know what is on that board, how it gets its power, and which of those many pins you are allowed to touch. Ten minutes of orientation here saves hours of confusion later.
Learning Objectives
By the end of this lesson you will be able to:
- Point to the main parts of an ESP32-WROOM dev board and say what each one does.
- Power the board safely from a USB port and explain what the on-board regulator is for.
- Explain why the ESP32 uses 3.3 V logic and what happens if you feed it 5 V.
- Pick safe GPIO pins for a LED, a button, and a sensor.
- Name the pin groups you must avoid (flash pins, strapping pins, input-only pins).
Theory: What "ESP32" Really Means
The word "ESP32" is used for three different things, and mixing them up causes real confusion.
| Level | What it is |
|---|---|
| Chip | The Espressif ESP32 silicon: dual-core 240 MHz, Wi-Fi, Bluetooth Classic and BLE, lots of GPIO. |
| Module | The ESP32-WROOM-32: the chip plus flash memory, a crystal, and a PCB antenna, inside a metal shield can. |
| Dev board | The module soldered onto a larger PCB with USB, a regulator, buttons, and header pins. This is what you plug in. |
You bought a dev board. The module on it is what actually runs your code and talks BLE to a phone.
A tour of the board
flowchart LR
USB["🔌 Micro USB port<br/>5 V in"] --> REG["⚙️ 3.3 V regulator"]
USB --> UART["💬 USB-serial chip"]
REG --> MOD["📶 ESP32-WROOM module<br/>240 MHz, Wi-Fi + BLE"]
UART --> MOD
REG --> HDR["🧩 3V3 pin on the header"]
MOD --> GPIO["📍 GPIO header pins"]
The parts you should be able to name:
- Micro USB port: power in, and the data link to your computer.
- USB-serial chip (CP2102 or CH340, depending on the board): translates USB into the serial port that will show your debug messages in the next lesson.
- 3.3 V regulator: drops the 5 V from USB down to the 3.3 V the chip needs.
- EN button: reset. Pressing it restarts your sketch.
- BOOT button: connected to GPIO 0. Hold it while pressing EN to force the chip into bootloader mode (the mode used for flashing).
- Onboard LED: usually on GPIO 2 on ESP32 dev boards. Handy for a first blink test.
- Header pins: the labelled rows of pins where you connect things.
Powering the board safely over USB
Plug the board into any standard USB port and you are done. That is the whole procedure for now.
Behind that simple step, two numbers matter:
- A USB 2.0 port typically supplies about 500 mA.
- The ESP32 draws roughly 40 to 80 mA when idle, but spikes to around 240 mA in short bursts when the radio transmits.
So a normal USB port has plenty of headroom for the board alone. What it does not have headroom for is a motor, a servo, or a bright LED strip. Those need their own power supply.
There is also a 3V3 pin on the header that outputs the regulated 3.3 V. You can use it to power a small sensor (a few tens of milliamps), but it is not a power supply for heavy loads.
[!WARNING] Never feed 5 V into the 3V3 pin or into any GPIO. The ESP32 is a 3.3 V device and 5 V on a data pin can destroy it. The pin labelled VIN or 5V is the input side of the regulator, not a safe place to connect a signal.
Which pins can you use?
This is the part beginners get wrong most often. The ESP32 has many GPIO pins, but not all of them are yours to use freely.
| Group | Pins | Rule |
|---|---|---|
| Connected to internal flash | GPIO 6 to 11 | Never use. The board will crash or fail to boot. |
| Input only | GPIO 34, 35, 36, 39 | Can read signals, cannot drive outputs, and have no internal pull-up resistors. |
| Strapping pins | GPIO 0, 2, 5, 12, 15 | Read at boot to choose boot mode or flash voltage. Usable, but avoid pulling them the wrong way at power-up. GPIO 12 held high can stop the board booting. |
| Serial debug | GPIO 1 (TX0), GPIO 3 (RX0) | Used by the USB-serial link. Leave them alone if you want serial output. |
| Safe general purpose | GPIO 4, 13, 14, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32, 33 | Your default choices for LEDs, buttons, I2C and SPI. |
Two more rules of thumb for your future gadget:
- Keep any single pin at or below about 12 mA. The absolute maximum is 40 mA, but staying low keeps the chip cool and reliable.
- GPIO 21 and GPIO 22 are the usual I2C pins (SDA and SCL) on ESP32 boards.
Worked Examples
Example 1: Choosing a resistor for a LED
You want a red LED (forward voltage about 2.0 V) on GPIO 25, driven at 3.3 V.
$$ I = \frac{3.3 - 2.0}{220} \approx 0.0059\ \text{A} = 5.9\ \text{mA} $$
5.9 mA is comfortably under the 12 mA guideline, so a 220 Ω resistor is a safe choice. With a 100 Ω resistor you would get about 13 mA, which is above the guideline.
Example 2: Reading a 5 V sensor
Your sensor outputs 0 to 5 V. The ESP32 input must never see more than 3.3 V, so you build a divider with R1 = 10 kΩ on top and R2 = 20 kΩ to ground:
$$ V_{out} = 5 \times \frac{20}{10 + 20} = 3.33\ \text{V} $$
3.33 V is right at the limit. Use R1 = 10 kΩ and R2 = 15 kΩ instead if you want margin (that gives 3.0 V), or use a proper level shifter.
Example 3: Planning the pins for your BLE gadget
Say the gadget is: one status LED, one push button, one I2C sensor.
- LED: GPIO 25 (safe general purpose, not a strapping pin).
- Button: GPIO 27, wired from the pin to GND, using the internal pull-up (
INPUT_PULLUP). Do not use GPIO 34 to 39 for this unless you add an external resistor. - Sensor: SDA on GPIO 21, SCL on GPIO 22.
- Nothing on GPIO 6 to 11, and nothing on GPIO 1 or 3 if you want serial debug.
Discussion & Reflection
- Look at your own board. Can you find the EN button, the BOOT button, and the 3V3 pin without checking this lesson again?
- Why do you think the ESP32 has an input-only pin group at all, instead of making every pin identical?
- If your gadget also needs a small servo, where would you get its power from, and why not from the 3V3 pin?
Expert Corner
- Check your USB cable first. Many cables are charge-only and carry no data. If the board powers up but the computer never sees a port, try another cable before suspecting the board.
- Silkscreen labels lie a little. Some boards print "D2" instead of "GPIO 2". Look up the pinout diagram for your exact board revision once, and write the mapping down.
- Strapping pins are not forbidden, just fussy. GPIO 2 for a LED is fine, since the LED circuit does not force the pin high at boot. A button that pulls GPIO 12 to 3.3 V is a problem.
- Power the board before you connect signals, then check that nothing gets warm. Warm means something is wrong.
- Do not power motors from the board. Use a separate supply and connect the grounds together.
Check your understanding of the key facts:
The ESP32 GPIO pins use {{c1::3.3 V}} logic and are not 5 V tolerant.
GPIO pins {{c2::6 to 11}} are wired to the internal SPI flash and must never be used.
GPIO {{c3::34, 35, 36 and 39}} are input only and have no internal pull-up resistors.
5 V from USB is stepped down to 3.3 V by the on-board {{c4::linear regulator}}.
Holding the {{c5::BOOT}} button (GPIO 0) low while pressing EN puts the chip into bootloader mode.
The ESP32 draws short current peaks of about {{c6::240 mA}} when its radio transmits, well within a USB port's 500 mA.
Summary & Next Steps
You now know the three meanings of "ESP32", the parts of your board, how it is powered, and which pins are safe. In short: 3.3 V logic only, avoid GPIO 6 to 11, treat strapping pins with care, and keep pin current low.
Next lesson, Install PlatformIO and Flash a Blink Sketch, takes this knowledge and puts it to work: you will install PlatformIO inside VS Code, create a project for your exact board, and upload your first sketch to blink that LED on GPIO 2.
[
{ "front": "What are the three things people call \"ESP32\"?", "back": "The chip, the ESP32-WROOM module, and the dev board that carries the module." },
{ "front": "What logic voltage do ESP32 GPIO pins use?", "back": "3.3 V. They are not 5 V tolerant." },
{ "front": "Which GPIO range is connected to the internal SPI flash?", "back": "GPIO 6 to 11. Never use them." },
{ "front": "Which GPIO pins are input only?", "back": "GPIO 34, 35, 36 and 39. They also have no internal pull-ups." },
{ "front": "What do the EN and BOOT buttons do?", "back": "EN resets the chip. BOOT (GPIO 0) held low during reset enters bootloader mode." },
{ "front": "Which GPIO does the onboard LED usually use?", "back": "GPIO 2 on most ESP32 dev boards." },
{ "front": "How much current does a USB 2.0 port supply, and what does the ESP32 peak at?", "back": "About 500 mA from USB, against ESP32 peaks of roughly 240 mA during radio transmission." },
{ "front": "What is a strapping pin?", "back": "A pin read at boot to select boot mode or flash voltage: GPIO 0, 2, 5, 12 and 15." },
{ "front": "Why is GPIO 12 risky at power-up?", "back": "It sets the flash voltage. Held high at boot, the board may fail to start." },
{ "front": "Name five safe general purpose GPIO pins.", "back": "Any of 4, 13, 14, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32, 33." },
{ "front": "LED math: 3.3 V pin, 2.0 V red LED, 220 ohm resistor. Current?", "back": "I = (3.3 - 2.0) / 220 = 5.9 mA, a safe value for a GPIO." },
{ "front": "How do you connect a 5 V sensor output to an ESP32 input?", "back": "Use a level shifter or a resistor divider, for example 10 kohm and 20 kohm." },
{ "front": "Which radios does the ESP32 chip include?", "back": "Wi-Fi plus Bluetooth Classic and BLE, on a 240 MHz dual-core CPU." },
{ "front": "Which GPIOs carry the USB-serial debug link?", "back": "GPIO 1 (TX0) and GPIO 3 (RX0)." }
]