---------- > From: Norm Cramer > To: PICLIST@MITVMA.MIT.EDU > Subject: Best way to read a POT without the A/D? > Date: Wednesday, January 07, 1998 11:42 AM > > What is the best way to read a POT without using an A/D converter? I need > to generate values between 0 and 128 from the reading. It also needs to be > repeatable i.e. when the POT is not moved, the same number is generated. > The time limit for reading is not too critical, maybe 250 msec or less. > Idealy it should not need "calibration" so that multiple units would behave > the same. > > What I am currently doing is the method shown at: > http://www.geocities.com/SiliconValley/2499/answers.html#PIC00065 > and measuring the charge time. The times seem to vary quite a bit when the > pot is in the same position. > > Is there a better way to get more stable readings? --------------| Output Bit | | / Rh | \ | |--------------| Vin Sense bit / | | \ Rl === C | | | | ------- | GND Vin the sense bit is at the threshold of the gate going into the micro controller. Rh and Rl are the two resistors parts of the POT The output bit is PWM by software to act like a variable voltage for the resistor chain. Rl Th Vin = -------------- * ------------ * K Rl + Rh Th + Tl "Th" is the high time of the output bit and "Tl" is the low time of the output bit. The software to measure the pot position toggles the output bit to keep the Vin at the gate threshold. Solving the above equation will show that there is a direct relationship between the software PWM times and the pot position. Practical implementations will have two fixed value resistors on each end of the POT so the POT will operate over its entire range. The C value is non critical. It is only used for filtering. Walter Bankls