Potentiometer Questions & Specs

LightGuy

New Member
Hi everyone,

I have a project that I'm doing for a friend. It will read two potentiometers and set a two different times to turn one or two lights on or off.

Right now, I'm playing with two 10K pots from Radio Shack with an 18X in the Picaxe demo board. First, are the freaky readings I'm getting when I use Readadc10 due to the serial download cable as mentioned in the manual? (I will try the USB when I can find it.)

Second, neither of these two pots results in a 255 reading. They both go to zero just fine, but the closest I can get to the top is about 252. Is this because I'm running off of the 3xAA battery pack or just crappy pots?

Third, the "dead zone" is different on both of them. One has about 10° before the ADC starts falling and the other has about 30°. Once again, crappy pots?

Lastly, what do I need to spec for the part to get full range out of the pots I will eventually order? I may be making five or six of these, so I can't really do a high precision pot, but is there a way to order them more "uniform"? Is there a cheaper hardware solution to this (like a trim pot)?

Thanks! This is really fun, but frustrating at the same time.
 

moxhamj

New Member
Odd readings - ? power supply fluctuations. 22uF/0.1uF on power supply. Also try 0.1uF between ADC pin and ground to smooth out pot values.
Not going to 255 = the pot. Try another.
Dead zone - probably these are logarithmic pots, not linear ones. Log pots are used for volume controls. Next to the 10K there might be a code letter, A, B or D which tells what the pot is. Or a quick test - set the pot to mid point and measure the resistances between the wiper and each of the two other connections. - they should be roughly equal in a linear pot and quite a lot different in a log pot.
Also old pots can get dead zones in them simply from the carbon tracks wearing out. A new linear 10k pot ought to be fine. Does it matter if it doesn't go to 255?
 

LightGuy

New Member
Actually, they're brand new out of the box and linear. I was going to go to the actual electronic supply house, but it was cheaper in gas to just buy these things for $3 each. They could have been packaged incorrectly, though. The code says Alpha 7D2.

Thanks for the pointers! I will see if it makes any difference tomorrow.
 

MFB

Senior Member
Why is readadc10 returning a maximum value from the pot of near 255? It should be nearer a value of 1000 for a 10-bit conversion.

Regarding the supply voltage, as long as the PICAXE and the 'top' of the pot are both driven from the same voltage you should still get full-scale readings. The reason that you are not seeing full scale is probably that the end of pot track resistance and ADC input impedance are acting as a potential divider. At the expense of extra power consumption, you could try a lower value pot.
 

moxhamj

New Member
Yes, agree with MFB and readadc10 should read 1023 at full scale (2^10-1). I've never used pots with a variable power supply (ie batteries). There are too many variables including the internal resistance of the batteries which varies under load. Have you got a 5V regulated supply you can use to test the pots and the circuit? If not, perhaps hack into the PC. Having built many supplies over the years, my current working supply is simply from the PC used to program the picaxe. It is jut a matter of not being afraid to get inside a PC case and start stripping some wires from the power supply and soldering your own wires onto those and bringing them out onto a protoboard using a few banana plugs.
 

hippy

Ex-Staff (retired)
A pot across the PICAXE power rail and 0V should always give 0 to 255 or 0 to 1023 reading. Very weak / dying batteries might cause problems and any R between the wiper and ADC input could reduce the reading.

Don't expect to get correct readings if not using the enhanced download circuit while connected to a PC via the download cable. Instead of a BATxx between Serial In and 0V it may work with a diode between PC Rx and the 10K/22K ( pointy-end away from the PC ).
 

Ralpht

New Member
A simple cheap Pot is a simple cheap Pot.

Remember there will be manufacturers tolerances. A 10K 10% resistor will vary either direction by up to 10%. So a cheap pot will be no different.

The 10K means 10K ohms. Whethere it's linear or Log depends on an Alpha code on it as well.
A=Lin
B=Log
C=Antilog.

If you are getting close to the min and max values you expect from the circuit then it is probaball working OK.

If you want greater prescision you will need to bite the bullet and fork out a lot more for the pot and / or buy a 10 turn pot, but they are usually trimmpots any way.
 

LightGuy

New Member
Yeah, I'm an idiot. :D

The jumping is gone because either A) I'm using the USB cable now or B) I've decided to, oh, I don't know, realize that the little arrows that expand the Debug window to show the words is there for a reason.

Also, when troubleshooting, pay attention to the type of data returned by the command!

It's still only going up to 1019, even with brand new batteries. I will get some better pots tomorrow. No difference with a regulated 5V from a 7805. Must be the pots, then.

Thanks for the input, guys!
 
Last edited:

MartinM57

Moderator
I think you are possibly wasting your time and money seeking 1020, 1021, 1022 and 1023 out of READADC10

We are talking approximately 4 parts in 1000 or 0.4% - do you really need that?

What happens if you connect the ADC input directly to the supply rail? What do you read then?
 

hal9000

Member
i agree, surely you can just code round this by bracketing your readings to the available range your pot currently gives?
 

saunj

Senior Member
A pot across the PICAXE power rail and 0V should always give 0 to 255 or 0 to 1023 reading. Very weak / dying batteries might cause problems and any R between the wiper and ADC input could reduce the reading.

Don't expect to get correct readings if not using the enhanced download circuit while connected to a PC via the download cable. Instead of a BATxx between Serial In and 0V it may work with a diode between PC Rx and the 10K/22K ( pointy-end away from the PC ).
I am in the US and can't get these BATxx Shottky diodes here. But I'm an "old Codger" and have a supple of germanium diodes for the "enhanced download circuit". They work fine.
John
 

Michael 2727

Senior Member
There are ways and then there are ways you can do it.

You need to include a current limiting resistor 1K to 10K
between the Pot wiper and the ADC Input, Use Fig 2.

Note: Not using this resistor could result in grief if the Pin
used was to become programmed as an output !

Code:
  Fig 1         Fig 2          Fig 3         Fig 4          Fig 5
   o  +POS        o  +POS        o  +POS       o  +POS        o  +POS
   |              |              |             |              |
   / Any          |              o----.        |             .-.
   \ Resistive    | Pot          |    |        |  Pot        | | 10K
   / Device       | wiper       .-.   |       .-. wiper      | |
   \              |             | |<--'       | |<------>    '-'
   /              | To ADC      | |           | | To ADC      |
   |             .-. input      '-' Pot       '-' input       |
   | To ADC      | |<------->    |  wiper      |              |
   |  input      | |             |  tied to    |              |
   o------->     '-'             |  one end    |              |
   |              |              |  of pot.    |              |
   |.             |              o -------->   o              o
   |              |              | To ADC      |              |
   |              |              |  input      |              |  To ADC
  .-.             |             .-.           .-.            .-.  input
  | | 10K         |             | | 10K       | | 10K        | |<----->
  | |             |             | |           | |            | |
  '-'             |             '-'           '-'            '-'  Pot
   |              |              |             |              |   wiper
   |              |              |             |              |
   o NEG          o  NEG         o  NEG        o  NEG         o  NRG


(created by AACircuit v1.28.6 beta 04/19/05 www.tech-chat.de)
 

Rickharris

Senior Member
Yeah, I'm an idiot. :D

The jumping is gone because either A) I'm using the USB cable now or B) I've decided to, oh, I don't know, realize that the little arrows that expand the Debug window to show the words is there for a reason.

Also, when troubleshooting, pay attention to the type of data returned by the command!

It's still only going up to 1019, even with brand new batteries. I will get some better pots tomorrow. No difference with a regulated 5V from a 7805. Must be the pots, then.

Thanks for the input, guys!
A simple test - Connect ADC input direct to supply - should read max value - if it does your pot isn't spanning the full scale.

If not ? Another problem.
 
Top