I have a two relays connected to GPIO 4 and GPIO 5 of an ESP12F module running the Tasmota firmware. The ESP12F and the relays use a 1 A Samsung mobile phone charger to get 5 V DC from the same AC supply. The same AC supply is used for relay side input. The 5 V is stepped down to 3.3 V for the ESP12F by an ASM117 module. When I connect a ceiling fan through a speed regulator to any relay output, the ESP12F restarts when operating the relay. When I check the console, I see restart reason as hardware watchdog which means there is a voltage spike or dip. What could be happening?

It doesn't restart when the speed regulator is not connected. I have tested with directly connecting the fan and also keeping the regulator at full speed. In both these cases, there is no issue with the ESP8266. Only when regulator speed is set to lower than high does the issue pop up. 90% of time, the problem comes when the relay is turned off.

I already have a 1000 uF electrolytic capacitor and 104 ceramic capacitor across the ESP12F 3.3 V and ground. I also have a 1N4007 across the relay coils.

enter image description here

layout on pcb

layout with circuit

  • \$\begingroup\$ "C2" pin of the relays are connected to GND in your diagram. I hope that is a mistake. This is not related to your problem but just wanted to point it out. I think there is some coupling back to the 5V which causes a dip in the 3.3V. I have no clue why this coupling happens. May be layout related? If your charger allows it, may be you can add a cap on the +5V also on the PCB and see if it helps. \$\endgroup\$
    – sai
    Commented Apr 28, 2023 at 11:04
  • \$\begingroup\$ @sai you are right it was mistake in schematics. Instead of adding a cap on charger, can I add the cap on the vin and ground of the Ams117 module? Also if I use an octocoupler to engage the relay would it have any affect. \$\endgroup\$ Commented Apr 28, 2023 at 12:57
  • \$\begingroup\$ 104 = 100 nF perchance? What does Vcc look like on your oscilloscope when you trigger a relay? Also, please follow best practices when drawing a schematic. Positive voltages point up, ground and negative point down. Input comes from the left and outputs to the right. Have you tried to add a capacitor from U3.C1 to Q2.E? \$\endgroup\$
    – winny
    Commented Apr 28, 2023 at 13:06
  • \$\begingroup\$ Yes, I meant adding cap on AMS117 module vin to ground. However, I do not know if this is allowed. You'll need to check the charger specs and see how much load cap is allowed. Since the mechanism of coupling is not clear, difficult to say if optocoupler helps. \$\endgroup\$
    – sai
    Commented Apr 28, 2023 at 13:11
  • \$\begingroup\$ @winny By 104 I meant 104 ceramic capacitor with 0.1uf. I haven't tried cap across C1 and GND. what should be value? Thanks for the pointer. will revise the diagram ASAP. Also couldn't get hold of an oscilloscope. \$\endgroup\$ Commented Apr 28, 2023 at 13:18


Your Answer

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

Browse other questions tagged or ask your own question.