PDA

View Full Version : Counting Revolutions and Determining Direction w/Melexis 90217

Bill Chennault
11-27-2006, 11:51 PM
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.

metron9
11-28-2006, 12:18 AM
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!

stamptrol
11-28-2006, 12:19 AM
·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:

Regards,

·Tom Sisk

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

http://www.siskconsult.com
·

Robert Kubichek
11-28-2006, 01:08 AM
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 http://forums.parallax.com/images/smilies/scool.gif

Bill Chennault
11-28-2006, 01:32 AM
Bob and Tom and metron9-- (http://forums.parallax.com/member.php?u=41825)

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

Tom, I saved your code. Thanks.

--Bill

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

jivy103
04-30-2010, 01:44 AM
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