40 cent magnetic angle sensing technique

Finally the time has come to try this again, and it works great! Better in every way from digital halls. Easier, cheaper, and more precise. Fewer wires and CPU pins needed, and can run on 3.3V.

This time I’m using a 2204 motor which I’ve hacked up and glued to a gearbox, and didn’t do a great job of it so it’s a little wobbly. The sensor mount is 3D printed.

I’ve also ground the lip off the underside of the rotor to allow more flux leakage and get the sensors nearly touching the magnets. The radial placement has them just outside of the copper coils so hitting the coils wouldn’t be the limiting factor on how close I could get to the magnets.

This motor is nice because I can easily change the axial distance. After some testing, I’d say around 1mm is best. The greater the distance, the more sinusoidal the waveform becomes, but the resolution diminishes. This gives a resolution of around 100-130 ADC counts, whereas placing the sensors very close to the magnets gets up to around 200 counts, but the waveform becomes more trapezoidal with inverted peaks. I suspect smaller radial distance would improve that, and then maybe you could get a bit better resolution before running into the coils.



You can also see the signature of the wobble in my motor. The amplitude varies throughout the 7 electrical revolutions as the magnets get closer and farther from the sensors. But since atan2 doesn’t have a specific input range, it makes no difference to the angle reading.

It appears the green sensor is slightly closer to the magnets since it has higher amplitude than the blue one. It runs a little better if I use the range scaling from XieMaster’s implementation, but I would vote for nanoparticle’s version to be the one included in SimpleFOC for its speed and simplicity (only subtracting the center value for each sensor). Better to fix the amplitude issue by adjusting sensor distance.

There seems to be a problem with the ADC configuration using the Generic G031G8Ux configuration on Lepton, because it’s taking 250 microseconds per analogRead. My main loop is 400 micros otherwise, so the majority of the time is spent reading sensors. Low speed works fine but it tops out around 100rad/s.

5 Likes