Understand what the ESP32 is, how it differs from Arduino and what its variants are.
Definition
The ESP32 is a family of low-costmicrocontrollers, meaning small, complete computers integrated into a single chip (processor, memory, and input/output interfaces). They also include built-in Wi-Fi andBluetooth. They are designed to createconnected devices: devices capable of measuring, controlling, and exchanging information wirelessly.
What Is the ESP32?
The ESP32 is a microcontroller designed by the Chinese company Espressif. Like an Arduino board, it is a small computer on a chip that can be programmed to read sensors and control components. Its main advantage is that it includes built-in Wi-Fiand Bluetooth, making it one of the most popular components for building connected devices, at a cost of just a few euros.
It was introduced in 2016 as the successor to the ESP8266, an already popular but much more limited Wi-Fi chip. Since then, the ESP32 has become a reference in the maker community, among students, and even in industry. It can be found in smart light bulbs, weather stations, agricultural sensors, and smart electrical outlets.
Why Learn ESP32 After Arduino?
If you have completed the Arduino course, you already know almost everything you need to get started. Familiar functions such aspinMode(),digitalWrite(),digitalRead(),analogRead(), andSerial.println()work in the same way on the ESP32. It uses the same programming language and the samesetup()andloop()structure. What you gain are new possibilities, especially wireless connectivity.
Send sensor measurements to the Internet or your phone.
Control an LED or a relay from a web page, without cables.
Retrieve online information (weather, time, news) and display it.
What's Inside the Chip?
A dual-core processor running at up to 240 MHz, much more powerful than an Arduino Uno (16 MHz).
2.4 GHz Wi-Fi to connect to a router or create its own network.
Bluetooth Classic and Bluetooth Low Energy (BLE) to communicate with a phone or other devices.
Plenty of memory: approximately 520 KB of RAM, and usually 4 MB of flash memory to store programs.
Various input/output interfaces: digital pins, analog inputs, PWM, touch sensors, serial communication, I2C, SPI, and more.
Input and Output Features in Detail
A typical ESP32 development board provides around thirty usable pins. They are more versatile than those on the Arduino Uno: almost every pin can perform several different functions.
Digital pins: reading and writingHIGHandLOW, just like on Arduino.
Analog inputs: a 12-bit converter, providing values from 0 to 4095, with higher resolution than the Uno's 10-bit converter (0 to 1023).
PWM: approximately 16 channels, available on almost all output pins to adjust an LED's brightness or a motor's speed.
Touch sensors: around ten pins can detect a simple finger touch without a physical button.
Communication buses: multiple serial ports (UART), I2C, and SPI for connecting displays, sensors, and memory cards.
ESP32 or Arduino Uno?
Both boards are programmed in very similar ways, using the same language and basic functions. However, the ESP32 belongs to a different category:
Connectivity: the ESP32 has built-in wireless connectivity, while the Uno requires additional modules.
Performance: a faster processor and much more memory.
Voltage: the ESP32 operates at3.3 V, while the Uno operates at 5 V. This is a crucial difference that we will explore in the next lesson.
Price: an ESP32 board often costs less than an official Arduino Uno board.
Be Careful with 3.3 V
The ESP32's pins operate at 3.3 V and are not 5 V tolerant. Connecting a 5 V signal directly (for example, from a sensor powered by 5 V) can damage the chip. In the next lesson, we will learn how to power your components correctly.
The ESP32 Family
The name "ESP32" actually refers to an entire family of chips. This course uses the original model, which is the most common in kits and tutorials. Here are the main variants you may encounter:
ESP32: the classic model, with Wi-Fi, Bluetooth Classic and BLE, and two cores.
ESP32-S2: a single core, Wi-Fi only, without Bluetooth.
ESP32-S3: two cores, Wi-Fi and BLE, better suited for embedded artificial intelligence and displays.
ESP32-C3: a single RISC-V core, Wi-Fi and BLE, very affordable.
ESP32-C6: a RISC-V core, with Wi-Fi 6, BLE, and modern smart home protocols such as Zigbee and Thread.
Good to Know
Most of the code in this course also works on other ESP32 variants, but pin numbers, available features (such as Bluetooth Classic), and the location of the built-in LED may differ. If you are unsure, check your board's pinout diagram.
How Do You Program an ESP32?
Several options are available: the Arduino framework (in C++), MicroPython (a version of Python for microcontrollers), the official ESP-IDF framework for advanced applications, or PlatformIO in VS Code. In this course, we will use theArduino IDE with C++, the easiest approach for beginners and the one with the largest collection of examples.
Arduino IDE: the easiest option, and you are already familiar with it.
MicroPython: shorter code, ideal if you already know Python.
ESP-IDF: Espressif's official framework, very comprehensive but more demanding.
PlatformIO: a professional development environment inside VS Code, useful for larger projects.
A First Look at the Code
To show you how familiar it is, here is the classic LED blinking program. It is almost identical to the Arduino version. On many ESP32 boards, the built-in LED is connected to pin2, although this is not the case on every model.
blink_esp32.ino
const int led = 2; // Built-in LED on many ESP32 boardsvoid setup() { pinMode(led, OUTPUT);}void loop() { digitalWrite(led, HIGH); delay(500); digitalWrite(led, LOW); delay(500);}
One notable difference: on the ESP32, a baud rate of115200is generally used for the Serial Monitor, withSerial.begin(115200), instead of 9600 on the Arduino Uno.
What You Will Learn
You will discover the board and its pinout, install the development tools, and then explore digital, analog, and touch inputs and outputs, PWM, interrupts, and sleep modes. You will then discover what makes the ESP32 so powerful: Wi-Fi, web servers, HTTP requests over the Internet, and Bluetooth Low Energy.
Part 1: discover the board, install the tools, and upload your first program.
Part 2: inputs and outputs (digital, analog, touch, and PWM).
Part 3: interrupts and sleep modes to save energy.
Part 4: connectivity (Wi-Fi, web servers, HTTP requests, and Bluetooth Low Energy).
What You Need to Get Started
An ESP32 development board (DevKit type, with a USB port).
A data USB cable: some cables are designed only for charging and cannot be used to upload programs.
A breadboard, jumper wires, LEDs, 220-ohm resistors, and a push button, just like in the Arduino course.
A computer with the Arduino IDEinstalled and an Internet connection to download board support.
Key Takeaways
The ESP32 is a powerful, affordable microcontroller with built-in Wi-Fiand Bluetooth.
It uses the same programming language and basic functions as Arduino, so your existing knowledge still applies.
It operates at 3.3 V: its pins are not 5 V tolerant.
Several variants exist (S2, S3, C3, C6); this course uses the original model.
Exercise
Write down three connected devices in your home (speaker, light bulb, scale, smartwatch, etc.). For each one, try to guess whether it uses Wi-Fi or Bluetooth, and explain why that choice is appropriate for its purpose.
Exercise: Comparing Two Boards
Research the specifications of an Arduino Uno and an ESP32 DevKit board (processor frequency, memory, operating voltage, and price). Write them in a two-column table and explain which board you would choose for different projects.
Go Further
Imagine a connected device you would like to build (an automatic watering system, a doorbell that sends notifications, or a thermometer you can check on your phone). List the sensors and components it would need, and identify which features would require Wi-Fi or Bluetooth.