ESP32 Microcontroller: The One With the Radio Onboard
The ESP32 is a microcontroller, a Wi-Fi radio and a Bluetooth radio on one chip. Understand what that changes in a circuit, then put it to work.
What is actually inside an ESP32
The ESP32 is one chip containing a processor, a Wi-Fi radio and a Bluetooth radio. The processor is a dual-core Xtensa LX6 running at 240 MHz with about 520 KB of SRAM and up to 4 MB of flash for your program. An Arduino Uno's ATmega328P gives you 16 MHz, 2 KB of SRAM and 32 KB of flash, and no radio at all.
The radio is why people buy it. The Wi-Fi is 2.4 GHz 802.11 b/g/n, so the board joins any ordinary router. The Bluetooth is 4.2 with Low Energy, which is what a phone or a beacon connects to. Both radios share one antenna through a single pin, so board layout and antenna placement matter far more here than on a plain Arduino. There is more silicon behind the pins as well: two DAC channels, touch sensing, an I2S audio interface, and hardware crypto accelerators. That last one matters more than it sounds: encrypting data in hardware takes a fraction of the time and energy of doing it in software, which is exactly what a battery node needs.
Three traps that account for most dead ESP32 boards
The first is voltage. The ESP32 runs at 3.3 V. An Arduino pin sits at 5 V when it is HIGH, so feeding a 5 V signal into an ESP32 pin pushes current through the chip's internal protection diodes until it gets hot and fails. Most beginner board deaths are this, not bad code. Use a level shifter or a 3.3 V supply for anything that talks to the chip.
The second is the analogue input. The ESP32 ADC is non-linear: the same 3.0 V can read differently depending on where it falls on the range, and the error is worst in the middle. Calibrate once by sweeping a known voltage across the input, store the correction in flash, and readings land within a few millivolts. Skip the calibration and a resistive divider can be wrong by a couple of volts. The third is a brownout reset. Drive a motor, a servo or a relay coil from the same 3.3 V rail and the inrush current drags the rail down far enough for the chip's brownout detector to reset it. The program restarts from the top and you lose whatever it was holding. Power the radio and the load from separate rails, join the grounds, and put a bulk capacitor near the board.
Step by step
-
Flash a blink and confirm the toolchain
Install the ESP32 board package in the Arduino IDE, or use the Arduino Cloud Editor, and get an LED blinking. That proves the USB driver, the boot loader and the flash all work before you add any complexity.
-
Measure the rails on your specific board
Put a multimeter on the 3V3 and 5V pins while the board runs. Cheap clone boards vary, and knowing the real numbers on your board saves hours of debugging later.
-
Read a sensor over I2C
A DHT or a BME280 over I2C proves the bus, the pull-up resistors and your wiring. Print the raw value and note what a normal reading looks like in your room.
-
Calibrate the analogue input
Sweep a known voltage across the ADC input, record the readings, and build a correction table. It is ten minutes of work that makes every later sensor reading trustworthy.
-
Publish one reading over Wi-Fi
Join your access point, then send a single number to a web page or an MQTT broker. One value travelling end to end teaches more than ten sensors sitting on the bench.
-
Put the board to sleep between readings
Use deep sleep and a timer wake-up, then measure how long the battery lasts. This is where the ESP32 earns its keep: a node that sleeps can run for months on the same cells.
What you'll need
| Item | Qty | Why |
|---|---|---|
| ESP32 DevKit board, 30-pin or 38-pin | 1 | A USB-C board with the radio already certified and a PCB antenna, so you are not hand-wiring an RF module. |
| USB-C data cable | 1 | Many cheap cables are charge only. A charge-only cable flashes nothing and looks exactly like a broken board. |
| DHT11 or DHT22 temperature and humidity sensor | 1 | Your first networked sensor. It is slow and digital, so it teaches timing and error handling more than signal conditioning. |
| HLK-PM01 buck converter module | 1 | Turns 5 V into a clean 3.3 V rail so you never feed 5 V into a GPIO pin by accident. |
| 18650 cell in a holder with protection | 1 | Deep sleep experiments need a supply that can be unplugged without resetting the board, and a protected holder matters with lithium cells. |
| Resistor assortment, 220 ohm to 10 kohm | 1 set | Current limiting for indicator LEDs and pull-up resistors for I2C, both of which you will need within the first hour. |
Practise it before you build it
Every step above has a matching circuit in the ThinkEdge Learn simulator. The simulator runs a real
Arduino sketch against a modified-nodal-analysis solver, so digitalWrite actually drives the
LED on screen and the readings change when you change the wiring — no hardware, no burnt components.
The Mega has 4 hardware serial ports (Serial, Serial1, Serial2, Serial3). That means you can talk to 4 different devices at the SAME time — like a GPS, a Bluetooth module, an XBee radio, and the USB. Use 3 of those ports to read 3 different sensors in parallel and stream their data to the Serial Monitor as a CSV row every second. This is the foundation of every real Arduino data logger.
A real Arduino project almost always involves a sensor + a way to see the data. The DHT11 reads temperature and humidity, and the Serial Monitor (the window in the Arduino IDE) shows the readings. The Nano is perfect for this because it plugs directly into a breadboard with no extra wiring for power — you can build a complete data logger in 5 minutes.
In factories, conveyor belts carry products past a sensor that counts them. A simple "break-beam" sensor (a light source + photodetector) registers each object as it passes. In this project, you'll simulate the conveyor with your hand: every time you press the button (mimicking a product passing the sensor), the counter increments and the LED blinks. Add a buzzer to beep once for every 10 items. This is the same logic as a people counter at a door, a coin counter at a bank, or a bottle counter on a bottling line.
The DHT11 is a small blue module that measures temperature (0-50°C) and humidity (20-90%). Inside it has a tiny microcontroller, a humidity sensor, and a thermistor. It speaks a custom one-wire protocol that the Adafruit DHT library decodes for you. You just call dht.readTemperature() and you get a number back.
Mount an HC-SR04 ultrasonic sensor on top of a servo. Sweep the servo from 0° to 180° and back, and at each step measure the distance. Print the results to the Serial Monitor as "angle,distance" pairs. Open the Serial Plotter in the Arduino IDE to see a live radar-like graph of the room. With Processing on your computer, you can build a full visual radar.
Common questions
Is the ESP32 better than an Arduino Uno?
For anything connected, yes. The Uno has no radio, so an IoT build on it needs an ESP8266 or ESP32 module wired on top, which is exactly what the ESP32 already is. For tight timing work or many 5 V inputs, the Uno's simpler 5 V logic and predictable 16 MHz clock are still easier to reason about. Most classrooms end up using both.
How much does an ESP32 board cost?
A DevKit board runs about $6 to $12 depending on the pin count and connector, and an ESP32-S3 board is slightly more at $8 to $15. Add two sensors and a buck converter and a working networked node is still under $30.
Why does my ESP32 restart when the relay clicks?
It is a voltage dip, not a code bug. The supply cannot deliver the relay coil's inrush current, the 3.3 V rail sags under the brownout threshold, and the chip resets. Power the coil from a separate rail, add a 470 uF electrolytic across the 3.3 V supply close to the board, and join the two grounds. The relay driver project shows the wiring that avoids this.
Related guides
Try the full simulator with your class
103 guided circuit projects, 21 lessons and an in-browser Arduino simulator. The first 15 projects are free, no account needed. NCERT Science mapping on 47 projects, with Arabic and English copy in the regional builds.