Electronics-Related.com
Forums

MCU reset during relay switches ON

Started by Niresh September 3, 2020
Hi,
Could any please suggest how to avoid MCU reset with voltage glitches/noise during relay switches ON. I have protected the relay coil with free wheeling diode and MCU with 2x10uF parallel with 100nF  near VDD of MCU and 1uF across RESET pin.


Regards,
NiK
On 2020-09-03 08:34, Niresh wrote:
> Hi, Could any please suggest how to avoid MCU reset with voltage > glitches/noise during relay switches ON. I have protected the relay > coil with free wheeling diode and MCU with 2x10uF parallel with 100nF > near VDD of MCU and 1uF across RESET pin. > > > Regards, NiK >
I'm hesitating to get involved, because I have no idea of your level of knowledge and this is probably a can of worms. It isn't hard to drive relays from an MCU, but you have to know what you are doing. A schematic diagram, or even a picture of your setup would have helped. First of all, I suppose you are aware that the MCU cannot drive the relay directly. You must use some sort of driver or buffer stage. This can be as simple as an NPN transistor with a series resistor in the base lead, but it could be more involved, depending. I also assume that you know why and when a freewheeling diode is needed. Then there are grounding rules. Choose *one* convenient grounding point. This may be the ground plane of the MCU board, if it has one, or the negative terminal of the power supply, or some other point. Every device should have its own connection to that point, so that currents flowing back do not share the same conductor. If your common ground point is some heavy large piece of metal, you can relax that rule. The only real exception to this would be the negative lead to the power supply. Next are crosstalk issues. Bear in mind that current flows in closed loops. Keep those loops tight, so that current flowing towards a device follows as closely as possible the same path as current flowing back. This is most easily assured by twisting wires together. Do /not/ twist together wire pairs feeding /different/ devices. Finally, sudden step changes in current may cause short drops or surges in the power supply voltage. MCUs are often not very forgiving on that point. Make sure that doesn't happen. Give the MCU its own voltage regulator and provide enough capacitance to keep the voltage within whatever it needs, even if the voltage on the input side of the regulator jumps about a bit for a while. About 10ms of hold-up time is usually enough. Let us know how you fare. Jeroen Belleman
On 9/3/2020 12:04 PM, Niresh wrote:
> Hi, > Could any please suggest how to avoid MCU reset with voltage glitches/noise during relay switches ON. I have protected the relay coil with free wheeling diode and MCU with 2x10uF parallel with 100nF near VDD of MCU and 1uF across RESET pin. > >
Is this on a breadboard or on a carefully designed PCB? If it's the former, the jumper wires could be picking up stray fields.
On Friday, September 4, 2020 at 12:34:56 AM UTC+5:30, Pimpom wrote:
> On 9/3/2020 12:04 PM, Niresh wrote: > > Hi, > > Could any please suggest how to avoid MCU reset with voltage glitches/noise during relay switches ON. I have protected the relay coil with free wheeling diode and MCU with 2x10uF parallel with 100nF near VDD of MCU and 1uF across RESET pin. > > > > > Is this on a breadboard or on a carefully designed PCB? If it's > the former, the jumper wires could be picking up stray fields.
Yes, you are correct. The relay is driven through a NPN transistor with a series resistor. I understand the concept of free wheeling diodes. It is a well developed PCB board with isolated ground common for relay, MCU and other circuits as well. I don't why I could not attach or copy paste the schematic and noise capture in these group. Regards, NK
On 9/7/2020 9:53 AM, Niresh wrote:
> On Friday, September 4, 2020 at 12:34:56 AM UTC+5:30, Pimpom wrote: >> On 9/3/2020 12:04 PM, Niresh wrote: >>> Hi, >>> Could any please suggest how to avoid MCU reset with voltage glitches/noise during relay switches ON. I have protected the relay coil with free wheeling diode and MCU with 2x10uF parallel with 100nF near VDD of MCU and 1uF across RESET pin. >>> >>> >> Is this on a breadboard or on a carefully designed PCB? If it's >> the former, the jumper wires could be picking up stray fields. > > Yes, you are correct. The relay is driven through a NPN transistor with a series resistor. I understand the concept of free wheeling diodes. > It is a well developed PCB board with isolated ground common for relay, MCU and other circuits as well. > > I don't why I could not attach or copy paste the schematic and noise capture in these group. > >
This is a text-only group. If you want others to see your images, upload them to an image hosting site and post the link here.
Please check the below link for the relay schematic, PCB layout and Noise capture in oscilloscope.

https://www.dropbox.com/s/fyg97b91k36xjto/Glitches%20or%20noise%20capture%20oscilloscope.png?dl=0

https://www.dropbox.com/s/j0hqqfwh7p4ce6w/Relay%20schematic.png?dl=0

https://www.dropbox.com/s/p0s3gismw6sbhzo/PCB%20layout.png?dl=0


Regards,
NK
Pimpom wrote:
> On 9/7/2020 9:53 AM, Niresh wrote: >> >> I don't why I could not attach or copy paste the schematic and noise >> capture in these group. > This is a text-only group. If you want others to see your images, > upload them to an image hosting site and post the link here.
alt.binaries.schematics.electronic still seems to work but it's rarely used.
On 07.09.2020 08:17, Niresh wrote:
> Please check the below link for the relay schematic, PCB layout and Noise capture in oscilloscope. > > https://www.dropbox.com/s/fyg97b91k36xjto/Glitches%20or%20noise%20capture%20oscilloscope.png?dl=0 > > https://www.dropbox.com/s/j0hqqfwh7p4ce6w/Relay%20schematic.png?dl=0 > > https://www.dropbox.com/s/p0s3gismw6sbhzo/PCB%20layout.png?dl=0 > > > Regards, > NK >
I can't tell which trace is what on the scope capture (it overshoots at 700mV/div and both are 700mV/div - which one is what signal?). But I can see that the LDO and relay share the same 12V rail. The 100nF cap on the relay coil seems way too small to be doing anything substantial. I would replace it with, or add in paralell, a 10uF-100uF cap. Can you post the scope traces of the 12V and 3v3 rail? One where it does not overshoot the screen and tell us which one is which. regards Nife Sima -- Nife Sima - the lower earth crust