Shop OBEX P1 Docs P2 Docs Learn Events
rotation counter — Parallax Forums

rotation counter

BulmungBulmung Posts: 1
edited 2008-02-19 18:45 in BASIC Stamp
I am trying to make some kind of counter to count how many times an axle rotates. I tried using a whisker but when the whisker is hit it counts more than 1 each time it is hit, is there a better way to do this or a way to fix this?

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2008-02-19 18:45
    The problem with a whisker is that there's quite a bit of mechanical inertia and springiness which can show up as multiple counts.

    You may do better with an infra-red emitter detector setup which can watch for a bit of reflective tape on the axle. Or, use a Hall-effect sensor which can sense a magnet on the shaft. You could also have a disk with one or more holes in it and detect the passing of the holes by photocell or photo-transistor.

    You can do a couple of things in your program which can add some debounce. For instance, if the repitition rate is low you can watch for the switch closure, jump to the count routine, but pause for some time period before going back to watch again. For fast pulse rates, you may have to use an external counter chip so as not to miss pulses.

    Cheers,

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

    http://www.siskconsult.com
    ·
Sign In or Register to comment.