Shop OBEX P1 Docs P2 Docs Learn Events
Need Help Increasing the Scaling Range for a Servo. — Parallax Forums

Need Help Increasing the Scaling Range for a Servo.

ArchiverArchiver Posts: 46,084
edited 2004-02-19 16:03 in General Discussion
I have an RC circuit using a .1uf cap and a 10k variable resistor.

My RC time values are 1 all the way clockwise (min resistance)
and 605 all the way counter clockwise (max resistance)

I have no problems scaling these values with an offset to get servo
movement (duration) from 500 to 1000 but I would like to increase
the movement (duration) to 350 to 1150 which I have proven to be the
max servo movement range.

To get my values I performed the following:

time (Maximum) 500/605 = .827 * 605 = 500
time (Minimum) 500/605 = .827 * 1 = .827

After my values were scaled I added an offset:

time (maximum) = 500 + 500 = 1000
time (minimum) = .827 + 500 = 500

In my code I used the following commands:

BTW time is my Variable

time = time */ 212 ' Scale by .827 (x 256 for */)
time = time + 500

I then took time and used it as my duration argument for the servo
for positioning.

Everything works fine other then the fact that I can't seem to
figure out out to increase the range of movement. I want the
(Duration) argument to range from 350 to 1150.

Can anyone help point me in the right direction. Any help you can
offer would be greatly appreciated.

Lu Kwan

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-02-19 09:18
    Hi Lu Kwan

    Your span is now 1150 - 350 = 800. And the offset is 350.

    duration = time */ 339 + 350
    ' */339 because 800/605 = 1.32 = 339/256
    ' division by 256 is implied in the */ operator

    -- Tracy


    >I have an RC circuit using a .1uf cap and a 10k variable resistor.
    >
    >My RC time values are 1 all the way clockwise (min resistance)
    >and 605 all the way counter clockwise (max resistance)
    >
    >I have no problems scaling these values with an offset to get servo
    >movement (duration) from 500 to 1000 but I would like to increase
    >the movement (duration) to 350 to 1150 which I have proven to be the
    >max servo movement range.
    >
    >To get my values I performed the following:
    >
    >time (Maximum) 500/605 = .827 * 605 = 500
    >time (Minimum) 500/605 = .827 * 1 = .827
    >
    >After my values were scaled I added an offset:
    >
    >time (maximum) = 500 + 500 = 1000
    >time (minimum) = .827 + 500 = 500
    >
    >In my code I used the following commands:
    >
    >BTW time is my Variable
    >
    >time = time */ 212 ' Scale by .827 (x 256 for */)
    >time = time + 500
    >
    >I then took time and used it as my duration argument for the servo
    >for positioning.
    >
    >Everything works fine other then the fact that I can't seem to
    >figure out out to increase the range of movement. I want the
    >(Duration) argument to range from 350 to 1150.
    >
    >Can anyone help point me in the right direction. Any help you can
    >offer would be greatly appreciated.
    >
    >Lu Kwan
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-19 16:03
    Tracy,

    I appreciate the help, I will try that out this evening when I get
    home from work.

    Lu

    --- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
    > Hi Lu Kwan
    >
    > Your span is now 1150 - 350 = 800. And the offset is 350.
    >
    > duration = time */ 339 + 350
    > ' */339 because 800/605 = 1.32 = 339/256
    > ' division by 256 is implied in the */ operator
    >
    > -- Tracy
    >
    >
    > >I have an RC circuit using a .1uf cap and a 10k variable resistor.
    > >
    > >My RC time values are 1 all the way clockwise (min resistance)
    > >and 605 all the way counter clockwise (max resistance)
    > >
    > >I have no problems scaling these values with an offset to get
    servo
    > >movement (duration) from 500 to 1000 but I would like to increase
    > >the movement (duration) to 350 to 1150 which I have proven to be
    the
    > >max servo movement range.
    > >
    > >To get my values I performed the following:
    > >
    > >time (Maximum) 500/605 = .827 * 605 = 500
    > >time (Minimum) 500/605 = .827 * 1 = .827
    > >
    > >After my values were scaled I added an offset:
    > >
    > >time (maximum) = 500 + 500 = 1000
    > >time (minimum) = .827 + 500 = 500
    > >
    > >In my code I used the following commands:
    > >
    > >BTW time is my Variable
    > >
    > >time = time */ 212 ' Scale by .827 (x 256 for */)
    > >time = time + 500
    > >
    > >I then took time and used it as my duration argument for the servo
    > >for positioning.
    > >
    > >Everything works fine other then the fact that I can't seem to
    > >figure out out to increase the range of movement. I want the
    > >(Duration) argument to range from 350 to 1150.
    > >
    > >Can anyone help point me in the right direction. Any help you can
    > >offer would be greatly appreciated.
    > >
    > >Lu Kwan
Sign In or Register to comment.