10K Pot Question..

xtech007

Senior Member
Hi all again !
Yes, I'm Talking about Potentiometer...
I have a vishay 10k 10 turn pot, I will like to get its current variable value at 1/2 way travel (5 turns). All ready try debug but the variable keeps changing without me turning or touching the pot. I used the following code
Code:
main: 
readadc 1,b0 
debug b0 
pause 500 
goto main
the variable b1 keeps changing lets say from 61 to 62,63,61,
if i turn the pot to another position I will get 110-111-112-108-109 and so on
it never stays.

Its this normal??

Any help would be Great!!!
Thank you guys for the support.
 

Andrew Cowan

Senior Member
b1 = 0 to 255 (256 steps)

10000 / 256 = 39 ohms per step. Going from 108 to 112 = 156 ohms change. Sounds unlikly - can you check with a mulitmeter?

I think putting a 100uF capacitor accross the wiper and 0V leg of thee pot may help.

What power supply are you using?

A
 

Dippy

Moderator
Oooh no.
You shouldn't need to put a big fat cap like that on the wiper - unless the supply is rubbish.

And if the supply is rubbish it would upset any results from ADC. So, you can work out that a 5% variation in supply will give ...% variation in ADC value.

Post your schematic.

1. It is SSSSSSOOOOOOO important to have some decoupling on PICAXE pupply pins.

2. The supply to PICAXE must be ROCK STEADY. This supply is used by the ADC for it's reference. If it wobbles then so will your result.

3. ADC results can vary by a digit or two. Its a fact of life.

4. It is quite easy (unless speed precludes) to take a few readings and average.

5. Have you checked the wiper voltage with a 'scope. You really aren't going to get much better than your current results without spending a little time sorting power supply variation and decoupling at pICAXE power.

6. It is NOT magic.

7. Is this PCB or some hairy old breadboard parked next to your mobile phone?

On a recent project using a 12F683 I was getting terrible ADC results, much worse than yours. I found I hadn't provided adequate decoupling between reg and PIC supply. I added 2u2 of Tantalum and now my ADC has a 1LSB of variation (in conjunction with an average-of-5 reading).
 

BeanieBots

Moderator
Concur with Dippy.
10k on a PICAXE ADC input should be rock solid.
You need to identify the source of the problem and remove it.
If it is the power supply, then no amount of 'C' on the input pin will help.

Double check the POT with a DVM to make sure the wiper contact is OK.
 

hippy

Ex-Staff (retired)
Some PICAXE variants seem to be more immune to ADC variations with download cable connected than others in my experience but using the enhanced download interface ( BATxx clamping diode ) or, as I tend to, a 1N4148 in series with the PC's TX line, should minimise variations caused by having the download cable connected.

There is always the possibility of some variation of 1-bit as the pot may be right on the boundary of one READADC value and the next but larger variations usually indicate a more significant issue, pot resistance too high, unstable PSU, circuit design error, noise pickup or download cable effects and all else mentioned above.
 

xtech007

Senior Member
thanks for the fast reply!

to answer some of your question I'm using the power supply from the axe090
with a 28x1 pic and powering the pot from the same.. I will try to use another source of power to see if it will help..
Thank you guys..
 

westaust55

Moderator
So does that mean that you have an 9Vdc supply feeding into the 7805 regulator on the AXE090 board?

Besides the 28X1 mentioned and the 10 kOhm what other circuitry is the 7805 supplying?
 

moxhamj

New Member
Dippy has made all the right suggestions. #7 is not a flippant remark either - RF can have a big impact. That includes coupling from the human body from flouro lights, and interference from a nearby PC. A metal box solves those problems. But I'd suspect a power supply first - how many decouping caps are there, what caps are on the power supply, do the grounds come to a common point or are there "hum loops" with multiple paths back to ground? Could you post a quick photo and a quick schematic? Readadc should be rock solid on 8 bit resolution with maybe a digit here or there at 10 bits, especially with a 10 turn pot. A scope helps, especially if you set it so that 50hz shows up at the right resolution. 50hz gets everywhere!
 

xtech007

Senior Member
Lots of great responses!

Mr.westaust55
Your suggestion is correct I'm feeding with a 9v to the regulator of the
axe090. and using the boards V+ and 0V to feed the pot. and using the pin headers for readadc.
is this a problem?

Like mention before I will try using a differnt power supply to see if it helps.
I dont have anithing else connected to the board just the pot. No caps or resistors.
 

westaust55

Moderator
It should NOT be a problem feeding the 10k Ohm pot from the AXE090 +5V regulator. The current draw is only 0.5mA.

As already suggested, you need to check the voltage at the pot wiper (moving) connection to see if you are seeing any variation in voltage there.
 

Dippy

Moderator
If you look in Manual 1 or Data Sheet you will see the PICAXE + and - pins marked.
Usually marked as +V and 0V.

Then you get a capacitor and you stick one leg of it on PICAXE+V and the other leg on the PICAXE0V. It don't get much easier.

If using a polarised capacitor check the body markings or leg-length to make sure your + and - is round the right way though.

The technical term 'stick' means one of the following:-
1. Stuff into breadboard.
2. Solder it.
 

xtech007

Senior Member
Sorry for the Delay.. but Finally found a solution !

Thank you guys for all suggestions, I tested all the possible causes and like always you were "RIGHT in the Money".
The power source from the AXE090 I was using was affecting the pot reading.
I used a PC power supply with a little hack to it and I had 5.1 Volt steady, well now I also have 12V and 3.5V power supply.

Now I get a cool reading for example: in center position (Pot) 174-175
I also added a pause 350 to the code..

Thanks.
You guys are great !!!!!!!
I hope my mistake helped others..
 

Dippy

Moderator
Well done. It's appreciated that you posted your conclusions.

Don't think of it as a 'mistake'.
A lot of these things arise from experience. And now you have the experience.
I'm sure many of us have simply had similar problems (or should I say "challenges"?) in the past and had advice from other old lags.

I must add that this would be another useful tip to go into a 'Basic Electronics' appendix in the Manuals.

It's (vaguely) interesting that decoupling is stressed quite heavily in the 800 page 'family' Data Sheet from Microchip on dsPIC ADC measurements.

Will it help others? Yes, the few that read this thread.
But it will crop up again... just like PWMing power MOSFETs ;)
 
Top