Decoupling Arduino’s power supply

arduinodecouplingdecoupling-capacitor

I am building a replacement for dishwasher's controller that burned, using Arduino Leonardo. Arduino is powered through standard 9V AC/DC converter.

Dishwasher uses quite large 220VAC electric pump and a few electromagnetic valves that I control using relay board. Because I was stupid I've bought 12V relay board, not 5V – so I had to power relay board from Vin pin – 9V is enough to do the job.

The layout is pretty tight – I use sealed lunchbox to store the components (wiring is removed at this photo, it looks as a ratnest when fully assembled).

The problem is that serial connection I use to debug my dishwasher code is quite unstable. Sometimes it hangs; if I use TTL wires hooked to pins 1&2 instead of USB I sometimes notice odd characters. Seems that either relays are causing short voltage drops sometimes or the noise from pump and valves are influencing the circuit.

My idea was to add few electrolytic and ceramic capacitors right on the 9V AC/DC's wire. But what worries me is that I've heard multiple times that decoupling capacitors should be installed as close as possible to the circuit. In my case the length of the wire between caps and Arduino's DC jack will be about 5cm. Is it gonna work or this setup will be useless?

Best Answer

In my case the length of the wire between caps and Arduino's DC jack will be about 5cm. Is it gonna work or this setup will be useless?

It is not feasible to know, without simply trying it. Yes, it's best to put the capacitors as close as possible. If 5cm is the closest you can get, than that's "as close as possible". Certainly adding the capacitors won't make anything worse.

We especially can't know if this will fix your problem because we don't know what your problem is. See Why does connecting a high-current device to my digital circuit cause weird behavior?