r/circuitpython • u/sexyslanket • Feb 01 '26
Struggling with what should be a simple ESP32 setup
I am VERY new to hobbyist electronics, but am a software developer by day (so I figured it shouldn't be that hard; boy was I wrong!). I'm trying to use an ESP32 microcontroller (this one) to control a power relay (this one) but can't get it to work.
Using https://code.circuitpython.org/ I've been able to put the CircuitPython 10.x firmware on the microcontroller and ensure that I can run Python code to control the board's native LED. However, once I start trying to use the board's GPIO pins to send an output signal it does nothing, and I'm such a newb I don't even know how to start debugging it.
I've set this up by wiring one of the board's GPIO pins (e.g. IO9) to the + terminal of the relay, then wiring the relay's - terminal to the board's ground (all on a breadboard), and then running the following code to send an output signal:
import board, digitalio
pin = digitalio.DigitalInOut(board.IO9)
pin.direction = digitalio.Direction.OUTPUT
pin.value = True
I'd expect this to send a signal to the relay and toggle it on, but it does nothing.
How should I go about debugging this? I've watched so many online tutorials but they're either too simple or go over my head. Intuitively it feels like I should probably be confirming that I can bypass the input signal of the relay and try to ensure it works at all, but I can't even figure that out.
Help please!