Arduino reset on power draw


I am experiencing a problem with the Arduino being reset in only a particular situation. It is wired to following components:

  • Arduino Nano with Arduino Uno bootloader (for watchdog reset)
  • SSR (zero crossing) switching 2000 W heater (german household, 16 A 230 V, 60 Hz)
  • SSR (zero crossing) switching 400 W pump
  • bluetooth module
  • 2x pressure sensor 4-20 mA, converted to V and connected on A1 and A3
  • USB cable (stays attached)
  • RTC clock
  • 230 V to 12 V power supply with extra 2200 µF 25 V capacitor.
  • The setup is working normally for extended periods of time but is heating up to probably > 60 °C.

The reset now occurs when the pump is activated by an external cicuit and the Arduino turns on the heater. While the pump is running, the heater is mechanically disconnected, the SSR is switched on. When the pump is externally switched off again, the heater is turned on with the mechaincal relay while the SSR is always turned on by the Arduino, waiting for the pressure to rise.
Then the Arduino resets respectively hangs up (I am resetting using a watchdog).

What I checked and I think can be scrached off the list:

  • Induction in USB cable: It is magnetically smoothed (?), disconnected it, still resetting.
  • High power consumtion by heater bringing the voltage down to a critical level: Added the capacitor, system stays on for seconds now when power is turned off.
  • Too much noise in bluetooth cables: Turned baud rate to 9600

What I am thinking might be the problem:

  • Induction/noise in any cable, sending a peak to an I/O
  • Crappy SSR is not correctly isolated even if it says optically coupled (it also says 3 V but needs at least 5 V, chinese brand ;))
  • I decided to leave out the protection resistor against overvoltage on the analog ins of the 4-20 mA converted sensors. These are high quality and I don't mind changing the Arduino if something goes that wrong. I am happy to have it shut off in that case.

My question now is can anyone confirm my suspicions and is there a reliable way to check if one or the other is causing the problem? I am not too keen on randomly trying resistors on each I/O pin. Do you have any more suggestions why the Arduino might be resetting?

The system is really running savely, so please don't worry. I just would like to know the cause of the problem and get a better, more reliable system :slight_smile:

I suspect you're getting large spikes upsetting the Arduino, perhaps coming in on the sensor wiring.
EMI from mains switching is a common issue, and the chief way to protect is distance and protection
circuitry to clamp any spikes. Simple capacitor to ground can work well on any slow analog input sensor.

Avoid big loops - they act as a loop antenna. In particular ground loops are to be avoided (though
usually the opto-isolation of relays and SSR's prevents this, but be careful not to ground any sensors
other than through their cable)

Never run sensor cabling alongside high current or mains wiring (if you have to do this,
fully shielded cables are worth trying).

Thank you for your answer. So you would expect the analog inputs to be the problem? The reset only occurs if the power is switched externally to the SSR, so normal routine (switching the SSRs) is no problem. The cables are relatively short (~ 20 cm) and not parallel to any power line.

Would it help to add small capacitors to each analog input and ground? I.e. 0.1 µF? Also to the Rx line?

The metal enclosure is also grounded with the savety line and the Arduino lies close to it (like touching close, only a layer of non-conduction coating in between). Could this be an issue, too?

My new theory would then be:
As far as I remember no reset occured as long as the Arduino is also connected via USB to my PC. I think it was completely out of the casing when connected. Since the non-SSR just connects to main power no matter what, the spikes are also connected to the metal enclosure which then transmits EMI on the full scale of the Arduino. Does this sound feasible?

Else I would probably add the capacitors to all inputs and hope for the best.

100nF is fine for analog inputs, but not suitable for digital inputs or outputs which require
fast edges. the standard digital protection circuit is a series resistor (perhaps around 1k) and schottky clamp
diodes to the power rails (bolstering the input protection diodes and capable of handling much larger
current spikes). Schottky diodes have a lower forwards voltage than the internal protection diodes
and thus activate first to protect the protection diodes.

Ok, thank you for your detailed answers! I will add your suggested protection to every I/O port.


I tried above advice and added a 100 nF capacitor to each analog input and clamped all digital I/O between Gnd and +5 V also using a resistor. The Arduino still resets for my specific scenario.

And now the funny part: I disconnected the protective ground from the metal casing (only my additional wire coming from the SSR backplates) and the Arduino doesn't reset any more. So the problem actually was of some other nature. My narrow understanding only gives above explanation. Does someone know what is going on and what causes this behaviour?

I think the setup will be fine as is since the metal casing still is connected to ground in case the SSR somehow would apply current to the enclosure. Also the anodized heatsink doesn't conduct electricity.

Still I am curious and would be happy if someone could pitch in again.


So you were using an opto-isolated SSR and then connecting directly to its case, completely
defeating the opto-isolation?

As I understand it you are supposed to connect the earth to the metal back side of the SSR as protection against electric shock in case it melts.

Edit: ok, I mostly get it now. The Arduino is its own system running on the lower voltage from the power supply and optically coupled to the higher ac current. By grounding the SSR to earth I get a potential difference when changing load which somehow affects the Arduino. When I connect the Arduino also to my pc, it is pulled to earth ground over USB and my pc power supply respectively. So I either don't ground the SSR since the encasing is already grounded or I also set the Arduino’s gnd to earth, correct?

Despite that I still think this should have been taken care of within the SSR so that the lower voltage side is completely shut off from the higher side, also externally.

Does someone know why this is happening? Should I connect Arduino ground to earth?

Switching mains voltages generates voltage spikes on all the mains wiring, including the earth
wire, since these wires are run close together and thus are capacitively coupled. The spikes
will be short lived (microseconds or less), but that's all it takes to reset a microcontroller if that
spike comes in at dozens of volts on the various connections (some pins get more voltage
than others unless the layout is highly symmetrical, so a real voltage difference is seen by the
sensitive circuitry).

This is why optoisolation is needed and used, so that there is no electrical connections at all to carry
the spikes across to the sensitive circuitry. This greatly reduces the need for shielding
the electronics thoroughly (which gets expensive, but will also fix the problem).

Even with opto isolation you have to be careful not to provide other routes for spike transmission
(such as running you low voltage wires alongside mains wiring).

Ok, I figured it out. The cheap chinese power supply is bad at its job and when switching the chinese SSR which also consumes more power then on its rating, the power on the arduino gets too low and thus the device resets. The fix is to just use a beefier power supply and put everything on transistors/SSRs as far as possible.

Glad you fixed it.

I'd never recommend cheap chinese mains power supplies, I've seen how dangerous they can be (only layers
of enamel on enamelled copper wire insulating between primary and secondary).