Shop OBEX P1 Docs P2 Docs Learn Events
velocity — Parallax Forums

velocity

liftstoringliftstoring Posts: 2
edited 2005-01-12 23:00 in BASIC Stamp
hello i want to measer the·speed of a machine in meter per sec.we like to use a encoder with about 600 pulse·have somebody a idee to start with it.

greetings erik·

Comments

  • steve_bsteve_b Posts: 1,563
    edited 2005-01-12 22:24
    I'm sure someones got some encode code (har har) sitting around.· Do a search in the forum!

    So far as babysteps though....try reading in some pulses.· Just to see if you can do it!

    Then procede from there!· is it 600pulses per revolution?· Do you have gearing attached?

    You'll want to know the distance traveled per revolution....then it's just a matter of distance over time and you have velocity!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • liftstoringliftstoring Posts: 2
    edited 2005-01-12 22:46
    i don't ask for a coded but for some ideas and yes it is 600 pulses per revolution
  • steve_bsteve_b Posts: 1,563
    edited 2005-01-12 23:00
    ok....so, you need to use pulsin....

    Look in the Pbasic help file.· There are a couple of examples in there with some related code and how to set up your circuit.

    Ya know what....can that....you should probably use the Count command!

    This will count the number of pulses on a given pin for a specified time.

    Count <pin> <duration> <variable>

    ECinput con 0

    ECduration var byte

    ECtime var word

    ECduration = 10·· ' this is in multiples of 1ms...so 10 = 10mS

    count ECinput, ECduration, ECtime



    Now you need to know the distance traveled in one complete rotation of your encoder....then divide that by 600 then multiply that to the number of counts.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

Sign In or Register to comment.