I currently working on the Self Balancing Motorcycle Project of the Arduino Engineering Kit Ver.1
I tried to implement some robust control algorithm for better stability of the balancing motorcycle.
For this implementation i need the direction of the inertia wheel speed. Unfortunately the Hall Sensor for the Speed measuring delivers an absolute value.
In the Documentation is following written:
"Does a negative torque command result in a negative inertia wheel speed? No. The tachometer only measures how many times the external magnetic field pulse has been raised and/or lowered. It has no way of knowing which direction the external magnet is passing it. This means that you will need to keep track of this information using software."
I tried some Ideas, but without success.
Have anybody some ideas how i can solve this problem.
The hint you were given is excellent. You need to keep track of speed at all times, as well as the torque applied.
While applying constant torque, if the speed as measured by the sensor is decreasing, goes to zero (or close to it) then starts increasing, the direction of rotation has changed sign.
I had the same Idea to detect a Sign-Change with zero detection. The main Problem of this idea is the big resolution of the Sensor values of the Speed. In my case the step resolution is round about 600 rpm. That means for a small Whell Speed the sensor sends somtimes 0. So i would detect a wrong sign change and so the controller gets the wrong value.