Pages: [1]   Go Down
Author Topic: Isolating servos from temp sensors/arduino  (Read 1935 times)
0 Members and 1 Guest are viewing this topic.
Boulder, CO
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: December 30, 2012, 02:24:13 pm by beala » Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8856
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Boulder, CO
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9636
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Boulder, CO
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9636
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The diode looks correctly placed. The diode is just the small general type diode.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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.

Boulder, CO
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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.

Boulder, CO
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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.

Boulder, CO
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: December 31, 2012, 11:49:23 am by beala » Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6619
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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.

Boulder, CO
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley Anyway, just an idea.
Logged

Pages: [1]   Go Up
Jump to: