So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Waszker
#70526 Hi all,
I'm new to this community and joined it because I'm looking for some help regarding ESP8266 modules.
I've created my own ESP-driven WiFi socket (github page is available here)
The code works, the relay controlling AC power for connected devices switches properly when requested as long as nothing is connected to the socket, or the device connected doesn't generate much electromagnetic noise (or so I think).

The things that I have tested to work are: hair-dryer, vacuum-cleaner, small desk lamp, electric heater, phone charger.
All of those can be switched on and off without any problem and it's been more than one year since I've started using my WiFi sockets.
But yesterday I've decided to connect portable fan (like this).
Turning the relay on causes ESP to reset (not always, usually 20% of requests are broken).

I've tried to look for the cause of this and it's definitely not a software issue. When debugging ESP (connected to computer via UART) I get random characters on screen the moment relay (with connected fan) is turned on. Characters appear in terminal regardless of the operation outcome (when they appear ESP does not necessarily reset).

If the ESP "decides" to reset, it hangs itself for about 2-3 seconds and then the hardware watchdog restarts it. It looks as if the software hangs but it happens even when there's no application running (clean software flashed) and I'm manually changing gpio's state via nodemcu commands (I'm using 1.5.4.1-final nodemcu branch).
The problem exists regardless of the ESP type chosen (I've tested ESP-01 and ESP-07). Right now I'm waiting for WeMos D1 mini to arrive and will check that in a few days.

Do you have any idea what may be causing those resets? I don't have oscilloscope so I'm unable to check for any voltage drops (still, I've added capacitor between Vcc and GND).
I'd like to mention that I'm aware of similar threads (here or here) but would still appreciate some help.
User avatar
By Waszker
#70578 I just connected ESP to microcontroller-ready relay. AFAIR they have protection circuit included so I didn't add anything beyond that. The only problem is that I use 3.3V to drive and power the relay.

Maybe something that will help nail down the issue - when the relay is turned on, plugging electric devices (fan in my case) also sometimes causes reset issues. Maybe the problem lies in power source for my ESP? :roll:
User avatar
By rudy
#70584 I would never use the processor power to drive anything like a relay, or other large current device. (relative to the cpu current) I will use a 5 volt supply and that can power a relay and the linear regulator that provides the 3.3v power for the cpu. The ESP8266 can't handle power disruptions.

Part of your problem may be an inductive spike that is making it's way through your power supply. Or it could be how you have routed your wiring. Without knowing a lot more detail it is hard to say what could be the cause.