0
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ Ouch... maths, always a good thing... I knew it was't more than 200mA (and plugged this number in), but better go and measure it, as it will reduce C. \$\endgroup\$ – MaxG Apr 14 '18 at 3:35
  • \$\begingroup\$ 188mA it is :) Is is correct to assume the 0.5V is the ripple V?! Will build the suggested circuit... thanks. \$\endgroup\$ – MaxG Apr 14 '18 at 4:43
  • 1
    \$\begingroup\$ Regarding the 0.5 volt, I'm assuming that is the tolerance the MCU has for VDD_sag; such specs as 5v +- 0.5v is what I had in mind. \$\endgroup\$ – analogsystemsrf Apr 15 '18 at 3:59
2
\$\begingroup\$

I agree with Lucky Bot that PSU "holdover" is not a problem here, and I agree with Spehro Pefhany and Lucky Bot that this looks like an EMC problem.

What happens when the pressure switch switches off is that an inductive load gets abruptly turned off. The "magnetic inertia" of the inductance tries to keep the current flowing, but you've barred the path by a very high resistance... which results in an immediate mighty voltage spike across the inductor's terminals, typically pulling an arc across the mechanical switch contacts, excited by the motor's winding. The arc itself is noisy, and the switch can be bouncey. Apart from the voltage spike, the brief but mighty dI/dT also produces an EM pulse spreading through the "ether" from the inductor(s), possibly inducing some glitches/noise in the various PCB traces around your Arduino.

There's a similar problem with relay coils, e.g. driven by a transistor. As the transistor goes open circuit, its collector suffers a spike from the relay coil - which is why the transie should always be protected by an anti-parallel "flyback diode".

Properly blocking the power rail to your Arduino MCU is one partial countermeasure. Unfortunately, attention to PCB layout is another one. At the motor, you can try inserting an EMC filter in the power wiring, and/or pull a ferrite bead/ring/sleeve over the wires, or some such.

Do you have a 'scope to maybe look at some interesting points around the MCU? Such as, the PSU input and the reset input?

That said, digital circuitry can be tough to debug upon this symptom, even with a 'scope at hand. Your advantage is that the Arduino is a simple board, and well documented. I haven't studied the PCB myself. Generally, in computers, the reset line is not a single trace going from some switch or header to the MCU, it can be a more complex network in itself, with several "sources" of the reset signal. A good place (starting point) to look for reset glitches is at the CPU's RESET input pin. And, you may face an interesting uncertainty: the glitches that you see on a 'scope, do they come from the trace or "node" that you're watching, or are they possibly induced into the "loop" between your probe tip and the probe's ground leash? For comparison, try shorting your probe tip to the probe's ground clamp, and generate the EM spike, to be half sure what you're looking at.

You may find that the amplitude of the EM pulse / spike is somewhat random, or very random. Apart from other misc random influences (such as the precise unique one-time pattern of the "bounce" of a mechanical relay contact) the sinusoidal shape of the current through the motor can also be a factor in AC-driven inductive loads. What's random here is the instant in time vs. the instantaneous phase of the sinewave, where the relay contacts open. Some solid-state switches (transistor-based, i.e. PhotoMOS or IGBT) can cause EMI too, by the same mechanism. They don't exhibit mechanical "bouncing", but the abrupt turn-off (dI/dt) is still there. Solid-state switches based on a triac or thyristor should be more polite: they switch off during a zero transition. That's why they only work for AC.

As for some references... speaking of blocking power to IC's by capacitors, try reading through this topic and follow the links to the Kemet KSIM and to the Murata C39E appnote. Those two sources dissect the "choice of blocking capacitors" in meticulous detail :-) And, maybe take a look at this video on spiking caused by inductive loads on turn-off (and the purpose of flyback diodes, though a flyback diode will only protect the switching transistor, and will not prevent the EM pulse spreading though the ether). You seem to be into DIY... ferrite sleeves for power filtering can be found in scrap PC power supplies or various cords and even data interconnect cables. A proper power line filter for your motor (LC PI or whatever) can easily cost more than the Arduino, but may be worth the investment.

If you try some ferrite sleeves or rings, you can put several in series, or wind a couple turns around one, you can make a common mode choke by inserting or winding the live and return alongside each other through a shared ring... And whether you try ferrite sleeves/rings or an LC filter (or both), it may make a difference if you put the filter close to the motor vs. close to the switch. I'd say close to the motor would be better, as it would make the "parasitic antenna" shorter for the radiated RF energy... then again my view may be naive.

\$\endgroup\$
  • \$\begingroup\$ This explains why the power supply engineer is the super hero :) Very useful post; I went through the links provided. Learned a lot. Also found this post <electronics.stackexchange.com/questions/256622/…> ... it must be the pump motor in my case; will pull the reset to Vcc with 4k7 and 100nF, then use a super cap on Vcc; set unused pins to input and pull-ups... and see how that goes. \$\endgroup\$ – MaxG Apr 14 '18 at 23:38
1
\$\begingroup\$

Sounds like the problem is EMI from the switching, and this is one reason why hobbist boards like Arduino are not often used industrially, and relativey expensive PLCs are common.

The solution is better EMC design and layout, or buying a product with those features engineered into it from the beginning. Avoiding mechanical relays helps, but is often less appropriate.

\$\endgroup\$
  • \$\begingroup\$ But would't the PLC use potentially the same uC (e.g. ATMEL328P) in their solution? This means the uC is not the problem, but rather the power source (supply) as suspected. \$\endgroup\$ – MaxG Apr 14 '18 at 3:38
  • \$\begingroup\$ Yes, they will use a standard MCU, but it will be surrounded by protective circuitry and proper shielding to harden it to EMI. \$\endgroup\$ – Spehro Pefhany Apr 14 '18 at 3:44
1
\$\begingroup\$

Whatever measly input capacitance is inside the Switch mode converter is probably enough to run the MCU through this event considering these caps are charged to full AC line voltage. Likely Spehro is correct and the RESET pin on the MCU is getting toggled from EMI. Try connecting this pin directly to the MCU supply or put the largest SMD cap that will easily fit across whatever tiny cap is normally present on this pin.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.