Shop OBEX P1 Docs P2 Docs Learn Events
Pot scaling and offset — Parallax Forums

Pot scaling and offset

hacktorioushacktorious Posts: 72
edited 2007-02-15 20:05 in BASIC Stamp
I am working on the WAM book and came across the ControlServoWithPot.bs2, chapter 5, p.155, "Measuring Rotation", and am looking for some more reading material on scaling and offsetting numbers in this particular situation. None of my math, engineering, or programming books seem to contain a section on this, and I am not able to find anything on the web.

If anyone knows of, or has any good reading material on this particular topic please post a link. Thanks.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Scott

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-02-15 04:20
    I'd check out www.emesystems.com/BS2index.htm. It's just chock full of useful information on the Stamps including math (fixed point and multiple precision), different kinds of sensors, etc.
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-02-15 04:35
    scaling and offsetting is typically just a linear line equation.
    y = mx + b

    let's say your pot values are 0 to 5000, and you want to see 0 to 300 (degrees)
    m = changing in output/change in input
    m = (300-0)/(5000-0)
    m = 0.06
    Now, the BS2 doesn't like decimals, so let's make it 6, so you will get values of 0 to 30000

    using·a known·points, we can solve for b:
    30000 = (5000) 6 + b
    b = 0 (zero interecept is easy)

    output = 6 x RCTime_value + 0

    so your output will be your RCTime value * 6 for a range of operation of 0 to 30000. When displayed, you can divide by 100 for 0 to 300.

    Notes: Use a word variable for the output variable, RCTime is not really linear, but we are treating it as such.

    Homework:
    How would the equation change if we wanted a degree of range of 30 to 270 degrees? :P

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-02-15 05:01
    OH! And if you really want the long drawn-out version, I'm covering it class this week for my electronics technology course.· This part is focused on op-amps, spanning and scaling values, but works good for programming too (which they will need to do when I toss a variety of sensors at them and they have to read the ADC value with·the BASIC Stamp·and covert it to actual units).

    http://www.siu.edu/~mhebel/est202/powerpoints_sp07.htm····· - Span & offset one

    Though, if you've got engineering texts there, and my answers are what you are talking about, you probably slapped yourself in the forehead anyway [noparse]:)[/noparse]

    Much of this is also covered in Parallax's "Process Control" text.

    -Martin


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • hacktorioushacktorious Posts: 72
    edited 2007-02-15 19:54
    Most of my books are mechanical in nature. My electrical books are very basic, and my programming books are for web stuff.

    Thanks, for all the good info. I have been reading a little everytime I get a chance.

    Martin,
    That looks like a great class.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Scott
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-02-15 20:05
    Scott,
    Thanks, it's my favorite class I teach - a lot of good, real-world content for a technologist. The "Process Control" text was written around many of the applicable things I try to bring out in this course. We use PC for parts of the lab for the course.

    Now, when it comes to Robotics, I wish I was better at the mechanical side of the house [noparse]:)[/noparse] I'd like to find a good book/text with a lot of common mechanical configurations for typical use that would help with robotics.

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
Sign In or Register to comment.