I have an RC device powered by a 3.7V poly battery, which includes a motor and a 40KHz sonar. The voltage across the sonar sensor is amplified and then adc-ed. The motor is driven by a 2KHz PWM.

When motor is off, everything works well. When motor is on, I have a 2kHz 0.5V drop at VBAT and it's difficult to get rid of this - probably because of long wires to motor. I do have a diode across the 2-wire motor.

Anyway, the big problem is that I also get a 2kHz 10mV spike at the sensor. This creates noise that prevents from analyzing the sonar readings. The signal-to-noise ratio is not big enough.

sensor noise when motor off: enter image description here

sensor noise when motor on: enter image description here

I cannot really change the gauge of the motor wires and the VBAT drop doesn't create any other problem. Is there a way I could avoid such noise?

  • 1
    \$\begingroup\$ What spectral content exists in the sonar signal? Is this stopping low pass filtering of your input? What decoupling do you have in place? Do you have a rough schematic of what you have built? \$\endgroup\$
    – Kortuk
    Commented Jan 13, 2013 at 18:03
  • 2
    \$\begingroup\$ On top of the schematic: also a picture of how you wired things, especially the sonar and motor parts, including the ground wiring (bus? star?). \$\endgroup\$ Commented Jan 13, 2013 at 18:08
  • 2
    \$\begingroup\$ If the problem is caused by the length of the wires like you suspect, adding bypass capacitance at the load end of those wires should reduce the effect. How much capacitance you need depends on a lot of things you haven't said (or haven't worked out yet), but 100 uF is a good starting point. \$\endgroup\$
    – The Photon
    Commented Jan 13, 2013 at 18:23
  • \$\begingroup\$ Adding capacitance might not be (or might be) the best solution to the problem, but its an easy experiment to see if you're on the right track. \$\endgroup\$
    – The Photon
    Commented Jan 13, 2013 at 18:25
  • \$\begingroup\$ Thanks to The Photon. Adding capacitors don't really change the problem but your suggestion made me fix something else. \$\endgroup\$ Commented Jan 13, 2013 at 23:13

1 Answer 1


I'd start by considering your grounding scheme. Your motor is probably being driven by PWM, rapidly switching the voltage to it on and off, and probably at 50kHz. This means sometimes we have a quite heavy current flowing through the motor, and then a short moment later, no current. This causes a couple issues.

Power Supply Filtering

The first step is to be sure you have decoupling capacitors between the positive and negative sides of the battery near each component. These provide a low-impedance path for high-frequency currents. Which is another way of saying, they provide a nearby power reserve to fill in sudden current demands without going all the way to the battery.


Consider these circuits:


Here, the resistors R1, R2, and R3 are not actually resistors, but represent the resistance in the wires. I've modeled your sonar sensor as an ideal voltage source V1, and drawn in an op-amp U1 to represent your amplifier. Your actual circuit is of course more complicated, but this will demonstrate the problem.

Consider the BAD case. When your motor is running, a heavy current is flowing in R1 and R2. By Ohm's law, there will be a voltage drop in these resistances, most significantly, R2. When the motor is on, the "ground" at V1 is significantly different from the "ground" at U1. These differences are amplified by U1.

If we re-arrange the motor to be more like the GOOD schematic, then the motor currents will still cause a voltage drop over R1, but that will affect the sensor and the amplifier equally, so it's not so much a problem. There's still the potential for R3 to mess things up, but the current there is likely small.

In the BEST schematic, we connect the amplifier and the sensor to a common point to avoid that problem, too. This is called a star ground. Your sensor and amplifier currents are probably small enough that this isn't necessary, but there you have it anyway.

It's important to remember that we've just considered the ground side of the battery, but these same concerns can apply equally to the other side of the battery. Enlightenment comes from considering where the currents are flowing, and where you are measuring a voltage, consider what the reference for that voltage is.

Inductive Coupling

The other source of noise can be unintended inductive coupling. When current is flowing through your motor, current is flowing in a loop. Current in this loop makes a magnetic field. As this field grows and shrinks through the switching on and off of your motor by the PWM driver, all the other wires in your circuit will experience a change in voltage by the law of induction.

To minimize this effect, you want to keep stray inductances small. Consider the physical path current must flow from the battery, through the motor's driving circuitry, to the motor, back to the driver, and back to the battery. This will make a loop. The bigger this loop is, the higher its inductance. Make that loop as small as possible by keeping the ground and positive battery connections as close together as you can.

Do the same for your sonar sensor. Also, avoid having the two running close to each other, or parallel to each other, as this makes their mutual inductance stronger.


If this proves insufficient to address the issue, you can consider building a differential amplifier. I'll not describe it in detail, since I suspect these other changes will be sufficient, and properly designing a differential amplifier system is complex enough to merit a question of its own. However, if the other issues are addressed, a well designed differential amplifier can reject noise so well it can measure truly minuscule signals buried in noise, like the electrical impulses generated by your nerves.

  • 1
    \$\begingroup\$ +ve , great answer. \$\endgroup\$ Commented Jan 13, 2013 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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