Shop OBEX P1 Docs P2 Docs Learn Events
Using a pot and rctime — Parallax Forums

Using a pot and rctime

ArchiverArchiver Posts: 46,084
edited 2001-08-29 17:20 in General Discussion
I have project that involves the use of a 12V motor and a pot to return
positional data. The pot is a ten turn one and is mechanically coupled to
the output gear of the motor. I have found a nice ready built dual
H-Bridge and I will be getting the data back via Rctime.

First question:- Which combination of values of pot and Capacitor would give
me the best resolution over the range (the full 16 bit's would be the
perfect) BUT still keep the time as low as possible, because in one part of
the program I would have to poll three Pots and a light dependent diode (or
fourth pot) and then move the motors in real time. In another part of the
program I would have to measure the length of a frame pulse do a load of
maths then move the motor.

Second question:- How is such a setup affected by temperature? Most
studios are not heated and then temperature at 8am can in the winter be Zero
which then rises to 35-40 degrees (Celcius)by the afternoon. If we record a
setup first thing and then repeat it all day am I going to see a difference
?

Justin Pentecost

Focus Puller and Stamp Idiot

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-08-28 17:16
    >I have project that involves the use of a 12V motor and a pot to return
    >positional data. The pot is a ten turn one and is mechanically coupled to
    >the output gear of the motor. I have found a nice ready built dual
    >H-Bridge and I will be getting the data back via Rctime.
    >
    >First question:- Which combination of values of pot and Capacitor would give
    >me the best resolution over the range (the full 16 bit's would be the
    >perfect) BUT still keep the time as low as possible, because in one part of
    >the program I would have to poll three Pots and a light dependent diode (or
    >fourth pot) and then move the motors in real time. In another part of the
    >program I would have to measure the length of a frame pulse do a load of
    >maths then move the motor.

    If RCtime returns maximum (65535) when the resistance of the pot is
    maximum, that is also the most time, about 0.13 second. But due to
    noise the RCtime command is really good for only about 10 bits of
    resolution. So you wouldn't lose much in the way of accuracy by
    shortening the time to, say, 0.02 seconds and a maximum count of
    10000. Put a resistor in series with the pot if necessary to keep
    the minimum RCtime above ~50 microseconds. What is the max
    resistance value of your 10-turn pot? How long are the leads from it
    to the Stamp.

    >
    >Second question:- How is such a setup affected by temperature? Most
    >studios are not heated and then temperature at 8am can in the winter be Zero
    >which then rises to 35-40 degrees (Celcius)by the afternoon. If we record a
    >setup first thing and then repeat it all day am I going to see a difference
    >?


    Here is detailed information on temperature dependence etc.
    http://www.emesystems.com/BS2rct.htm

    >Justin Pentecost
    >
    >Focus Puller and Stamp Idiot


    -- Tracy
  • ArchiverArchiver Posts: 46,084
    edited 2001-08-28 18:26
    >If RCtime returns maximum (65535) when the resistance of the pot is
    >maximum, that is also the most time, about 0.13 second. But due to
    >noise the RCtime command is really good for only about 10 bits of
    >resolution. So you wouldn't lose much in the way of accuracy by
    >shortening the time to, say, 0.02 seconds and a maximum count of
    >10000. Put a resistor in series with the pot if necessary to keep
    >the minimum RCtime above ~50 microseconds. What is the max
    >resistance value of your 10-turn pot? How long are the leads from it
    >to the Stamp.

    The MAX resistance is up to me [noparse]:)[/noparse] What would you suggest ?

    Justin

    Focus puller
  • ArchiverArchiver Posts: 46,084
    edited 2001-08-28 19:24
    Why not use an encoder for positioning? You can get pretty good
    resolution that way.

    --- In basicstamps@y..., "Justin Pentecost" <justin@k...> wrote:
    > I have project that involves the use of a 12V motor and a pot to
    return
    > positional data. The pot is a ten turn one and is mechanically
    coupled to
    > the output gear of the motor. I have found a nice ready built
    dual
    > H-Bridge and I will be getting the data back via Rctime.
    >
    > First question:- Which combination of values of pot and Capacitor
    would give
    > me the best resolution over the range (the full 16 bit's would be
    the
    > perfect) BUT still keep the time as low as possible, because in one
    part of
    > the program I would have to poll three Pots and a light dependent
    diode (or
    > fourth pot) and then move the motors in real time. In another part
    of the
    > program I would have to measure the length of a frame pulse do a
    load of
    > maths then move the motor.
    >
    > Second question:- How is such a setup affected by temperature?
    Most
    > studios are not heated and then temperature at 8am can in the winter
    be Zero
    > which then rises to 35-40 degrees (Celcius)by the afternoon. If we
    record a
    > setup first thing and then repeat it all day am I going to see a
    difference
    > ?
    >
    > Justin Pentecost
    >
    > Focus Puller and Stamp Idiot
  • ArchiverArchiver Posts: 46,084
    edited 2001-08-28 19:38
    >Why not use an encoder for positioning? You can get pretty good
    >resolution that way.

    I thought about but the problem is my obsession with making one unit do so
    many things. An unfortunately I don't think a stamp can read from two
    encoders at one time and in fact this will probably be four encoders but the
    advice to keep it down to 10000 was very good and makes allot sense to me.
    Of course the other good thing about pots is that even if the unit is off
    they know if motor (in this on an iris ring) has moved.


    Justin Pentecost
  • ArchiverArchiver Posts: 46,084
    edited 2001-08-29 05:59
    > >If RCtime returns maximum (65535) when the resistance of the pot is
    > >maximum, that is also the most time, about 0.13 second. But due to
    > >noise the RCtime command is really good for only about 10 bits of
    > >resolution. So you wouldn't lose much in the way of accuracy by
    > >shortening the time to, say, 0.02 seconds and a maximum count of
    > >10000. Put a resistor in series with the pot if necessary to keep
    > >the minimum RCtime above ~50 microseconds. What is the max
    > >resistance value of your 10-turn pot? How long are the leads from it
    > >to the Stamp.
    >
    >The MAX resistance is up to me [noparse]:)[/noparse] What would you suggest ?
    >
    >Justin
    >
    >Focus puller

    Hi Justin,

    The equation is,
    t = 0.30111*R*C
    t: time in microseconds
    R: resistance in ohms
    C: capacitance in microfarads
    Okay, make it come out at about 20000 microseconds maximum, 0.02
    second. That will be 10000 counts from the RCtime command. Choose
    0.68uF to start. For best stability the capacitor should be a film
    type. From there the equation comes up with a 100kohm pot, which is
    readily available in 10-turn. Put a 1000 ohm resistor in series to
    set a minimum value, a time of about 200 microseconds.


    Vdd 5V
    |
    ===== 0.68 film
    |
    |
    Vdd -o--/\/\---/\/\---o--/\/\-- P0
    `---^ 1000 220
    100k
    pot

    tm var word
    ohms var word
    high 0
    loop:
    RCtime 0,1,tm
    high 0
    ohms=tm*10 ' approximately
    debug ? ohms
    goto loop

    -- regards,
    Tracy Allen
    electronically monitored ecosystems
    mailto:tracy@e...
    http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2001-08-29 17:20
    Hi Justin,

    Oops, the Vss was incorrectly marked. Here is the corrected
    schematic with the pot connected to Vss. The leads from the stamp
    out to the pot should be as short as possible, or shielded if noise
    pickup is a problem.


    Vdd 5V
    |
    ===== 0.68 film
    |
    |
    Vss -o--/\/\---/\/\---o--/\/\-- P0
    ^ `---^ 1000 220
    100k
    pot
Sign In or Register to comment.