analog input question.

tzurs

New Member
hi,
I have the 28a starter kit. all is working fine. I'm trying to use the readadc command. I have a 10k potentiometer, it has 3 wires going out of it. I'm trying to understand where each of them should be connected to the kit analog "input" ribbon when trying to readadc from analog input 0 for example.
I measured the potentiometer itself independent of the board and it gives correct values when turning it.
I would add that I'm using an external supplier for other outputs in my system, (took the little dip switch out).
any help mostly appriciate.
--tzurs.

 

Technical

Technical Support
Staff member
Use the V+, analogue input and 0V wires of the 10 way riobbon cable (analogue input from centre leg of the pot).

Which wire is which is illustrated in the manual

<A href='http://www.rev-ed.co.uk/docs/axe020.pdf' Target=_Blank>External Web Link</a>
 

tzurs

New Member
thanx for the quick reply!
does it matter which leg goes to the 0 and v+ ?
the input one I understand has to be the &quot;center&quot; of the pot?
does it make a differnce what pot. I use? it 10k ok?
because the suggestion does not seem to currently work, I'll try switch the pot. to a another one,
thanx!
--tzurs.
 

Rickharris

Senior Member
10K should work fine. one side of the pot i.e. an outside connection of the 3 available, should go to + 5 Volts. The center connection goes to the picaxe input. The other side connection goes to 0 volts.

When the pot is turned a voltage between 0 volts, turned fully to one end and +5 volts, turned to the other end will be measured at the analogue input. You should be able to measure this voltage with a meter at the appropriate Picaxe input.

The picaxe converts this voltage into a number between 0 and 255.

It should work Ok, check wih a meter if you can to see that things are connected up OK.
 

tzurs

New Member
thanx for the help.
I tried your suggestion.
I use the sample problem (readadc into b0, debug b0) and have connected the pot. according to what you said. (3 wires, the red, 9 - to the middle of the pot, and 10) of the ribbon
I went a step ahead and readadc all ports (0,1,2,3) and debug all of them.
the results are bizzare.
I get 21 (value?) on the correct pin.
turning the pot. to the other direction only changes the debug report to 24 or something around that.
the pot. is 10k.
and I'm not even sure the read is correct.
my measuring device is showing 1.5 v. when the knob is to most left and 3.5 when to the other side.

anyone can help here?
I would add again that I'm not using the v+ output for other sources, but instead using a n external source.
Please help me, I'm frustated completely.
--tzurs



 

Rickharris

Senior Member
After linking the 0 volts, can you measure the voltage on the center pin of the pot and confirm it goes from 0 to +5 v.

Why not use the +5 v and 0v from the board?
There has to be something strange here because this works very well normally.

 

Chugger

New Member
Just a shot in the dark but is the 0v line of the power supply for the pot connected to the 0v line of the PICAXE power supply?
Pot check list:
Connect the pot, one outside leg to external power supply +ve, the other outside leg of the pot to the 0Volt line of the external power supply. Connect a multimeter set to volts , red lead to the centre pin of the pot , black lead to the pin that goes to the power supply 0Volt line. Turning the pot should give you a voltage between 0Volts and Vexternal supply on the meter.
If that works, remove the meter and connect the centre pin of the pot to the ADC pin of the PICAXE, and connect the 0Volt leg of the pot to the OVolt pin of the PICAXE. That should get you a variable voltage on the ADC pin of the PICAXE.
 
Top