Shop OBEX P1 Docs P2 Docs Learn Events
Counting Revolutions and Determining Direction w/Melexis 90217 — Parallax Forums

Counting Revolutions and Determining Direction w/Melexis 90217

Bill ChennaultBill Chennault Posts: 1,198
edited 2010-04-29 18:44 in BASIC Stamp
All--

I have a rotating shaft turning somewhere between 100 rpm and (maybe as much as) 300 rpm. I do not care about the speed of rotation. What I want to know is how many revolutions it makes and in which direction. (It is a screw drive.) My thought is to use two Melexis 90217 Hall Effect sensors placed on each side of the shaft with a single magnet fixed to the shaft. One 90217 would count rotations and use a single Stamp input pin. A comparison of the two 90217 outputs·(using another Stamp input pin) would allow me to determine rotation direction as long as I knew which direction the shaft began rotating upon startup.

Of course, (I think) if I used three 90217 sensors, then I would not need to know the direction of shaft rotation upon startup.

What do you think of this idea? (The reason I would use multiple Melexis 90217 devices is solely due to Parallax's support of things they sell. A dual Hall-Effect sensor designed to provide both count (or RPM) and direction would doubtless make more sense if I knew anything about electronics.)

--Bill

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.

Comments

  • metron9metron9 Posts: 1,100
    edited 2006-11-27 17:18
    If you place 3 magnets in a row, two spaced equally and the third one spaced at twice the distance you would get three bits of data per 360 degree revolution.

    Going clockwise 1....1........1....................1....1........1.......................
    Going countercw 1........1....1....................1........1....1.......................

    So counting the space between the pulses you would know the direction
    counting 1 for every 3 pulses you would know the revolution count.

    At 300 RPM you have 200ms per revolution.
    200 ms / 360 degrees = .55 ms per degree

    Spacing magnets at 0, 45 and 135 degrees

    gives you (45*.55) ms (90*.55)ms and the balance of the 360 degree rotation ((360-135)*.55)ms

    25ms, 50ms, 125ms

    so you have a short, medium and long pause between pulses

    short,medium,long is one direction
    short long medium is the other direction

    A bit of math to calculate the lengths of the pauses as they relate to each other and you have it done with one sensor.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think Inside the box first and if that doesn't work..
    Re-arrange what's inside the box then...
    Think outside the BOX!
  • stamptrolstamptrol Posts: 1,731
    edited 2006-11-27 17:19
    ·Bill,

    ···· Use your two sensors and one magnet as you described. Then set up a quadrature counter in your stamp·program. You'll be able to both count number of revolutions AND determine· the direction.

    ·· I put a piece of sample code on my website:

    ··http://siskconsult.com/quadhicount.bs2



    Regards,

    ·Tom Sisk

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

    http://www.siskconsult.com
    ·
  • Robert KubichekRobert Kubichek Posts: 343
    edited 2006-11-27 18:08
    I would use 2 sensors, and 2 magnets spaced equally/balanced on the shaft, you would then get double the counts per revolution.
    AND the shaft would be balanced better, hence no vibrations!!!!!

    Bob scool.gif
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2006-11-27 18:32
    Bob and Tom and metron9--

    Thanks for the ideas! They were all better than mine.

    Tom, I saved your code. Thanks.

    --Bill



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
  • jivy103jivy103 Posts: 3
    edited 2010-04-29 18:44
    Hey Im working on making a robotic wind sculpture and im using a basic stamp2. Im running a Melexis 90217 rpm sensor to the basic stamp and then that is going through a parallax motor controller witch will spin the motors the same speed as the rpm sensor data. I found the wiring data sheet on parallax but im not sure how to talk to the sensor or have it talk back to me i guess. Can anyway help me out with some code on how to use this Melexis 90217 RPM sensor!?!?!?! any help would be greatly appreciated

    Justin

    sculpture and ceramics major
    UMD
    Duluth MN
Sign In or Register to comment.