My MCU Resets while switching a 5v Relay

Thread Starter

sanasana

Joined Mar 11, 2019
17
Hi,
I have Design a Relays Based AC Switch Board using STM8s003 and ESP01. When I connect even a small resistive load then the controller resets during relays switching.... i dont know whether where is the problem in my design?

>>The Board is working fine when there is no AC (220v) load Connected; but with AC Load Connected, then MCU resets during switching
Same type of switch boards are available online containing stm8 but i havent experienced these boards regarding such an issue and i also i dont know about there design.... my schematic and PCB is attached.
kindly tell me where my design need modification or correction...
Thanks
 

Attachments

pmd34

Joined Feb 22, 2014
527
Hi sanasana, I cant see anything obvious wrong with your schematic. I see your microcontroller reset line seems to be pulled high in a fool-proof way so that should be OK, and you say that it works when there is no AC load so it seems unlikely it is a firmware bug that causes your MC to restart.
The only thing left I can think of it the the relay switching is causing a bit of interference and some glitches on your microcontroller power lines. You could try soldering in a small 1nF or 10nF decoupling capacitor right next to the MC (first off just try using a long leaded type so see if it has any effect.) Maybe a large electrolytic cap on the input / output to your regulator too?

If you have an oscilloscope you could try looking to a dip in the supply voltage or on the reset pin, when the relay switches.
 

ericgibbs

Joined Jan 29, 2010
18,848
hi,
I agree with pmd, improve the decoupling on the MCU power rails, add at least a 100uF cap on the Inp and Out of the Vreg.
E
 

danadak

Joined Mar 10, 2018
4,057
Not all caps are equally good -



Also any hi Z pin that is input is subject to pickup. So attention to routing
relay vs all other current prudent. Or clamp pins with diodes to suppress
charge injection into part.

https://training.ti.com/clamp-diodes




Then there is ground bounce, route high currents thru separate grounds from
processor and join them at board edge.


Regards, Dana.
 

Alec_t

Joined Sep 17, 2013
14,313
It may be irrelevant to your problem, but I see some of the cathodes of catching diodes D3-6 are wired to pins 2 of the relays whereas others are wired to pins 5.
Where is the relay coil +ve supply? Is that well decoupled?
Have you tried snubbers across the relay contacts (none are shown)?
Do you have a star ground system?
 

danadak

Joined Mar 10, 2018
4,057
To Alec_t's comment on snubbers, google "relay snubber calculation", several
ap notes on web to calc component parameters.


Regards, Dana.
 

djsfantasi

Joined Apr 11, 2010
9,163
It may be irrelevant to your problem, but I see some of the cathodes of catching diodes D3-6 are wired to pins 2 of the relays whereas others are wired to pins 5.
Where is the relay coil +ve supply? Is that well decoupled?
Have you tried snubbers across the relay contacts (none are shown)?
Do you have a star ground system?
Pins 2&5 are the coil pins. While not explicitly shown, all cathodes are connected to a line labeled Vin.

The lack of explicit reference to the relay coil +Ve is problematical. Your second point then becomes relevant, but not the cathode connection.
 

Thread Starter

sanasana

Joined Mar 11, 2019
17
ok i will check it adding these caps....
and pmd! i have checked the supply on oscilloscope, there isnt any visible dip occur during switching but small variations that are seen any time on output of my 3v3 regulator, for that i removed the regulator and power up the MCU from a separate stable power supply (adjustable). i dont know it seems that the interference is created from the 220v mechanical contact... is it possible that the 220v switch ON OFF any noise in the nearby tracks in my design??
any other suggestion??
 

Thread Starter

sanasana

Joined Mar 11, 2019
17
Pins 2&5 are the coil pins. While not explicitly shown, all cathodes are connected to a line labeled Vin.

The lack of explicit reference to the relay coil +Ve is problematical. Your second point then becomes relevant, but not the cathode connection.
pin 2 and 5 are the relay coil and is not polar just a coil that can operate the switch having any polarity across the coil.... the diodes are connect across the coil accordingly in reverse
 

mvas

Joined Jun 19, 2017
539
ok i will check it adding these caps....
and pmd! i have checked the supply on oscilloscope, there isnt any visible dip occur during switching but small variations that are seen any time on output of my 3v3 regulator, for that i removed the regulator and power up the MCU from a separate stable power supply (adjustable). i dont know it seems that the interference is created from the 220v mechanical contact... is it possible that the 220v switch ON OFF any noise in the nearby tracks in my design??
any other suggestion??
Exactly what is your AC Load per relay?
A "resistor" or an "inductor / coil" type load ?
How many amps ?
Does every relay cause this a Reset Issue, or some of the relays, or just one relay?
 

djsfantasi

Joined Apr 11, 2010
9,163
pin 2 and 5 are the relay coil and is not polar just a coil that can operate the switch having any polarity across the coil.... the diodes are connect across the coil accordingly in reverse
Which is exactly what I said.

Where is the voltage from the relay coils coming from?
 

Thread Starter

sanasana

Joined Mar 11, 2019
17
Exactly what is your AC Load per relay?
A "resistor" or an "inductor / coil" type load ?
How many amps ?
Does every relay cause this a Reset Issue, or some of the relays, or just one relay?
the current test load is a small filament bulb of round about 10-15 watt. if any one of the four or more than relay connected to load, creates reset issue with switching of that specific relay which is connect to load. e.g if only one of the relay connected to load then the MCU resets only with that relay switching, the remaining three relays works properly....
 

bertus

Joined Apr 5, 2008
22,276
Hello,

Looking at the schematic. Are the relays polarity sensitive?
There are two the other way around according to the schematic:

Sanasana_Relays part.png

Bertus
 
Top