Home
Got my hands on an old E-Bike direct drive motor making noise inside.
 Took carefully the motor apart.
The lose coating on the magnets was the problem due to corrosion.
After removing this, the motor rotated smoothly.
Next, how to drive the motor.
Found Application note 1017 from Microchip as an example.
I use the MPLAB ICD2 to program the chip in line.
Code written in C.
Modified the code extensively for slower running and positioning.
  very low speed is not jet possible.
I firstly used this test version to find phase zero and the CCW offset.
Running CW:
Use SW at 1 position to rotate the motor 1 electrical circle an find the 3 Hall positions.
Use SW at  0 position to test the possible Phase zero position by adjusting Pot_Z and S2 to set it.
Use SW at 2 position to fine adjust Pot_Z by moving Pot_Phase-Add, fully - and  +,
  in booth cases the motor should run slower.
Now for CCW change the constant "int PhaseOffset" as a result of moving Pot_Phase-Add, fully - and  +.
The code is in very premature state and full of trace and debug points.
Pictures at Mijnalbum
For new dessign see MK_IV pictures Mesurement Parts

The Demo version can be controlled by a potentiometer or run from a internal string of commands.

Video of the demo mode

Test module build from MDF