Reading a low Resistance Rheostat

Thread Starter

denpo

Joined Aug 17, 2010
11
Hi AAC people, Happy New Year.

I'm looking for some help on a project.
As you'll quick find out I'm nowhere knowledgeable in the field, but I'm trying by best to learn.

I'm trying to read from a sensing device that acts like a rheostat varying from 0 to 5 Ohms.
I'm not after very precise reading, if I could bet 6 or 7 bits of precision out of the full range, I'd consider myself happy.

The whole setup it running on 5v. I can either built it around a 1A or 0.5A voltage regulator. Obviously the smaller the better.
The microcontroller is a ATTiny13, for the record.

Concerning the rheostat I've been informed of its non linearity compared to a potentiometer, either I feed it with a current source or I get prepared to correct the non linearity on the microcode side.

Current Source or not?
What I have in stock is LM317. Used as a current source, it creates a significant voltage drop, 2v IIRC, which leaves me with not much voltage range to measure. Should I go for another current source setup ?
Or should I got without the current source? But then wouldn't my setup be using a lot more power?

Then how do I measure such a tiny voltage variation?
I made some computation, put in an voltage divider beside a 200 Ohms resistor.
Given I'm feeding the array a full 5v, I can expect the output voltage to vary from 5 to 4.85v at best, which is too short a range.
Concerning the 200 Ohms resistor, I'm afraid to go for lower values, I'm concerned about energy consumption/heat release.

Op-amps seems to be the answer, so I read about it.
Looks like the way to use them is with the negative feedback method, but then how do I read the resulting negative voltage with my micro controller?
Also I learned about instrument amplifiers, which seems to be what I need, I ordered a couple of INA126P (AD620 clone), hoping they would come handy. Was it a good idea?

I also came across the Wheatstone bridge, and especially its low resistance cousin, the Kelvin Bridge.
From what I understand they are designed to nullify the potential interference created by the wiring resistance. In my case, between the rheostat and the micro-controller, don't expect more than one foot of wire.
Do I need to dig into that or it's totally overkill for my particular application?

See, I did my homework, but unfortunately it's some shallow and theoretical knowledge.
I'm afraid it's a lot of questions packed into one post, feel free to correct me on any aspect of project. The only invariant it the sensor itself.
I'd appreciate some guidance on where I need to keep digging.
Thanks for reading.
 
Last edited:

k7elp60

Joined Nov 4, 2008
562
Unless the op amp has a - rail voltage it will not invert the voltage. One
way around this is to bias the + input to half of the Vcc and have the - rail of the op amp connected to ground. Then the inverted signal will be something less the 1/2 Vcc.

If you use the LM317 to make a constant current source(a resistor connected between the adj terminal and the out terminal) with the load connected between the adj terminal and ground may work. As you know the voltage drop across the lm317 will be about two volts+ the IR drop of the resistor (1.25/R) so it will be close 3.5 volts. That gives you about 1.5 volts to measure the voltage across the 5 ohm rheostat. It depends on the accuracy of your meter for the number of digits.
 

#12

Joined Nov 30, 2010
18,224
Examine these.
Even if this is not the final solution, it covers a lot of concepts you are just beginning to learn, like how to make a negative feedback loop without a negative voltage, precision analog design, and "rail to rail".
 

Attachments

Last edited:

GopherT

Joined Nov 23, 2012
8,009
Thanks you so much.
Looks like I need to understand what a Rail-to-rail amps is, and I will.
Look for an op amp that can achieve output to within 500 mV of power supply rail and all the way down to ground.

It shou also handle input from rail to neg rail should be possible.
 

#12

Joined Nov 30, 2010
18,224
OPA188 can do that with a 10k load at all temperatures.
(Disguised as sbos642A in above post.)
 

Thread Starter

denpo

Joined Aug 17, 2010
11
Hey guys,
My INA126P (AD620N clone) finally arrived, so I started playing with it.
I was really surprised how nicely it all went.
Here's what I ended up with :


The Rheostat is symbolized by a thermistor.
The IC2 is a LM3127.
A the pin 6 of the amp, I get 0.7v to 4.1v range, which is totally undreamt of :D
If my calculation are correct only 0.1A goes through the rheostat.
It's almost too simple to be true.
Is is just because it's my first time with amplification?
 

#12

Joined Nov 30, 2010
18,224
Your calculated current is .1041666... amps and the gain is 5.11666...
(about 6.6% high)

As long as you know the actual numbers, which will be off a bit because you didn't use absolutely 12.000 ohms and 12.000 k ohms, the results are useful. If you went to the bother of using adjustments like the circuit I posted, it would not be necessary to mathematically interpret the results coming out of the amplifier.

But, speaking in generalities, following instructions properly causes excellent results on a daily basis. Congratulations on your success.
 

Thread Starter

denpo

Joined Aug 17, 2010
11
Your calculated current is .1041666... amps and the gain is 5.11666...
(about 6.6% high)

As long as you know the actual numbers, which will be off a bit because you didn't use absolutely 12.000 ohms and 12.000 k ohms, the results are useful. If you went to the bother of using adjustments like the circuit I posted, it would not be necessary to mathematically interpret the results coming out of the amplifier.
I know. A readable value is all I was asking for.
If I read you right, you'd put a trimpot (instead of a resistor) at the ouput of the LM317, and at the amplification factor of the INA126P.
I still can do that, given I have one with the correct range in stock.
Reason I went ahead with the INA126P is that I don't have very good source for electronic component. I usually order my component online, it can take weeks for them to arrive.

But, speaking in generalities, following instructions properly causes excellent results on a daily basis. Congratulations on your success.
Big thanks to you and the other posters, I may not have followed your instructions, you still have fueled my willingness to toward success.
It was not that complicated, but for a freshman like me it was a bit intimidating.
 

#12

Joined Nov 30, 2010
18,224
If you want to polish your design, I suggest you only put a trim pot in the gain resistor position. Low current there makes it easy on the pot, and the thing that matters is current times gain. Turn the gain down a bit and the results will be dead on.

ps, I meant to say you followed the instructions for the IC you used. I think it's a bit of bother to set up the power supplies, the grounds, the bypass capacitors...all for one little amplifier, but it's necessary. Cheap out on the details and you will be looking at, "garbage in, garbage out" on half (or more) of your projects.
 

Thread Starter

denpo

Joined Aug 17, 2010
11
Your calculated current is .1041666... amps and the gain is 5.11666...
(about 6.6% high)
My first tests were with a dedicated 5v supply. Now that I'm integrating my design with a 12v source, I use a LM2940, and I'm surprised how quickly it gets too hot to touch (under 1 minute).
Would it means the LM317 is power hungry whatever the current it outputs?
Naively I was expecting the components to run without need for heat sinks.
 

ErnieM

Joined Apr 24, 2011
8,377
Well, your current source puts out about .1 amp into 5 ohms for .5 volts. That means the rest of the 12V is across your LM317, so you have 11.5V * .1A or 1.15 watts in there... which can be quite warm.

One very good way to cut that power is to use one of the micro's pins to switch the current on and off, so you only have it on when you want to make a measurement. See if you can google up a high side switch schematic; done with a pair of logic MOSFETs (one P and one N) you can switch with no current but the load.

I'm doing something just like this now in a circuit to measure .0025 ohms using 4.5V batteries.
 

Thread Starter

denpo

Joined Aug 17, 2010
11
Well, your current source puts out about .1 amp into 5 ohms for .5 volts. That means the rest of the 12V is across your LM317, so you have 11.5V * .1A or 1.15 watts in there... which can be quite warm.

One very good way to cut that power is to use one of the micro's pins to switch the current on and off, so you only have it on when you want to make a measurement. See if you can google up a high side switch schematic; done with a pair of logic MOSFETs (one P and one N) you can switch with no current but the load.

I'm doing something just like this now in a circuit to measure .0025 ohms using 4.5V batteries.
Thanks for the answer, I get the idea.

For the record, I may not have been clear enough, the heat is from the LM2940 that convert my supplied 12v down to 5v. But I guess it's just the same problem, moved somewhere else.

High side switch is not a problem for me (anymore). That's actually what I doing with the microcontroller, high side PWNing a bunch of leds according to the rheostat position.
The rheostat is a user activated interface, it can be adjusted at any moment and any speed. Thus will need to maintain a minimal frequency to avoid lag in the perceived feedback

Out for curiosity, instead of high side switching the whole LM317/rheostat assembly, wouldn't there a way to insert the switching transistor inside the LM317 setup, making it stop sucking electricity instead of cutting it out altogether?
My planned PCB real estate is rather small and starts getting cramped already, so I'm kinda reluctant to add another 2N2222-IRF9340 combo to the setup.
 

#12

Joined Nov 30, 2010
18,224
An LM317 in a TO-220 package should handle 1.15 watts with only a little bit of heating. I can't quite see what the problem is.
 

GopherT

Joined Nov 23, 2012
8,009
The pinout on the LM2940 is different than the LM317! Also, the LM2940 is a fixed regulator with ground as center pin. The regulated voltage is part of the part number if I remember correctly - example LM2940-5.0 for a 5 volt regulator.

Also, BountyHunter posted some info recently on the LM2940 that is oscillates terribly and can cause itself to heat up unless you have a lot of decoupling farads helping you keep it under control.

http://forum.allaboutcircuits.com/showthread.php?t=93717&highlight=lm2940

I think the LM317 is a much better option and recommended. Don't let that (variable/adjustable) phrase make you think it is not for fixed voltage levels. Most are used in set and forgot mode.

Cheers.
 

Thread Starter

denpo

Joined Aug 17, 2010
11
An LM317 in a TO-220 package should handle 1.15 watts with only a little bit of heating. I can't quite see what the problem is.
Not much a problem rather than a reality check.
The LM317, fed with 5V from the LM2940 get warm, just warm.
OTOH the LM2940 heats up like mad converting the 12v to 5v (I also tried with LM2937-5 with similar results)
Given the tiny current generated (0.1A), it surprised me.
 

#12

Joined Nov 30, 2010
18,224
LM2940, datasheet quote: Cout must be at least 22 uf to maintain stability.
Just go back to the LM317. It requires a lot smaller capacitor to suppress oscillation.
 

Thread Starter

denpo

Joined Aug 17, 2010
11
LM2940, datasheet quote: Cout must be at least 22 uf to maintain stability.
Just go back to the LM317. It requires a lot smaller capacitor to suppress oscillation.
Ok, there might be some misunderstanding here, probably my fault.
Here's a bigger picture of the project :


Does whole thing makes sense?

Sorry for the placeholder, don't have the actual part in my libraries
IC2 => LM317
LM2931 => LM2940
AD620N => INA126P
 

Thread Starter

denpo

Joined Aug 17, 2010
11
Ok, there might be some misunderstanding here, probably my fault.
Here's a bigger picture of the project :


Does whole thing makes sense?

Sorry for the placeholder, don't have the actual part in my libraries
IC2 => LM317
LM2931 => LM2940
AD620N => INA126P
Due to my inability to provide a clear description the answers I got were slightly off.
May I formulate again:
Given the schematic above, would you be surprised if the 5v generation chip (LM2940 represented on the pic by a LM2931) needed a heatsink in order to let the current source (LM317, IC2 in pic) deliver only 0.1 amp to the rheostat.
I'm saying that because my newbie's common sense tells me it's ain't right.

I've found on the LM2940 pdf an equation for the heat generation, but can't really work it out (I'm missing some of the equation variable).
 
Top