Alright - I’m sure someone already has this all figured out. Perhaps one of you folks can help our team. We pretty short on programming talent (as I see several other teams are) so figuring this one out is a challenge.
We are running Gyro + Gear tooth sensors for reasonably accurate driving. However, our old method of checking wheel spin direction no longer works.
We originally were going to use the timing of the rise of the wave form for the gear tooth sensor was different for forward or reverse. It was a rough way to tell if you were going forward or backward.
The new gear tooth sensors we received have the exact same timing - eliminating our ability to sense forward or reverse (per the new documentation).
Is there a method with the sensor to tell the change in direction? We’ve considered using the pwm value, but that would be an obvious software kludge that doesn’t take coast / brake distance into account. I suppose this could go under electrical or programming, but since our current solution was software I figured I’d stick it in here.
We used two Grayhill 61K128 encoders on the gear box…well trying too…
Also you might be able to do what your doing. So you have an oscilloscope? Connect your output to your scope and check th PULSE width. I think if I remember right, the gear tooth has two different pulse widths. If it does, you might be able to write something with EasyC Pro’s new “interrupt watcher” function to get what you need for direction from gear tooth sensing. OR…this will take some HELP from mechanical gurus…you might be able to mount TWO gear tooth sensors out of phase from each other and do the same thing.
Just some suggestions…
encoders work ok for us for counting distance for sure, we are having issues closing a PID around them and our transmissions. So I don’t know what your application is.
Chris - our “kludge” is this - keep checking the gear tooth increase. If it doesn’t increase for a tick, then check if your pwm’s are below 127. If so - it’s pretty likely you’re in reverse.
Then you can close your pid loop. That’s how we’re working it now, but I don’t like it because I know there should / has to be a more elegant solution that doesn’t use the software like this.
The pulse width is the same in forward or reverse for this year’s gear tooth sensor. That’s what broke our original shot at doing it (we did it with last years, and there WAS a difference then) 
If you can’t be sure that the motor will be moving in the same direction it’s commanded, there’s no good way to do what you want in software. The best thing I can think of is to use two gear tooth sensors on the same gear, mounted so that they give a quadrature signal just like a rotary encoder would.
Or just add a rotary encoder and be done with it. 
Speak english darn you! Rotary encoders? 
Heh… just kidding. I’ll show this to the kids and let them figure out which way they want to work on it. Thanks guys.
You are correct. Last year’s gear tooth sensor (ATS651LSH) had two different pulse widths depending upon direction of rotation ( 45 us and 90 us - typical ). For this year’s gear tooth sensor (ATS642LSH) the pulse width will vary based upon the speed of the rotation of the gear and the shape of the gear teeth as seen by the sensor. see the complete data sheet at www.allegromicro.com