Electrical – How to prevent a microcontroller to reboot due to Vcc fluctuations

acdecoupling-capacitormicrocontrollerrelayswitch-mode-power-supply

Case #1: I have a pump station with an autonomous 240V pump motor switched by a 240V pressure switch, feeding a pressure tank to a max. pressure. After said tank are four 24V solenoid valves (250mA inrush, 180mA holding), controlled by a 5V-fed relay board (Sainsmart). This relay board is connected to microcontroller (Arduino UNO) outputs via optocoppler.

The relays come ON|OFF in series. Once the last one switches OFF, the pump motor still runs due to the switch-OFF-pressure not reached yet. A few seconds later the pressure is up, the pump switches OFF — and here comes the problem — the microcontroller reboots (when the motor switches OFF).

There is a single phase 240V supply for all of it.
The solenoid valves get their power from a ring-core transformer 50VA.
The microcontroller has a 240V/5V switched plug-in power supply with 2A (<200mA required).


Case #2: Another scenario: the 240V/5V connected microcontroller controls a small relay (5A), which switches 240V (with snubber) for a bigger 25A DIN-mounted relay (contactor), which switches a 3kW resistive heating element for a hot water system. On occasion, the microcontroller reboots when it switches on the load.

I see the same problem in both cases. But what could be the problem/solution?

100uF with 0.1uF in parallel to 5V Vcc/GND?


Case #1: the trials…
1. use a 4k7 and parallel 100nF from +5V Vcc to RESET. No change.
2. use a 1,000uF capacitor parallel to +5V Vcc and GND. No change.

Case #1: the solution…
3. add a snubber (104 in series with 100R) parallel to the relay contacts.
No more rebooting problems! 🙂

Thanks for all the input; it triggered a lot of research and validation, resulting in some learning… more so to create more robust circuits, when it comes to inputs into uC devices.

Best Answer

Using Q = C * V, and taking the derivative, we get

dQ/dt = dC/dT * V + C * dV/dT

Now we keep the capacitor constant, leaving dQ/dT = C * dV/dT

Replace dQ/dT with I, and we have the useful I = C * dV/dT

Now assume I = 0.2 amps, dV = 0.5 volt, dT = 5 seconds, and re-arrange to find C.

C = I /(dV/dT) = I * dT / dV = 0.2 * 5 / 0.5 = 2 Farads capacity.

Have you considered a super-capacitor, isolated by a schottky diode from the MCU VDD pin? with 100 ohms across the diode to keep the super-cap charged?

=========================================

Lets take a swag (scientific wild asses guess) at the math for magnetic field problems on PCBs. Use the formula

Vinduce = MUo * MUr * Area/Distance * dI/dT.

Our first assumption is the dI/dT: assume its 10 amps in 100 nanoseconds, with the 100nanoseconds defined by parasitic capacitance in the pump motor windings. Again this is a SWAG.

Assume the PCB, at the MCU Reset pin, has 1cm by 1cm area. Or if the Reset trace runs all over the place, assume 1cm by 10cm. And assume the pump/relay wiring is 1cm away from this Reset loop.

What induced voltage can we predict, using our assumptions? First task is inset values for MUo (4*pi*1e-7) and for MUr (1, for air, vacuum, copper, FR-4, etc) and the equation becomes

Vinduce = 2e-7 * Area/Distance * dT/dT

Vinduce = 2e-7 * 0.01meter * 0.01meter/0.01meter * 10 amps/100nanoSec

Vinduce = [here we put a number indicating a big problem exists: 1volt; and we agree if our math predicts 1v is likely then we probably do have a problem]

Vinduce = 2e-7 * 0.01 * 10amp * 1e+7

Vinduce = 2e^(-7 -2 +1 +7) = 2e^(-1) = 0.2 volts.

OK we may or may not have an EMI problem. Examine the area of the loop on the Reset pin. Perhaps bring the StackExchange people into the thinking, by posting that portion of the PCB layout (the layers, and the component layer).

There have been at least 3 good answers on EMI. Once you find the loop area on the Reset pin, make a loop of that size, on insulated wire, and tape it to the PCB to be monitored by a scope probe; getting a zero-area GND connection to the probe may be a challenge. Then turn the pump on and off and on and off. And please report what you find.