Step 0: Concept

This week I built a motor control board that measures the back
EMF of a driven motor and then dynamically adjusts the the drive
PWM duty cycle to maintain constant RPM.

Step 1: Schematic and Layout

The board is based on a ATTiny13 and a high current n-channel fet.
The schematic makes provisions for sensing the motor current, back
EMF, and for producing a 4.7KHz PWM drive waveform.

Schematic
Layout



Step 2: Code

The AVR uses the hardware timer to produce the PWM waveform. The main
code is a loop that waits for 10ms, measures the motor back EMF, compares
the measurement to a setpoint (PID), and then updates the PWM duty cycle.
The code is here.

Over and out.