Reading Multiple POTS, one POT affects the other
SiCC
Posts: 21
Sorry if this is a stupid question. I searched but couldnt find an answer.
I have a Prop which needs to read multiple POTs. I have used the parallax example of reading 2 pots in parallel as well as the running RCTime (from Obex) successively. No matter how I code it each POT affects the others value after RCTime. Each uses a different Pin and has its own cap and resistor, the only thing they share is ground.
If its a hardware problem, what am I missing? Or is it software?
I have a Prop which needs to read multiple POTs. I have used the parallax example of reading 2 pots in parallel as well as the running RCTime (from Obex) successively. No matter how I code it each POT affects the others value after RCTime. Each uses a different Pin and has its own cap and resistor, the only thing they share is ground.
If its a hardware problem, what am I missing? Or is it software?
Comments
-Phil
This routine is not locked to specific pins or result variables so you can reuse it with multiple pots. For example, if you had a dual-axis on pins 0 and 1, you might call the method like this:
Note that you have to pass the address (@) of the result variables you want to use.
i used the schematic off of the stamps in class pdf, page 151. except my setup has 2 seperate sets, not sure how to copy that image onto here.
-Phil
here is how i call the routine from my program, i just have it repeat for now while testing:
repeat
POT.Main(BRAKE_POT,THROTTLE_POT,@potPos1, @potPos2)
pst.dec(potPos1)
pst.str(string(","))
pst.dec(potPos2)
pst.char($0D)
waitcnt(clkfreq + cnt)
when i attach the 2nd POT, it cuts the 1st POT's value in half. its like they are physically attached but they are not. I will try to snap a pic for ref.
-Phil
thanks ferweins, your 1st post is full of awesome.
here you go phil. (btw im over in gig harbor, not too far from you.)
there is plenty of garbage in there, will clean up after everything works. in the above, it starts up my COM's etc and then just repeats funct 56. however i can compile just BlakePOT from the code a few posts ago by hard coding the pins etc, and i get the same results.
-Phil
Close, but the first lead from my POT is before the 220ohm, vs after it. That wouldn't cause my problem tho would it? Here is a super crappy cell phone pic, I tried to touch it up some. The 2nd POT setup is on the other half of the board, and is identical.
I have tried adjusting to much higher than 1ms, no effect.
That 220 ohm resistor is there in case your pot goes to zero ohms. It's a way of ascertaining that the Prop pin doesn't have too much current running through it for whatever reason.
Have you walked through your circuit with a multimeter to read the voltage values all along the circuit? I'm guessing you're sure to see a voltage sagging or shorting or not grounded somewhere.
Also, I can't really tell what's going on in your cellphone photo. Can you take another shot?
-Phil
Feel free to post as many simple and basic questions as you like.
The members in this forum are really friendly and patient even with the
most basic questions. I often think the propeller-chip is a microcontroller
that is attractive to people that are very open-minded and therefore patient.
If you look through the threads of this forum you will find basic questions
and high advanced questions and threads. So this is a place for everyone.
From beginners learning how to code for the first time up to assembler-tweaking-freakin-freaks doing things that make the brains of other assembler-tweaking-freaks SPIN in twisted-circles ;-)
Parallax and the members of this forum always like to improve the
"feel-at-home-factor" as much as possible.
You wil NEVER get a "RTFM" (read that f... manual) as an answer.
You will get good will and direct help or a detailed hints WHERE in the manual more detailed information can be found.
If you want to accelarate the solution of your problems you should attach your COMPLETE code
and a SCHEMATIC that shows ALL Pots of your circuitry and how they are connected.
The picture that you attached does not explain everything. (Except that you use the unusual color red for
ground. (Usually ground is black or blue and red is +3.3V or +5V (=Vdd)
Take a look at the attached picture to learn how to archive your SPIN-code with a few mouse-clicks
and how to upload it to the forum
Upload a SCHEMATIC the same way. (I mean a symbolic drawing) of your complete circuitry)
Without this details everything is guessing through the fog.
best regards
Stefan
Use RCTIME to calculate your cap/pot curve.
I read 12 pots in a single cog, and the values don't cross modify (except a few points)
I changed the way I wired my pot/rc circuit, and also added a large cap very near the props power pins, i also use tantalum caps in the rc circuit
You can look at my schematic and code to see how my black box v2.0 works.
http://forums.parallax.com/showthread.php?115258-TheBlackBox-Release-v2.0-Propeller-HSS-FX-Sequencer-with-Digital-Audio-SPDIF
Main Program:
POT.Main:
The colors mean nothing. I know they are wrong
Im not really sure how to check this other then I have good cotinuity from any Gnd to any Gnd anywhere in the project. Is there a better test?
I glanced at this at work, going to take a better look this evening. Thanks for the info, hopefully Ill find my cure.
OK I will comment on the picture.
Aha you are using a propeller demo board.
you are using resistors and capacitors
the wires have different colors
I guess the blue-white wire is connected to Vdd not a prop-pin as you wrote
for the rest. Hey I haven't wired this board. So it is UNCLEAR to me how the whole thing is connected to each other
You really should provide a SYMBOLIC schematic. Usually I'm a patient guy. But in this case you are not doing yor homework.
I'm willing to help if you do your homework.
Your homework is to draw a schematic of how you wired the things together and creating an ARCHIVE of your SPIN-files
by clicking Mainmenu of the propellertool File - archive - project
Please explain to me what is so hard about drawang a schematic by hand and take a picture of it?
What's so hard about creating an archive with the propellertool?
best regards
Stefan
Yes, there is more to testing than mere continuity. If you have a voltmeter or multimeter, connect its negative lead (usually black) to your ground (Vss) and then use the positive lead (usually red) to probe around and check voltages and to check how those voltages change as you turn your pots or provide commands to your Propeller pins. If you do not have a multimeter, then it's about time you get one, cost maybe $10 to $20 at Radio Shack, even Home Depot sells them, maybe even Walmart. If you do have a multimeter, then now is the time to learn to use it. Just google "How to use a multimeter?"
Also, drawing schematics helps others help you. It's a very good practice to develop. Sometimes the mere process of drawing your circuit will allow you to see potential problems - no pun intended.
Good luck!
I figured snapping a pic was better since you had already posted the schematic I was using yesterday. Anyhow, problem resolved. I cannibalized pins 21 & 22 on the demo board since I had run out of Pins [0-8]. They work fine for serial, tested at 115200 baud, but when used for measuring POTs they screw the readings. I rearranged my GPS to use these pins and moved the POTs to pins 4/5. Working great now.
Thanks for the help everyone. Sorry to have offended you and your patience Stefan, next time I will remember to bring my crayons.
-Phil
Correction: I just relooked at your code. You did use 20 and 21, which are joined resistively in the DAC. Case closed.