-->
Page 1 of 7

Using GPIO pins to switch on relay.

PostPosted: Sat Mar 07, 2015 8:48 pm
by dmarkey
Hi there.

I'm trying to engage a Songle relay (only the relay, no breakout board or anything), but the ESP seems to be sensitive to any kind of power draw, even with a transistor inbetween (2n3906 in this case) the ESP still resets or freezes.

If I put a resistor in between the GPIO pin and the base of the transistor, it doesnt engage at all.

My electronics isnt the best, anyone got an idea?

Re: Using GPIO pins to switch on relay.

PostPosted: Sat Mar 07, 2015 9:35 pm
by jra
Can you post a schematic?

Re: Using GPIO pins to switch on relay.

PostPosted: Sun Mar 08, 2015 9:04 am
by Robus
I have a very similar problem. Sadly I don't have any software to create schematics at hand, figured I'd take a photo:

http://i.imgur.com/XvJhtLC.jpg
http://i.imgur.com/0yLsHII.jpg

1 - 3.3V stabilizer
2 - 5V stabilizer
3 - Chinese 5V relay
4- 2N2222
5 - PCF8574

What is happening is basically: I'm using the two pins on the ESP8266 as I2C to drive the PCF8574. The PCF on the other hand is connected to the two diodes in the bottom, and the relay. I also put some IN4007 diodes before the 5v stabilizer and the base on the 2n2222.

There seems to be no problem when I drive the relay using a timer, but the ESP8266 crashes about 5% of the time if I change the relay state while using WiFi. What can I do to remedy this? More capacitors?

Re: Using GPIO pins to switch on relay.

PostPosted: Sun Mar 08, 2015 5:09 pm
by zhivko