Re: zero - hundred display
- From: "Tom Bruhns" <k7itm@xxxxxxx>
- Date: 28 Oct 2006 23:29:23 -0700
On Oct 28, 12:16 pm, "ozzy" <osma...@xxxxxxxxx> wrote:
Tom Bruhns wrote:
On Oct 28, 9:35 am, "ozzy" <osma...@xxxxxxxxx> wrote:
Hi all,
I've been trying to get a value going from 0 to 100 on an LCD display
using a PIC micro controller (VCC- 5v, VEE - 0V) with AtoD (10 bit -
but converted to 8 bit in software). The hardware used is a simple
non-inverting op amp (LMC660 single supply) with non inverting pin
connected to a voltage divider of 0.05v (my step voltage). I have a
10K linear pot (wiper connected to output) acting as the feedback
resistor along with a 100 ohm resistor to ground.
My problem is that although I get movement of numbers from 0 to 100
there is always slight jumps. E.g if number is set to 6 it will jump
from ~ 3 to 9. At first I thought it was capacitance of the POT leads
so I trimmed that down to a minimum - but still the problem remains.
I have thought about using a current mirror to set the current, but the
circuit described above is using that principle. And anyway the pot
value would have to be high to avoid offset voltage errors.
beginning to feel I've turned full circle....any help on this issue
would be much appreciated.
Regards,
Ozzy.
So--you are trying to vary the gain of the op amp to change the voltage
fed (I assume) to an ADC input -- probably the ADC in the PIC. You are
asking for trouble from noise in the op amp, and noise pickup from
anywhere else. I would suggest instead simply tying one end of the pot
to +5 (also used for the PIC and specifically as the reference for the
ADC in the PIC), and the other end to ground. Then the wiper will pick
off a voltage linearly proportional to the rotation. You can try
putting that directly into the PIC, or if you want, buffer it with a
unity-gain op amp follower. The op amp circuit would be pot wiper to
the (+) input and the op amp output to the PIC and back to its (-)
input. But I just looked at the ADC spec for a 16F684, and it suggests
the ADC is useable with up to a 10k ohm source resistance feeding the
input. Your 10k pot will show no more than 2.5k. In fact, for more
stable readings, I would not bother with the op amp buffer, but I would
put about 1k ohm between the pot wiper and the ADC input, and some
capacitance between the ADC input and ground: if I didn't need it to
change super-fast, I'd probably use 1uF. That would give you response
to final value within a couple dozen milliseconds, max.
Note there's always the chance for flicker between two numbers. A
numerical algorithm can add just a touch of hysterises to the reading,
and can also do a moving average (or exponential decay average) of the
values.
Cheers,
TomTom,
Appreciate the fact you've taken some time out to help me here - will
be giving this a go soon.
But just one question. You state that a 10K input impedance is
acceptable to the 16f684, and will be no more than 2.5K (as it is in
parrallel with Rss - is that right?). Does'nt this depend on Vdd - it
ranges from 5K to 11K giving an effective input impedance of 3.3K to
~5K.
Regards,
Ozzy.
Um, the PIC ADC is OK being fed with any source whose effective series
resistance is less than 10k ohms. If you use a 10k pot, tied to +5
(Vdd, I suppose) on one end and ground on the other, then the wiper
will look like a voltage source with between zero and 2.5k ohms in
series. That's at most 1/4 as much as the PIC can tolerate, so you
should be fine. I suggested adding another 1k in series, and a
capacitor to ground, to insure that the voltage remains stable even as
the PIC ADC switches among inputs, etc. The 2.5k comes from the pot,
at center position, being 5k to +5 and 5k to ground, and that gives you
a Thevenin equivalent source of 2.5V at 2.5kohms.
And of course, Spehro kindly gave you an algorithm for converting that
0-1023 reading to 0-100. I guess it will actually only reach 99,
unless you round, but that may be OK.
Cheers,
Tom
.
- References:
- zero - hundred display
- From: ozzy
- Re: zero - hundred display
- From: Tom Bruhns
- Re: zero - hundred display
- From: ozzy
- zero - hundred display
- Prev by Date: Re: laptop to micro interface (simple)...such a thing?
- Next by Date: Re: 3-input XNOR in SOP form
- Previous by thread: Re: zero - hundred display
- Next by thread: Re: zero - hundred display
- Index(es):
Relevant Pages
|