Bill Chennault
04-09-2007, 02:49 AM
All--
I am successfully experimenting with the MMBe (with a LOT of initial help from Parallax!) and·the Melexis 90217. I may have the wrong concept about using the Melexis 90217, however. What I really want to do with the Melexis 90217 is to count magnets as they pass on a wheel. I don't really care about RPM. (Currently, I am using a BS2; I have a BS2px24 and a BS2p40. I will move to one of them when the correct wall transformer gets here. In the meantime, the BS2 is fine.) RPM will always be low. The no-load max is 654 rpm and I will never run it that fast. Maybe half that speed or a little more, say 450-500 rpm.)
My example has 8 magnets glued on a 3" diameter circle on a wheel. (The magnets are glued directly to the wheel.) My goal is to count how many magnets pass the Melexis 90217 Hall Effect sensor. By doing so, I will know where the wheel is within 45 degrees (360/8 = 45). Since the wheel is 3" in diameter, this means that I will know how far it has moved the robot to within 1.178". That is close enough.
My problem is how to count "magnet pass events." Obviously, PBASIC's COUNT command is not what I want. What I would like to do is simply know when a magnet has passed the Hall Effect sensor. So, what I really need to do is count each low-high-low (or vice versa) transistion, which the Melexis 90217 is designed to do.
I can't figure out the code. It seems like I would monitor the state of an input pin to see if it went 0-1-0 (or 1-0-1) as the magnets pass by. Each time one of these transitions took place, I would simply increment a counter.
How do I do this?
Thanks!
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
I am successfully experimenting with the MMBe (with a LOT of initial help from Parallax!) and·the Melexis 90217. I may have the wrong concept about using the Melexis 90217, however. What I really want to do with the Melexis 90217 is to count magnets as they pass on a wheel. I don't really care about RPM. (Currently, I am using a BS2; I have a BS2px24 and a BS2p40. I will move to one of them when the correct wall transformer gets here. In the meantime, the BS2 is fine.) RPM will always be low. The no-load max is 654 rpm and I will never run it that fast. Maybe half that speed or a little more, say 450-500 rpm.)
My example has 8 magnets glued on a 3" diameter circle on a wheel. (The magnets are glued directly to the wheel.) My goal is to count how many magnets pass the Melexis 90217 Hall Effect sensor. By doing so, I will know where the wheel is within 45 degrees (360/8 = 45). Since the wheel is 3" in diameter, this means that I will know how far it has moved the robot to within 1.178". That is close enough.
My problem is how to count "magnet pass events." Obviously, PBASIC's COUNT command is not what I want. What I would like to do is simply know when a magnet has passed the Hall Effect sensor. So, what I really need to do is count each low-high-low (or vice versa) transistion, which the Melexis 90217 is designed to do.
I can't figure out the code. It seems like I would monitor the state of an input pin to see if it went 0-1-0 (or 1-0-1) as the magnets pass by. Each time one of these transitions took place, I would simply increment a counter.
How do I do this?
Thanks!
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.