Go Down

Topic: ADC noise problems (Read 1 time) previous topic - next topic

ardudillo

Hello forum, I have a problem with noise on my analog lines and I was wondering if anyone had any quick and dirty ideas I could play with. Here is a quick description of what I 'm trying to do.

I have a DC-SS009 3-axis accelerometer which spits out an analog signal which can be read through the Arduino's ADC. I thought I 'd mount it on a platform that is allowed to rotate along one axis and stick two motors with propellers on either end to balance it at a given angle. The whole setup can be seen below.



Now, some more detail. The motors suck around 400 mA when going strong so I power them through an L293 H-Bridge. Now, here is the problem. Motors on the power line do absolutely disgusting things to the voltage level. When powering both my Arduino and the motors from the same source, I have had the Arduino resetting repeatedly.

To counter this, I have kept the Arduino and motor power supplies separate, the motors are powered by a battery (some 10.5 Volts give or take) and the Arduino by the PC through the USB cable. To keep things even cleaner, the logic level voltage needed by L293 is given by a 5V voltage regulator and not by the Arduino 5V pin. This way, the only interaction between the Arduino and the L293 is through two of the Arduino's digital out PWM pins which connect to the corresponding input pins of the L293. To dampen any nastiness in the motor power lines I have added a capacitor on each, connecting it to ground. Battery, voltage regulator, motors and Arduino share a common ground. All this is shown in the diagram below.




If I 'm using my multimeter properly, the capacitors I 'm using seem to be around 3.5 nF. Here they are.





This circuit is the best I could come up with the get rid of noise but unfortunately, it doesn't cut it. Here's why.



The picture below shows the final angle readings I get after processing the ADC voltages. This is the range of motion I have physically allowed the platform and the resolution is not that bad within it. These readings have been taken with the motors off and me moving the platform with my hand. It is sketched in a silly little Processing sketch I have written to act as a crude scope.





The next one shows the same thing (me moving the platform around within its limits of motion) but with the motors on. The noise is beyond terrible.




This one shows the transition to quiet as I turn the motors off. The difference is obvious.





Now, the big question is, where does the noise come from? If it's kicked back down the motors' power supply line and somehow manages to travel through the L293 and up the Arduino's digital output pins there's not much more I can think of doing other than stuffing ever bigger capacitors on the motor power supply line. However, I thought I could be picking up electromagnetic noise through the unshielded lines going to the ADC acting as aerials. I 'm sure the motors must be spitting out some pretty disgusting EM fields around them as they go about their business and the ADC line is just begging to pick it up.

To test this, I disconnected the digital output pins from the L293, completely isolating the Arduino from the motor power supply lines (they still share a ground). I then connected the motors directly to the battery and turned them on and off. The results are shown below. I was quite astonished at what a tremendous amount of noise my unshielded line is picking up (I am also astonished that the platform actually manages to kind of balance, although in a very drunk manner).




So, my big question. Is there anything I can try to get better measurements? The obvious answers I can think of are:

a) get an accelerometer with digital output (I 've got my eye on this one http://www.sparkfun.com/products/9723). Expensive but the best solution I guess.

b) get shorter ADC lines. My cables are certainly longer than they need to be but what happens if for whatever reason I need them to be long?

c) shield them. If I wrap the cables in tin foil and then connect it to ground, will I get any worthwhile effect or would I be wasting my time?

Am I missing something obvious?

Cheers.

johnwasser

I think your noise problem may be vibrations induced by the motors.  Perhaps filtering the signal would help reduce the noise.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Grumpy_Mike

You can also put series inductors in both motor leads with a capacitor across both the motor and across the other side of the inductors. These should be larger than 3n5, make them 100nF and should be fitted physically as close to the motor as possible. One inch away is too far.

ardudillo

D'oh, I 'm a moron  :P

Vibrations!

I simply removed the accelerometer board from the platform and held it in my hand a few millimetres above its position and my "noise" disappeared.

Thank you so much guys, Grumpy Mike's tutorial is excellent reading, straight to the point. I 'm glad you pointed me to it.

ardudillo

Hello again, I 'm trying to make a sketch of all the advice I got in this thread so that I can visualise it and perhaps help some poor sod in the future. So, this is what I have come up with.



Killing the motor noise requires putting the capacitor(S) DIRECTLY at the motor terminals. Even three capacitors, one from each terminal to the motor case, and one across the terminals. And likely significantly larger value capacitors.



I have added cap C1 across the terminals and C2 from each terminal to the case. Some ballpark figures (and ballpark value ranges) for these caps would be welcome.


Also, bypassing the H-bridge chip itself would be advisable


This I don't understand. I need the H-Bridge to supply the thirsty motors. What do you mean by bypassing it?



You can also put series inductors in both motor leads with a capacitor across both the motor and across the other side of the inductors. These should be larger than 3n5, make them 100nF and should be fitted physically as close to the motor as possible. One inch away is too far.


I have added the series inductors (L). I guess "across both the motor" means C1. However, I don't understand what is meant by "across the other side of the inductors". Other side of what? Should I add caps in parallel with the inductors (Ca?)? Connect them across the power line gap (Cb?)? My guess is the latter, since it would serve the same purpose as the 47 uF cap in the final sketch in Grumpy Mike's De-coupling tutorial. Have I got that right?

Go Up