Sensorless motor control
Closed-loop speed control of a DC motor with no tachometer and no encoder: the motor is its own sensor.
What it is
OverviewA spinning motor generates a voltage against the one driving it, and that back-EMF is proportional to its speed. So the speed sensor you were going to bolt on is already inside the motor — the trick is reading it while the motor is being driven.
The answer is to stop driving it, briefly. During the low phase of the PWM an interrupt fires and samples the back-EMF off the very pin that drives the coil, in the window where the drive is off but the rotor is still turning. That voltage closes the loop.
What it left behind
AfterwardsThis is the oldest thing on this site and the root of everything else on it. It is where I learned that a control loop is a conversation with a physical thing that will not wait for you: the sampling window sits where it does because that is when the electronics allow it, not because it was convenient.
Fourteen years later I write motion code for packaging machines. Same argument, more axes.
The write-up
PDFThe original report, with the schematics, the sampling window and the measurements.