Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By digicrat
#59064 I have a relay rated at 3.3V that I need to trigger with the ESP8266 but can't get to work as expected. I'm really hoping to keep the complexity (and therefore physical size) of this circuit down, since it's going into a small enclosure (hacked cordless phone base station).

My power supply is providing 3.25V, but the ESP8266-01 logic high output is only 3.17V. This seems like an almost trivial voltage drop, however its enough that the former can trigger the relay but the latter cannot. I only need to keep the relay triggered for less than half a second (simulating a button press).

Any ideas on how to get this circuit to work? The VCC vs signal levels are so close that it seems there should be a simple solution . . . maybe using a cap or pull-up resistor?

Thanks
User avatar
By digicrat
#59101 UPDATE:

For test purposes I was able to hook up an alternate power supply that I bumped up to 3.4V VCC, giving me a higher signal voltage, but the relay still won't trigger. That implies that my original theory is wrong and the problem here isn't voltage, but current from the GPIO pin. I'm still not sure how to proceed to get this circuit working.
User avatar
By martinayotte
#59126 You can not drive relays directly from GPIOs, they are not driving enough current, maximum is 12mA.
You need to add a MOSFET where gate has a pulldown and attached to GPIO. When HIGH level is apply to GPIO, it will turn ON the MOSFET and provide sinking GND to the relay, other side of the relay is attached to power.
Don't forget to add reverse diode in parallel to the relay coil to get inductance discharged when turning it OFF.