PDA

View Full Version : Pot reading jumping like crazy!!!



champion
- 15th November 2006, 16:20
Hi again, I am now having issues with reading a pot using the pot command. I have gotten my LCD to display a scaled reading of a linear pot's displacement, but the reading is jumping around randomly. I am using a 5V regulator and polypropylene capacitors. I can't figure out what is making the reading jump around so much, because if I simply read the resistance of the pot with a mulimeter it is rock solid. What am I doing wrong/not doing? Thanks.

champion
- 15th November 2006, 20:48
No one has had this issue? Or is this a dumb question?

mister_e
- 15th November 2006, 21:08
Is this on the F84?

If so, What's your Pot and capacitor value?

HenrikOlsson
- 15th November 2006, 21:16
Hi,

Oh, crap... didn't realised you where using the POT command.....Sorry.

Disregard:
Have you tried buffering the signal from the POT with an OPAMP? It may be that the source impedance of the POT is too high for the ADC to work properly. Try two 1k (no higher then 1k for now) resistors in series from +5V to GND, connect the middle point to your analog in pin. Does it still jump around? If not you should now have a reading of ~128 for 8bit and ~512 for 10bits. If not my guess is that you either have the left/right justify bit set up wrong or using the wrong Vref. But it's really hard to tell without even knowing what chip you are using and/or your register setup....

/Henrik Olsson.

champion
- 15th November 2006, 21:16
Is this on the F84?

If so, What's your Pot and capacitor value?

Yes, its with a F84A, with 10k resistor and a 0.1uF cap.

mister_e
- 15th November 2006, 21:20
On wich pin? Hope it's not RA.4

Did you tried a higher capacitor valu.. let's say 1K

Is the MCLR pin tied to VCC with pull-up? if so wich value?

champion
- 16th November 2006, 01:23
On wich pin? Hope it's not RA.4

Did you tried a higher capacitor valu.. let's say 1K

Is the MCLR pin tied to VCC with pull-up? if so wich value?

a 1K is tied to Vcc.

exelanoz
- 16th November 2006, 04:05
I had a similar issue a while ago maybe I can be of some assistance.
I was also using the F84A, on PORTB with the POT command. I noticed that larger pots, over 15mm dia, read very clean, yet the small PCB mount types can be noisy, with values moving around, especially if they are the cheap and nasty 0.20c types.

When using small PCB types or small cheap pots,I compensate with software. I sometimes read 5 values, add together and get and average read, or other times I will read only even numbers and ignore the odd. It all depends what you need it for...

Also check your common GND and make sure your regulator can provide enough juice for the circuit. Are you using 78L05?

champion
- 16th November 2006, 14:59
Are you using 78L05?

No, it's a NTE1960.

sayzer
- 17th November 2006, 09:12
Yes, its with a F84A, with 10k resistor and a 0.1uF cap.


There is another way.

Use 1K POT with 100nF.

This way, you will get a large movement of the POT giving you softer reading max. "30" instead of 255.

You can then multiply this "30" by say 4 and have "120" as your POT reading value, still with soft reading movement. (multiply by 8 and get 240 could be another).


How is that now?


-----------------------

exelanoz
- 17th November 2006, 12:49
No, it's a NTE1960.
Your regulator should be fine, rated at 1A...what are you feeding your regulator with? A wall type plugpack or a benchtop powersupply?

Yes, Sayzer also has a good idea.

I'm wondering whether you just have a bad Pot.
Have your tried buying another linear potentiometer?
I have at least 50 or so hanging around from equipment that has been scrapped :-)
Useful for many projects.
I throw in a MKT type capacitor and works well...
Even the cheap and nasty greencaps are ok

I also like using wire wound types, doesn't jitter much and provides a clean read, also normally quite low in resistance. U might need to add a resistor in series with it... and play around with the scale values.

what about your LCD display?
Start up pause?
are you clearing the display or just writing over old values?

I am acutally a little suprised, as there is really not much that can go wrong.
I assume you have a PIC 16F84A with the appropriate powersupply, a crystal...an LCD and POT attached with 2 wires and a cap. Right?

When you say it moves erratically, does it move 1 or 2 values up or down during idle? Or does it move in much bigger increments?

champion
- 20th November 2006, 18:59
A wall type plugpack or a benchtop powersupply?

Have your tried buying another linear potentiometer?

what about your LCD display?
Start up pause?
are you clearing the display or just writing over old values?

I assume you have a PIC 16F84A with the appropriate powersupply, a crystal...an LCD and POT attached with 2 wires and a cap. Right?

When you say it moves erratically, does it move 1 or 2 values up or down during idle? Or does it move in much bigger increments?

1. I'm using a wall type plugback

2. I have tried 5 different pots. all the same

3. Here is my output for the lcd
lcdout $FE, 1, "Damper Position", $FE, $C0, " ", dec dig3, dec dig2, ".", dec dig1, dec dig0, "mm"

4. I am using a 4MHz crystal, and the pot connected with 2 wires only.

5. The values change by 1-2 units out of 255 total units.

Also, when I allow the program to run continuously, the value steadily drops until it levels off at a certain point, far from where it started.

Archangel
- 20th November 2006, 21:24
1. I'm using a wall type plugback

2. I have tried 5 different pots. all the same

3. Here is my output for the lcd
lcdout $FE, 1, "Damper Position", $FE, $C0, " ", dec dig3, dec dig2, ".", dec dig1, dec dig0, "mm"

4. I am using a 4MHz crystal, and the pot connected with 2 wires only.

5. The values change by 1-2 units out of 255 total units.

Also, when I allow the program to run continuously, the value steadily drops until it levels off at a certain point, far from where it started.

Hi Champion,
Do I understand this correctly, You are dividing 5 volts by 255 ?
If so then each unit has a value of 0.0196078431372549019607843137254902, so if it only varies by 2 or 3 units,
let's say 10 units just because math frightens me then variation =0.196078431372549019607843137254902. now factor in the inherent instability of the power supply's regulator, the terrific connections you get from the breadboards connectors, and if there are any air currents near your bench to cause variations in the temperature of any or all or this . . .<h3> MY POINT IS </h3>. . . . unless you have everything made into a solid block with constant temperature regulation and perfect power regulation then some variation is normal, I believe that was why sayzer told you to choose a smaller divisor like 30, then the variation would be less than 1 unit and you will not see it.
JS