Shop OBEX P1 Docs P2 Docs Learn Events
Measure resistance with RCTime — Parallax Forums

Measure resistance with RCTime

knightofoldcodeknightofoldcode Posts: 233
edited 2007-08-04 20:59 in BASIC Stamp
Group,


I'm having a hard time figuring out how to go from a RCTime unit measurement to a ohm resistance value.

My setup uses a 10K potentiometer, 220 ohm protection resister, and a .1 uf cap. I tried it with a 1 uf cap, and got the same results, but of course multiplied by 10.

When I run the command I'm getting expected RCTime units back, I just don't know how to take that value and turn it into a ohm value. I'm using the BS2, I know that the voltage threshold has to play in there somewhere as well as the number of microsends per unit, but I'm still very confused how to get out a resistance.

I THOUGHT it was:

r = RCTime * 2 / .1 (uf)

But I don't think that's right.

I realize that this is probably something that has been gone over before, but I've tried searching the forums, and the search function is still HORRIBLE. I can't seem to search for anything but one keyword. [noparse]:([/noparse]

Much thanks in advance,
Knightofoldcode.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-
This message transmitted with 100% recycled electrons.
-=-=-=-=-=-
Gravity doesn't exist. The Earth sucks.
-=-=-=-=-=-
Make a man a fire, and he will be warm for the night.
Light the man on fire, and he will be warm for the rest of his life.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2007-08-04 12:35
    Knight,

    For the theory in how RCTIME works with the switching points in the Stamp, the Help file has a good explanation.

    To do what you want, in practical terms, consider the values that get returned by the Stamp:

    When the pot is at maximum (10K), the result will be, say, 4500 (or 3000, or 500, depending on the capacitor). When its at minimum (0 ohms), the returned value will be close to zero.

    So, to deliver a number that represents the pot ( 0 to 10000), you would multiply the result by 2.5. If the result at max resistance were 500, you'd multiply by 20, and so on.

    This gives a straight-line conversion from RCTIME result to pot resistance. In some applications, you may need to build a lookup table to account for non-linearaity in the sensor or the capacitor.

    Hope this helps.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2007-08-04 14:05
    Yep, PBASIC Help "says":

    RCTIME units = 635 x R (in k&#937[noparse];)[/noparse] x C (in µF)

    Therefore·--·R (in k&#937[noparse];)[/noparse] = RCTIME units / 635 / C (in µF)


    Post Edited (PJ Allen) : 8/4/2007 2:10:06 PM GMT
  • knightofoldcodeknightofoldcode Posts: 233
    edited 2007-08-04 20:59
    PJ Allen said...
    Yep, PBASIC Help "says":

    RCTIME units = 635 x R (in k&#937[noparse];)[/noparse] x C (in µF)

    Therefore -- R (in k&#937[noparse];)[/noparse] = RCTIME units / 635 / C (in µF)

    See, now I read the PBasic manual, and it had no mention. Just alot of theory that I never understood. I'm sure if I understood the theory better, I'd understand the equation... it's just been to long since I was in school.... ya know...when will you ever use THIS?!... kinda thing. [noparse];)[/noparse]

    stamptrol said...
    So, to deliver a number that represents the pot ( 0 to 10000), you would multiply the result by 2.5. If the result at max resistance were 500, you'd multiply by 20, and so on

    That just seems ugly, however since it would be linear it wouldn't be an issue... It just seems like that's a ugly way to do it... it makes perfect sense though! [noparse]:D[/noparse]

    My application technically doesn't need to know what the resistance is, it's a linear (I hope) resistance based pressure transducer. Used to determine the air pressure of a air tank in my truck. So it doesn't technically have to know the actual resistance, in rctime "units" would be accpetable to determine the PSI.

    Much thanks,
    Knight.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-
    This message transmitted with 100% recycled electrons.
    -=-=-=-=-=-
    Gravity doesn't exist. The Earth sucks.
    -=-=-=-=-=-
    Make a man a fire, and he will be warm for the night.
    Light the man on fire, and he will be warm for the rest of his life.
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-
Sign In or Register to comment.