MCU reset during relay switches ON

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

Reply to
Niresh
Loading thread data ...

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

Reply to
Jeroen Belleman

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.

Reply to
Pimpom

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

Reply to
Niresh

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.

Reply to
Pimpom

Please check the below link for the relay schematic, PCB layout and Noise capture in oscilloscope.

formatting link

formatting link

formatting link

Regards, NK

Reply to
Niresh

alt.binaries.schematics.electronic still seems to work but it's rarely used.

Reply to
Tom Del Rosso

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
Reply to
Nife Sima

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.