PDA

View Full Version : [Question(s)] PICAXE-14M readadc pot



kankatee
11-26-2008, 05:04 PM
I have a PICAXE-14M and am trying to correctly read a pot on pin0. Thus far I am actually reading it via readadc 0, b0, but only seeing a value from 0-110. I was under the impression I would see 0-255.

Is this not always the case?

Thanks in advance,
David

elios
11-26-2008, 09:20 PM
what pot are you using? try a 100k ohm pot

Adrenalynn
11-26-2008, 09:40 PM
Doesn't matter. 8 bits is 8 bits.

You may find you need to scale your output at the extreme ends, but I'd be surprised if that's the issue only seeing about 50% of your range.

That said - I have less than zero interest in the PicAxe, so can't be of more specific help...

elios
11-26-2008, 09:50 PM
if it isnt a 100k ohm pot, the odds of it working to its full extent are minimal

Rudolph
11-26-2008, 10:39 PM
What voltage range does the PIC expect to see at an analog input, (eg 0-5)? And are you supplying that max (eg 5) to the pot?

Adrenalynn
11-26-2008, 10:55 PM
if it isnt a 100k ohm pot, the odds of it working to its full extent are minimal

Would you please teach me the electrical theory that would require a five volt source be put through a 0-100k resistance ONLY in order to scale across 8bits of resolution?

Is this a PicAxe-only thing, or have I been doing it wrong for as long as microcontrollers have existed? If it's not a PicAxe only thing, why do 5k, 10k, 25k, 1MOhm pots work fine on every other micro I've touched? If it is a PicAxe-only thang - what specifically is happening electrically to introduce such limits?

jes1510
11-26-2008, 10:57 PM
Rodolph has a good point. Verify the output voltage from the pot is what you would expect in relation to the value the PIC is reading. Do the same thing directly on the pin of the PIC.

Check all of your connections and when you think they are right then check them again.

Adrenalynn
11-26-2008, 11:29 PM
Agreed with Rudolph and Jes. If the voltage isn't what you think it is (ie. you're reading 0-5v from a 0-3v source) - then the upper end would be gone.

The size of the pot, within reason, won't make any difference in getting the full 5v when it has [near] zero resistance... 1k, 10k, 100k, 1000k, 1000000k - it's all 5v when pumped through zero resistance.

elios
11-27-2008, 01:20 AM
true, (i am 14 and still at school, from a small physics lesson) Dr. Duthie said that something with a round number ( 50, 10, 5, 100k etc) should work with a PICAXE. One pin should be the +ve (same supply of picaxe) and then the third pin should be -ve/common ground with the picaxe to balance it. the mid pin should go to the PICAXE. and as you know, picaxe can only take up to about 5.5v without (boom).

clears stuff up for you?

Adrenalynn
11-27-2008, 02:49 AM
Nope!

It could be 12194.70492 Ohm pot and still work fine. You won't get that kind of resolution at 8 bits, but regardless it's still going to range from 0-255 for 8 bits or 0-1023 for 10 bits. At 0 volts passing through it will read digital 0. At 5v passing through it will read 255. (or 0 and 1023 for 10 bits of resolution) The value of the resistor doesn't matter if 0 volts makes it through, nor does it matter if 5 volts makes it through. The number of steps in the middle is the only question that resistor is answering...

The middle pin is called the "wiper", btw.

kankatee
11-27-2008, 10:14 AM
As always, thanks for the prompt replies.

Here we have another classic end user error. The pot I was using was part of a dual axis joystick (Game Cube controller). I ran continuity test on all six leads to ensure isolation. But then soldered them back onto the pcb. Had I tested continuity after soldering I would have found my problem. The two pots were hooked in series. So that fact that I was seeing a ~110 reading via readadc was correct. I will now commence bastardizing the circuit board with a dremel.

Going to eat turkey and sleep on the sofa. Happy Thanksgiving everyone.