Skip to content

Academy

ESP32 from Scratch: Wi-Fi, BLE and MicroPython

The ESP32-S3 in MicroPython: GPIO, PWM, ADC, Wi-Fi, HTTP, MQTT, Bluetooth LE and deep sleep. You upload every example to the board with one click from your browser.

Beginner10 lessons540 minCourse in English

Free10 lessons
Enrol for free

Lifetime access, updates included

A free beginner course prepared for the wirelab forum.

The ESP32 is a microcontroller with built-in Wi-Fi and Bluetooth Low Energy. It costs about the same as an ordinary microcontroller board, yet it can send a measurement to the network on its own, serve a web page or connect to a phone. In this course you program it in MicroPython: from your first LED, through PWM and ADC, Wi-Fi, HTTP, MQTT and BLE, all the way to a battery-powered sensor that wakes every few minutes, sends a reading and goes back to sleep.

The course is written for the ESP32-S3-DevKitC-1 board (Espressif's official board). The code will also run on other ESP32-S3 boards; with other chips (ESP32, C3, C6) the pin numbers and a few details change, and I describe those in the lessons.

You upload every example with one click. Next to MicroPython code blocks there is an "Upload to board" button: it sends the code to the ESP32 over USB (Chrome or Edge on a computer, Chrome on Android). You can also save the program on the board as main.py so that it starts by itself. To edit your own versions (e.g. with the name of your Wi-Fi network) we use the free Thonny editor.

This course has no simulator. Wi-Fi, Bluetooth and sleep have to be tested on a real board, so from lesson 2 onwards you need an ESP32-S3.

Course plan:

  1. Introductory module: soldering header pins (only if your board does not have them).
  2. The board, safety and flashing MicroPython.
  3. GPIO and PWM: LEDs, a button, the RGB LED on the board.
  4. ADC: a potentiometer, attenuation and the ADC2 trap.
  5. Wi-Fi and HTTP: a client and a web server on the ESP32.
  6. MQTT: sending measurements to a broker and controlling the board from a computer.
  7. BLE with aioble: the board visible on your phone.
  8. Deep sleep and battery power.
  9. Final project: a wireless temperature and humidity sensor.

After the course you take a final quiz. Passing it (70%) earns you a certificate.

As of September 2026: MicroPython 1.29, the ESP32-S3-DevKitC-1 board (versions v1.0 and v1.1), esptool 5.

How to read the markers
⚠️ – things that can damage hardware or block your progress.
🔒 – privacy and network security.
$ at the start of a line is a command in your computer's terminal (do not type the $ itself).

What you’ll learn

  • You will flash MicroPython onto the ESP32-S3 with esptool, Thonny or the browser, and learn about the DevKitC-1's two USB ports
  • You will connect components safely: 3.3 V with no 5 V tolerance, pin current, power from USB or batteries
  • You will control LEDs, a button, the RGB LED and brightness with PWM, and know how the ESP32 differs from the Pico here
  • You will read a voltage with the ADC using attenuation and calibration, and avoid the ADC2 trap when Wi-Fi is on
  • You will connect the ESP32 to Wi-Fi, fetch data over HTTP and serve your own web page on the local network
  • You will send measurements to an MQTT broker and control the board from a computer, with retain and the Last Will
  • You will turn the ESP32 into a Bluetooth LE device with aioble that a phone can read and control
  • You will build a battery-powered sensor: deep sleep, RTC memory, a watchdog and sending measurements every 5 minutes

Who it’s for

  • Beginners who want to build their first device with Wi-Fi or Bluetooth
  • Graduates of the Raspberry Pi Pico course who want to move to a board with wireless connectivity
  • People who know the basics of Python and want to control hardware and send data to the network

Requirements

  • An ESP32-S3-DevKitC-1 board (or another ESP32-S3 board) and a USB data cable; the course has no simulator
  • To upload code from the lessons: Chrome or Edge on a computer, or Chrome on Android; Thonny for editing your own programs
  • A 2.4 GHz Wi-Fi network; for the BLE lesson, a phone with the nRF Connect app
  • Parts for around EUR 20-30: a breadboard, LEDs, resistors, a button, a potentiometer, a DHT22 sensor (list in lesson 2)
  • Python basics (variables, loops, functions) will help, but are not essential

Course programme

  1. 01Introductory module1 lesson
    • Introductory module: soldering header pins
  2. 02Getting started1 lesson
    • ESP32-S3: shopping list, safety and flashing MicroPython
      Quiz: Quiz: ESP32-S3 and MicroPython
  3. 03Pins: GPIO, PWM and ADC2 lessons
    • GPIO and PWM: LEDs, a button and the RGB LED
      Quiz: Quiz: GPIO and PWM
    • ADC: a potentiometer, attenuation and the ADC2 trap
      Quiz: Quiz: ADC
  4. 04Connectivity: Wi-Fi, HTTP, MQTT and BLE3 lessons
  5. 05Power and final project3 lessons
    • Deep sleep and battery power
      Quiz: Quiz: Deep sleep and battery power
    • Final project: a wireless temperature and humidity sensor
      Quiz: Quiz: Final project
    • Sources
  6. Quiz: Final quiz: ESP32 from Scratch

Author

wirelab

Write