Notes / Sensors & Signal Processing
Encoders and Hall sensors: measuring rotational position and speed
The A/B phases of an incremental encoder, finding BLDC position with three Hall sensors, timer encoder mode, and ways to calculate speed.
Incremental encoder
Two pulse trains, A and B, come out 90° apart. Which one rises first gives the direction, and the pulse count gives the position. Counting all four edges (×4) quadruples the resolution. The Z phase (index) comes once per revolution and marks the origin.
Timer encoder mode
Put an STM32 timer in encoder mode and CNT counts up and down automatically with the A/B signals. Position is counted with no CPU involvement.
Calculating speed
| Method | Principle | Suited to |
|---|---|---|
| M method | Pulses counted in a fixed time | High speed |
| T method | Time of one pulse | Low speed |
| M/T method | A combination of the two | The whole range |
At low speed the M method sees 0 or 1 pulses per period, so the value jumps in steps.
3D labRun what you have read so far→Hall sensors
The three Hall sensors inside a BLDC motor give six combinations (001 to 110) that change every 60 electrical degrees. They tell you roughly which sector the rotor is in, so they are used directly for six-step commutation. The resolution is too low for FOC, which interpolates between Hall signals or uses an encoder or a sensorless estimate.
Absolute encoder
It knows the absolute position the moment power comes on. Magnetic types (AS5600, AS5047) give the angle over SPI/I2C.