3
\$\begingroup\$

I have been making a project involving a relay and an esp8266. Essentially a WiFi enabled relay. The issue that I have been having is that when the esp8266 boots it flashes all of its GPIO pins high and low a few times in quick succession. This of course has adverse effects on the device I have attached to the relay. Currently I have been trying to use a filter type circuit that I have designed using a capacitor and some transistors however I have discovered that this will work for some relays but I have to adjust resistance values and the like in order to get it to work for each different relay due to inconsistencies in their construction.

Here is what i have been using currently with approximate resistor values:

schematic

simulate this circuit – Schematic created using CircuitLab

Essentially what this circuit does is it prevents the relay from operating before the 470uf capacitor is charged. During startup the 7.5kohm resistor is trying to charge the capacitor (It takes about a second for it to charge to a usable level) but the filter line is unstable so it keeps being discharged. Only once the esp has finished booting and all the pins are stable can it charge and allow the relay to operate.

You might also notice that while fine tuning the circuit it is quite easy to adjust the resistor values so that things like the voltage regulator running the circuit start to get quite hot.

Essentially I am looking for a more reliable (less overheat-able) and all in all more elegant solution to this problem than I have already been using. I have considered adding an atTiny to the circuit to enable the relay due to the fact that its pins seem to be stable during startup but I figure there must be a simpler solution than having to add a whole other IC to my project!

Thanks

\$\endgroup\$
5
  • \$\begingroup\$ Please state the relay coil current . Maybe Q1 Q2 are not being driven hard enough .You mention PSU heating how much current are you dealing with? Some thing that relies on electros for capacitance and transistor Vbe wont ever be precision. \$\endgroup\$
    – Autistic
    Commented Nov 16, 2015 at 10:50
  • \$\begingroup\$ @Autistic. The coil is rated for 12.5milliamps (added to diagram). Also by power supply I actually meant voltage regulator (Oops). These resistance values came from a circuit that I had working with a relay that must have been quite easy to throw because other relays need greater currents at the base of Q2. This then causes my 7805 to become reasonably hot if current can pass through Q3 for any length of time because the 7.5kohm resister has to be reduced. Ultimately I would like to replace the whole circuit with a cleaner solution however. \$\endgroup\$
    – Razer797
    Commented Nov 16, 2015 at 12:16
  • \$\begingroup\$ Sort uot the PSU your circuit does not draw too mush current .Give your relay a freewhwwl diode like everybody else does. \$\endgroup\$
    – Autistic
    Commented Nov 16, 2015 at 19:37
  • \$\begingroup\$ Hi, Razer797 have you found a better solution to it? Thanks \$\endgroup\$
    – Luis
    Commented Feb 8, 2018 at 23:27
  • 1
    \$\begingroup\$ @Luis There you go. I have added my solution \$\endgroup\$
    – Razer797
    Commented Feb 12, 2018 at 5:30

2 Answers 2

2
\$\begingroup\$

What esp8266 module are you using? Esp01 only exposes GPIO0 and GPIO2 for you, and both of them are used during boot mode. If you use another module, like ESP12 as an example, you could use other GPIOs (4, 5, etc.) that are not read by the esp8266 during boot time, and you would not have that flickering on the relay.

\$\endgroup\$
2
\$\begingroup\$

Ok

Should have done this long ago but better late than never right?

My final solution to solve this problem was to use an external NE555 timer circuit in monostable mode as below.

schematic

simulate this circuit – Schematic created using CircuitLab

I have found the above circuit to work very reliably which I believe makes up for the increased complexity.

Depending on your circuit the RESET resistor may or may not be important. Its job is to discharge TRIGGER_C as fast as possible in the event of a very short power outage to prevent the ESP8266 from rebooting without the 555 triggering (this may be futile but in my testing, it seems to work so I have left it in).

Best of luck to those replicating this :-)

\$\endgroup\$
1
  • \$\begingroup\$ would a pull down resistor not work? \$\endgroup\$
    – waspinator
    Commented May 21, 2018 at 1:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.