Go Down

Topic: Isolating servos from temp sensors/arduino (Read 2156 times) previous topic - next topic

Dec 30, 2012, 08:14 pm Last Edit: Dec 30, 2012, 08:24 pm by beala Reason: 1
I've been trying to get a servo to move based on temperature readings from a TMP36. The TMP36 outputs a voltage between high and ground corresponding to the temperature, which can be read with an analog input. The issue is, when the servo comes on, then temperature reading increases, sometimes by as much as 2F.

This issue has been brought up before, and the agreed upon wisdom is to power the servo from a different power source (example: http://arduino.cc/forum/index.php?topic=116483.0). Otherwise the ~200mA draw from the servo will pull the voltages down, thus explaining the bad TMP36 reading.

If possible, I'd like to be able to power my entire project from one AC-DC adapter. The strategy I've attempted is to wire my arduino to the AC-DC adapter (via Vin and GND pins), and, in parallel, also connect an L7805CV voltage regulator to the adapter (I've also connected the grounds together). Unfortunately, this doesn't seem to be working, as I'm still getting temperature swings from the sensor when I apply a load to the servo. The sensor is very sensitive to voltage swings. A change of 0.01 V corresponds to ~1C.

I've used my multimeter to test the current draw from the AC-DC adapter, and it's well within its limits, even when I apply a load to the servo (~250 mA with an adapter rated up to 1000 mA).

Any idea what's wrong with my strategy and what I could do to improve it? Would a digital temperature sensor be less sensitive to voltage swings? Maybe something like this: https://www.sparkfun.com/products/245

Thanks!
Alex

EDIT: And just to be clear, the servo is being powered from the L7805, while the TMP36 is powered by the arduino's 5V pin.

johnwasser


Would a digital temperature sensor be less sensitive to voltage swings? Maybe something like this: https://www.sparkfun.com/products/245


Yes.

Do you need quick response?  The 1-Wire thermometers take 750 milliseconds or more to get each new reading.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

750 ms should be plenty fast for what I'm doing (trying to make a digital thermostat for an old heater/radiator in my apartment). Thanks for the info, John. I'll give that a try.


Also, assuming I use a digital sensor that's less voltage-sensitive, does my servo isolation strategy make sense? My knowledge of circuitry is very basic, so I wasn't sure if wiring a voltage reg in parallel with he arduino even made sense. I'm using the basic circuit from the L7805 data sheet (9V to Vin, and a cap between Vin and GND and a cap between GND and Vout).

Thanks!

zoomkat

Add a diode to the 7805 ground pin like below to get ~5.7v output for better servo operation.

Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

Thanks, zoomkat, I'll give that a try. With the caps in place, would this be the right placement for the diode?



Also, I assume this is a normal 0.7V silicon diode?

zoomkat

The diode looks correctly placed. The diode is just the small general type diode.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

dc42

To make the TMP36 reading insensitive to the supply voltage, use the 3.3V pin on the Arduino as your analog reference. See the description of the analogReference function for details. Also be sure to connect the ground side of the TMP36 to a separate ground pin on the Arduino, not the same ground pin that is connected to power and/or the servos.

If you are already powering the servos form a separate supply, then I suspect it is a common ground wire that is causing the problem.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Thanks, I'll try using the 3.3V source. I'm not sure I understand why this should help, though. Is the 3.3V source less likely to be affected by the servo?

Also be sure to connect the ground side of the TMP36 to a separate ground pin on the Arduino, not the same ground pin that is connected to power and/or the servos.

If you are already powering the servos form a separate supply, then I suspect it is a common ground wire that is causing the problem.

My understanding is that the grounds must be tied together. Why does using a dedicated ground pin help? From the arduino schematic, it looks like the ground pins are tied internally, so even if I used a dedicated pin, I'd still be using the same common ground. Is this a case of a ground loop? I read about this yesterday, but didn't 100% understand.

Thanks.

dc42

Yes, the grounds need to be connected together. However, if the sensor and the power supply or servo connection share the same pin connection and wire, then the current flowing in that connection and wire will induce a voltage across it, due to the resistance of the connection and the resistance and inductance of the wire. This voltage gets added or subtracted to the voltage output from the TMP36. It only takes 10mV of voltage on the ground wire to change the temp reading by 1 degC. So you should always use a separate ground pin for the ground side of analog sensors. Ideally, you would connect the ground side of the sensor direct to the AGND pin of the chip, however the Arduinos have large enough ground traces that just using a different ground pin is usually sufficient.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

That does sound a lot like the ground loop I was reading about on wikipedia the other day. Educational to see it breaking my own design! Anyway, thanks for the answers, dc42. It's very much appreciated.

dc42

A ground loop is something different. However, if you are powering the Arduino and the servos from two different mains-derived power supplies, then it's possible that you have a ground loop as well.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#11
Dec 31, 2012, 05:41 pm Last Edit: Dec 31, 2012, 05:49 pm by beala Reason: 1
Wikipedia describes a ground loop as a conductor (usually a common ground) turning into a voltage divider because of a large current flowing through it. Isn't that what you were describing? Sorry, there's probably some subtly I'm missing here.

EDIT: Here's what it says specifically:
Quote
In an electrical system, a ground loop usually refers to a current, almost always unwanted, in a conductor connecting two points that are supposed to be at the same potential, often ground, but are actually at different potentials.


Then it goes on to describe how a large current across a conductor can make an unwanted voltage divider. http://en.wikipedia.org/wiki/Ground_loop_(electricity)#How_it_works

dc42

As the name suggests, to create a ground loop there has to be a loop involving grounds. Typically what happens is that two devices (e.g. a TV and an amplifier) are both already connected to mains ground, and a cable is connected between them that connects their grounds together again. So it's different from the situation of power flowing through wires and connections that are also used to connect sensors, but related to it.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Ah that makes sense. Thanks, dc42.

Also, you should consider setting up a bitcoin address for tips. I'd certainly send something your way if you did :) Anyway, just an idea.

Go Up