Shop OBEX P1 Docs P2 Docs Learn Events
RCTime for 1024+ pot divisions? — Parallax Forums

RCTime for 1024+ pot divisions?

Kirk FraserKirk Fraser Posts: 364
edited 2005-04-22 20:57 in BASIC Stamp
The PBASIC Help for RCtime includes:

····· "On the BS2, the unit of time is 2 µs, that time (1.204 x 10-3) works out to 602 units. With a 10 kΩ resistor and 0.1 µF capacitor, RCTIME would return a value of approximately 600."

Does this mean with the BS2p or BS2sx which have time units more than one less than 2 us, the vaule would be about 1200 or so?· I need to have a Stamp detect 1024 or more·potentiometer divisions·-- not less over a full turn.

Comments

  • BeanBean Posts: 8,129
    edited 2005-03-03 12:25
    You would use a larger value capacitor. But you will probably need an A/D converter if you want that kind of resolution.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out· the "SX-Video Display Module"

    www.sxvm.com
    ·
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-03-03 15:39
    I agree with Bean -- use a MAX1298 and you'll get plenty of resolution.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • SteveWSteveW Posts: 246
    edited 2005-03-03 15:50
    Possibly more resolution than makes any sense for a pot... You certainly won't get linearity that good, and probably not repeatability. Certainly not temperature stability.
    What kind of mechanical setup is being used to deliver these accuracies? (1/3 of a degree implies very little backlash, and an unusually well built potentiometer shaft / bearings...)
    (Not discouraging the use of an ADC here, just wondering if that much resolution is actually going to help...)

    Steve
  • Kirk FraserKirk Fraser Posts: 364
    edited 2005-03-03 18:19
    These are $10 industrial pots used in sewing machines for lifetime positioning service, not the $1.50 kind you buy off-shelf.

    Thanks for the larger capacitor and MAX1298 suggestions.
  • SunflowerSunflower Posts: 48
    edited 2005-03-03 19:12
    I have similar requirements. Where do you get your pots?
  • BeanBean Posts: 8,129
    edited 2005-03-04 01:26
    Not sure of the application, but you can also use a multi-turn pot. I know they make 10-turn pots.
    Which means you have to turn them 360 degrees 10 times to get thru the whole resistance range.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out· the "SX-Video Display Module"

    www.sxvm.com
    ·
  • Kirk FraserKirk Fraser Posts: 364
    edited 2005-03-04 04:26
    Thanks Bean, it's a robot application so 10 turn pots won't work. The pot is the position sensor on a rotary actuator so it can only do 280 degrees max. back and forth.

    I hope your idea about the larger capacitor works so I don't have to buy a bunch of A/D chips and use lots of extra Stamp pins. But since I'm taking Digital Electronics this term, maybe I can make a multiplexer to scan a bunch of them using only one set of pins.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-03-04 08:20
    Kirk -

    I'm not sure I understand your exact requirement here, but take Bean's 10-turn pot idea with an indirect rather than a direct linkage. The indirect, mechanically advantaged linkage might be fine-tooth gear driven to effect the multiple turns, giving you the high resolution you seem to be seeking. A small rotation in the actuator yields a large movement in the 10-turn pot. With a ball bearing pot, and tight mesh gears, the backlash issue should be minimal.

    Regards,

    Bruce Bates
  • Kirk FraserKirk Fraser Posts: 364
    edited 2005-03-04 08:45
    Bruce,

    Interesting but a little to complicated for me. Sorry. I guess a simpler idea on the same lines would be to buy those off-shelf drill pumps and use it to pump hydraulic oil in proportion to the angle of rotation and that could drive a 10 turn pot.

    Kirk
  • BeanBean Posts: 8,129
    edited 2005-03-04 14:51
    Kirk,
    What I think we are all getting at is that it is not practical to measure a normal pot to 10-bits, especially with an RC circuit.
    It's like trying to measure a 10" thick sponge to a thousandth of an inch. Every measurement is going to be different.
    8-bits (256) is realistic with an A/D converter, about 6-bits(64) with RCTime. Just my opinion though...

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out· the "SX-Video Display Module"

    www.sxvm.com
    ·
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-03-04 16:50
    Hi Kirk,

    You know, you don't have to buy multiple ADC chips and use as many Stamp pins. You can buy a single ADC with multiple inputs and address it using only two or three stamp pins. For example, the TLC2543 in a 20 pin package has 11 analog inputs, 12 bits (4096 steps), uses 4 Stamp pins, and converts an analog reading in less time than it takes for the Stamp to get from one instruction to the next. Here is some info on the Stamp interface: www.owlogic.com/OL2tlc2543.htm


    Here is a URL with information on capabilities and limitations of the RCtime command: www.owlogic.com/BS2rct.htm

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Kirk FraserKirk Fraser Posts: 364
    edited 2005-03-04 19:54
    Bean,
    I understand the difficulty but I think in this case it's better to spend a little to test the maximum reliable precision on a sample then build to that instead of just assuming I can't get what I want. Not saying my robot will ever do surgery but if it did, you wouldn't want it operating at 6 - 8 bits (64 - 256 angles) when it could be operating at 10 bits (1024 angles) would you? Industrial pots at $10 are affordable compared to linear position sensors that cost $100+ each. Making a gear system to drive ten-turn pots could become expensive in cost, realignment after abuse, and power drain for multiple joints. Thanks for the effort and details on what resolution to expect with RCTime & A/D.

    Tracy,
    Thanks much for your referrals! It looks like an ideal choice to test and for production if it turns out I can't get some least significant bits reliably I can throw them away by software -- but if under certian conditions they are reliable then I can program for those conditions. And if I really have to fall back to an 8 bit then I'll have proved it to myself. It could turn out the TLC2543's 11 inputs will pay for it compared to single input ADC's even if I end up using only 8 bits.

    All,
    This is a great value of this forum, to learn the best ideas before spending money on a poor idea. Thanks.

    Kirk Fraser
  • BeanBean Posts: 8,129
    edited 2005-03-05 01:59
    Kirk,
    Yes I agree. A wise man once said "One experiment is worth a thousand opinions". That why in my previous post I said "just my opinion". It you do test it out, please let us know the results.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Check out· the "SX-Video Display Module"

    www.sxvm.com
    ·
  • Kirk FraserKirk Fraser Posts: 364
    edited 2005-04-03 05:24
    Hi Bean,

    I have the major parts, a new TLC2543 and a new Stamp 2P40 both plugged in to my proto board and Tracy's link http://www.owlogic.com/OL2tlc2543.htm with its wiring plan but I'm a little confused on how to perform the test mechanically. It seems unlikely that I could get the pot to move and return to exactly the same spot from both directions to tell if the bit pattern was the same or if there is backlash or something that reduces the actual resolution. Without that all I can say is the TLC2534 with 11 channels for $4.50 or the MAX1298 Jon suggested with 5 channels for $3.25, both producing 12 bits both seem affordable so even if a few LSB's are wasted, no problem at least I know I have what I need. I like the TLC2543 so far because of Tracy's help page and it's a little cheaper per channel and I have about 70 channels in my final application. Any comments?

    Kirk
  • Kirk FraserKirk Fraser Posts: 364
    edited 2005-04-22 15:50
    Bean,

    Upon testing the TLC2543, I find these things:
    1) I can manually move the pot through its range to the precise endpoints but inbetween them the LSB's cannot be repeated with manual positioning.
    2) I didn't carefully determine how many LSB's are wasted but I expect at least 4.
    3) The value of having the help provided by Tracy Allen's webpages in hooking up and programming for the TLC2543 is so wonderful it supercedes less expensive choices.
    4) It appears a BS2P can run two TLC2543's at a time, which will provide 22 inputs that will serve my needs very well.

    Kirk
  • SunflowerSunflower Posts: 48
    edited 2005-04-22 18:25
    Yes, I am having the same problem with pots and the 8 bit ADC PCF8591. Even more troubling, when I pull the other channels high the error is high and when I pull the others low the error is low by many LSBs. I can live with these gross errors but I wonder if 12 bits would only increase useless LSBs. Would the average of many reads help this wandering problem?
  • Kirk FraserKirk Fraser Posts: 364
    edited 2005-04-22 18:51
    I noticed crosstalk in the floating channels so I just added a resistor to ground on a few but I didn't think to look for a change in pot LSB's with all the floaters grounded -- thank's for the idea. In my opinion averaging won't help because your problem is to detect the current position. Instead I suggest throwing the LSB's away in your code and buying a better pot as suggested in a post above on 3/3. If you still have "many" LSB's at 8 bits, trying another ADC might help.
  • SunflowerSunflower Posts: 48
    edited 2005-04-22 19:14
    I have a good pot. The current position drifts. The box is ready for installation. I'll let the engineers make improvements later after the kernel is developed. I do wonder about crosstalk from other channels on sensors.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-04-22 19:22
    Kirk, I think your problem is not due to the electrical characteristics of your POT/ADC but the mechanics of the POT. This is likely due to one of two issues. Each device has an associated precision, trying to take measurements beyond the specified precision yeilds a result but is not reproducible and is essentially garbage data. Pots having thier value set mechanically by a human hand produces unrepeatable LSB values due to the simple mechanics of it. For instance a 10KΩ single turn pot having an travel arc of 340° means 30Ω/°. Making the assumption that you can only set the pot to ± 1° the corresponding % value is 0.3 of the total value. If you take a 12 bit sampling of the value, this leads to an error of ± 12, which just so happens to be represented by a 4 bit value and would manifest itself as not being able to set those last 4 bits to your desired value.

    Sunflower, I would venture a guess that your problem is either due issolation problems within the PCF8591 (the voltage on an unsampled channel is bleeding into the measured channel) or power supply issues. You have to remember that taking the 8 bit ADC of an analog 5V signal is measuring in 20mV increments. A fluctuation of 100mV can result in >3 bits of error, knocking your useful measurement to nearly half the bits. Do you have a bypass capacitor attached between Vdd and Vss of your ADC?
  • SunflowerSunflower Posts: 48
    edited 2005-04-22 19:36
    No, what size should I use?
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-04-22 19:40
    Typically a 10uF tantylum is a good choice, don't go below 3uF. The bypass capacitor will steady the supply lines from noise injected by the digtial portion of the chip, it isn't a gaurentee that this will fix the problem, but it is a good habit to get into.
  • SunflowerSunflower Posts: 48
    edited 2005-04-22 19:42
    Actually, yes I do have bypass caps. I will replace the ADC.
  • Kirk FraserKirk Fraser Posts: 364
    edited 2005-04-22 19:58
    Paul, you're right but I think there is more. A human hand was reportedly measured as able to detect 1/32,000" (which is about 7.6 seconds on a 1/4" shaft) and the manual adjustments were informed by a readout from the POT/ADC/STAMP Debugger. Anyway I'm happy to have working sub-unit even if I must toss some LSB's. I'm now working on a D/A unit.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-04-22 20:06
    You can easily test whether this is what's occuring by measuring the resistance of the pot with a 4 digit digital multimeter. If you can set the resistance to an exact value the error is from somewhere else, if you can't it's the pot.
  • Kirk FraserKirk Fraser Posts: 364
    edited 2005-04-22 20:57
    Alrighty Paul, I did the test. First I tried for 1.00K and found it very difficult -- I could get 0.99 or 1.01 much more easily. Second I put a 1" diameter shaft expander "washer" on the shaft and it was easily set to 1.00K.

    So that means human error and I can expect when I set it up for AD again it will gain some bits with the shaft expander that will be hooked to my cylinders. But it'll also degrade somewhat as parts loosen over time so I'll play it by ear.
Sign In or Register to comment.