Electrical – esp32 3.3v relay

esp8266

I am developing my first PCB and I would like to know how best to power a 3.3v relay with control from ESP32 module. Because I am powering the relay with 3.3v do i even need the optoisolator in my circuit? the circuit below is currently activated with a LOW from ESP32.enter image description here

enter image description here

enter image description here

Best Answer

The optoisolator is overkill here for most applications. You can drive T1 straight from the ESP and size R3 so that the Base-Emitter current times the transistor's gain is plenty to flip the relay on. As long as you have the flyback diode you should be fine. If you see problems from small voltage spikes when the relay turns on and off, you can keep a capacitor with low ESR close to the relay so that it pulls from the cap during transients.