24/7 emergencies 814 777 6921812 230 6079WhatsApp 811 786 0768
Electrónica MonterreyElectrónica MonterreyLaboratorios Creativeit Talk to an engineer
Menu

Why does a microcontroller reset when a nearby relay is activated?

Because when the relay coil or contacts open, a transient appears that couples to the microcontroller through the power supply, through the shared ground or through the field, and causes a voltage drop or a pulse on a sensitive line that triggers the reset.

Two sources of disturbance in a relay

The coil is an inductor. When it is de-energized, the current cannot disappear instantly, and the voltage across the coil reverses polarity and reaches values far higher than the supply voltage, unless there is a path for that current. The contacts, when switching an inductive or capacitive load, produce arcing and bounce with very fast changes in current and voltage.

How it reaches the microcontroller

  • Shared power supply: the coil current or the turn-off spike causes dips or spikes on the supply rail. If the voltage falls below the operating threshold, the undervoltage detector resets the system.
  • Common ground impedance: the relay current flows through a section of return path shared with the logic and shifts the local reference.
  • Field coupling: traces near the coil or contacts pick up the pulse capacitively or inductively, and it reaches the reset line, an interrupt input or the oscillator.

What the engineer sees

The reset occurs at the moment of switching, not at random. An oscilloscope with a good ground point shows the rail dip or a pulse on the reset line, synchronized with the relay. Sometimes the program does not reset but reads a false input, which gets mistaken for a software error.

Solutions

  1. A diode in antiparallel with the coil, or a suppressor, to provide a path for the turn-off current; the diode lengthens the contact opening time, and if that is a problem a diode with a resistor or a voltage suppressor is used.
  2. A snubber or suppressor on the contacts when the load is inductive.
  3. Separate the coil and logic returns, joining them at a single point.
  4. Decouple the microcontroller supply close to its pins, and use a separate power stage for the relay.
  5. Filter the reset line and sensitive inputs, and keep traces away from the relay.
  6. Configure the undervoltage detector and the watchdog timer appropriately.

When the contacts switch mains voltage or other hazardous voltages, the work is a matter for qualified personnel, in accordance with the applicable regulations.

We do real tests, on video! Watch them on our YouTube channel →

Do you have a problem nobody has been able to measure?

Talk directly to the engineer in charge, with no middlemen.

Talk to an engineer