Learn MicroPython on the ESP32 without needing the board
PyPlaca is a free IDE that runs in the browser. You write the Python program on the left, build the circuit on the breadboard on the right and watch the ESP32 DevKit V1 react: the LED lights up, the servo turns, the sensor reads. You don't have to install anything or create an account. When you want, the same main.py goes to the real board.
A complete first program
This is the program the IDE opens the first time. It blinks the blue LED that comes soldered onto the DevKit V1, connected to GPIO2, three times, and writes the count of each blink to the Serial.
Pin(2, Pin.OUT) turns the pin into an output; led.on() and led.off() change its level; time.sleep_ms(500) waits half a second. The simulator counts this time on the simulated board's clock, so the LED blinks at the right pace even if the computer is slow.
The Serial shows:
piscada 1 piscada 2 piscada 3
from machine import Pin
import time
led = Pin(2, Pin.OUT)
for i in range(3):
led.on()
print('blink', i + 1)
time.sleep_ms(500)
led.off()
time.sleep_ms(500)
What you can do in the browser
- Write and run MicroPython
- The interpreter follows the ESP32's MicroPython v1.29.0: the same functions, the same error messages and the REPL (
>>>) when the program ends. - Build the circuit
- An 830-point breadboard and 21 parts to drag and connect with wires. The workbench warns you when the LED's resistor is missing or when a pin gets more voltage than it can take.
- Watch the board react
- The 3D workbench or the top view show LEDs, displays and motors changing while the program runs. You press the breadboard button with the mouse, and the sensor changes its value on a slider.
- Walk through line by line
- Breakpoints, step by step, stepping into and out of functions and even stepping back. The Variables tab shows the value of each variable at every line, like a desk check.
- Internet of Things
- Simulated Wi-Fi, HTTP requests and MQTT: the board joins the lab's network, queries a server and publishes to a broker, without depending on the school's network.
- Take it to the real board
- Export the project as a
.zipwith the bill of materials, or flash straight to the ESP32 over the USB cable (Chrome and Edge), including installing MicroPython on a new board.
The tracks
There are 11 tracks, with 48 lessons and 111 challenges with automatic grading. The logic-with-Python track and the first-steps-on-the-ESP32 track start open; the others open when the previous one ends. Each challenge is graded by running your code with inputs you can see and with hidden tests, like in an exam.
- Logic with Python 60 challenges
Variables, input/print, decisions, loops, functions, lists and matrices: the 60 logic challenges from logicabr, now in Python. - First steps with the ESP32 4 lessons and 4 challenges
The blue LED on the board (GPIO2), time in MicroPython, external LEDs with a resistor, and your first traffic light. - Digital inputs 4 lessons and 4 challenges
Buttons, pull-up and pull-down, the floating pin, interrupts (Pin.irq) and debounce. - PWM: brightness, color, sound and motion 5 lessons and 6 challenges
Pulse-width modulation on the ESP32: the LED at half brightness, fading, colors on the RGB LED, notes on the passive buzzer and the SG90 servo. - Analog: ADC, potentiometer and LDR 6 lessons and 6 challenges
The ESP32 analog-to-digital converter: reading voltages, the potentiometer and the voltage divider, attenuation, mapping ranges, the LDR and the moving average. - Sensors: temperature, distance and presence 4 lessons and 5 challenges
The DHT22 (temperature and humidity), the HC-SR04 (ultrasonic distance) with the voltage divider on ECHO, and the PIR (presence). - Displays: OLED, LCD and NeoPixel 5 lessons and 5 challenges
The I2C bus and scan(), the SSD1306 OLED with ssd1306.py, the 16×2 LCD with the I2C module and the NeoPixel LED ring. - Time without freezing 5 lessons and 5 challenges
Why sleep() freezes the program, the ticks_ms/ticks_diff clock, several tasks at the same time, machine.Timer and the state machine. - Wi-Fi and HTTP 5 lessons and 5 challenges
The board joins the network with network.WLAN (DHCP, IP, status and scan), talks to servers over HTTP with requests, understands JSON, sends readings with POST and does not wait forever for a slow server. - MQTT: publish and subscribe 5 lessons and 6 challenges
The MQTT broker and the publish/subscribe model (and why it differs from the request and response of HTTP), topics, wildcards, retained messages and QoS, receiving commands without freezing with check_msg(), the DHT22 and the relay through the topic panel, Keep Alive, last will and reconnection. - Final project: IoT weather station 5 lessons and 5 challenges
A weather station built in steps: the DHT22 and the OLED in a loop that does not freeze, the configuration fetched over HTTP with a default for when the network fails, the readings published on MQTT with an online/offline state, the breadboard assembly and, at the end, the complete station that changes its interval through the broker.
Articles to get started
Long texts, with examples that open straight in the simulator, about the ESP32 and about Python from scratch. A few of the first ones:
- Getting Started with MicroPython on the ESP32
What MicroPython is, how the ESP32 DevKit V1 runs your main.py, the GPIO2 LED, timing, your first LED on a breadboard and the path to a real board. - ESP32 GPIO Inputs: Pull-Up, Pull-Down and the Floating Pin
How the ESP32 reads a pin: logic levels, internal pull-up and pull-down, the floating pin, GPIOs 34 to 39, Pin.irq interrupts and button debounce. - ESP32 PWM in Practice: LED, Buzzer and Servo
Pulse-width modulation on the ESP32 with MicroPython: frequency, duty, why 1000 Hz becomes 998, LED brightness, buzzer notes and the SG90 servo angle. - The ESP32 ADC: Attenuation, the Calibration Curve and Why It Stops Short of 3.3 V
How the ESP32 measures voltage in MicroPython: read and read_uv, ADC1 vs ADC2, the four attenuations, calibration, potentiometer, LDR and moving average. - Sensors on the ESP32: DHT22, HC-SR04, PIR and the Voltage Divider
DHT22, HC-SR04 and PIR on the ESP32 with MicroPython: each sensor's protocol, the errors the board shows and the voltage divider on the 5 V ECHO pin. - I2C on the ESP32: SSD1306 OLED and 16×2 LCD with MicroPython
The I2C bus on the ESP32 — addresses, scan, pull-ups and ENODEV errors — and how to use the SSD1306 OLED and the 16×2 PCF8574 LCD in MicroPython.
Workbench parts
Each part has a datasheet card with its pinout, a ready example and the specifications with the source of every number: ESP32 DevKit V1 (DOIT, 30 pins), ESP32-C3 Super Mini (16 pins), 830-point breadboard, 5 mm LED, Resistor, 6 mm tactile button, 10 kΩ potentiometer, LDR (GL5528), Active buzzer, Passive buzzer, RGB LED (common cathode), SG90 servo, DHT22 (AM2302), DHT11, DS18B20 temperature sensor, HC-SR04 ultrasonic sensor, HC-SR501 PIR motion sensor, 1-channel 5 V relay module, SSD1306 OLED display 128×64 (I2C), 16×2 LCD with I2C module (PCF8574), WS2812B NeoPixel ring. The DevKit V1 pinout tells you what each pin does and which ones to avoid.
For teachers
The lab doesn't always have a board per student. With the teacher profile you create the class, share the invite code, choose the activities with deadlines and follow on a panel who has already done them, how many attempts they used and each one's grade. The official grading runs on the server, with the same simulated board, and the result doesn't depend on the student's computer.
Who makes it
PyPlaca is created and maintained by Prof. Rodrigo dos Santos Faustino, a programming teacher, under the FAUSTINOPSY brand. The platform was born in the classroom: students need to make mistakes, measure and try again without fear of burning a component. Learn more about PyPlaca or get in touch through the contact page.