Problems with DC motor noise with proximity sensor.

Hi! Some days ago, I posted here about some issues related to abnormal behaviour of a proximity sensor when I turn on 2 DC motors (to move the wheels of my project). One forum member helps me, telling me that it is a common decoupling problem and I need to use somo capacitors / inductors to solve it. I read something about it, but I'm not an electronic expert (I'm a programmer) and I have some doubts. (indeed, I've read that if you use a wrong capacitor it can explode!)

So, I'll very thankfull if somebody can help me with the schematics. I've created some schematics with fritzing. The first one, is the present configuration (proximity sensor goes crazy)

The second one is my aproximation of the solution, but I'm not sure that it will be right. Anybody can validate or correct it? If I miss some important data, tell me and I post any information you want.

In the schematics, I only represent the motor shield and not the arduino one itself, to make it better to read.

Thanks in advance,

Ferran

The first thing I would try is solder a .1uF capacitor across the terminals of each motor.

thanks! but why a .1uF and not 10nf. How can I calculate the right value?

Its trial and error for things like this, values for decoupling and noise-suppression aren't usually very critical.

If the wires to a motor aren't twisted together its well worth doing that to reduce EMI as well.

Shielded cable to the sensor can help too, as can decoupling on the motor supply.

If you still have the same problem after adding the capacitors you can try Ferrite Rings/Beads over the motor leads.