Brushed DC motors are inherently hard to control accurately compared to modern BLDCs, especially at low speeds.
Outline of what we will do:
- Linearize the output voltage of our H-Bridge
- Create an open-loop speed controller
- Add a closed loop speed controller on top
Linearize H-Bridge Output Voltage
A prerequisite to predictable motor behaviour is a predictable voltage source. Our H-Bridge module does not actually output a voltage that’s proportional to the duty cycle of the PWM-signal we use to control it. This is due to a protection feature that introduces some dead time when switching, to avoid shoot-through conditions. It’s great to have it, but we want this detail to be transparent to our control loop.
To achieve that, we simply map the full range (0…100%) to the ranges of approximately linear behaviour (9.2…89%), both for the negative and positive output ranges.

Create an open-loop speed controller

Let’s keep it brief: We want to control rotational speed n, which is proportional to back-emf e.