A dual benefit for battery-powered portable devices is provided by Class D audio amplifier. The produce much less power dissipation than do their linear cousins and they enhance battery life. Those features make this device an ideal candidate for controlling speed and direction in small electric motors.
The standard application circuit for a class D audio amplifier is shown on circuit diagram below. It requires only slight modification. In place of the usual audio-signal input is a variable DC voltage generated by a potentiometer (R2). The potentiometer is biased by resistor R1 to match the input range of U1. Rotation of the motor is reversed by full counter-clockwise rotation of the pot corresponds to maximum-speed. Mid-scale on the pot corresponds to motor off, and maximum-speed forward rotation in the motor is produced by full clockwise rotation of the pot.
The characteristics of a given motor may let you to eliminate the amplifier’s output filter (L1,L2,C1 and C2). But, you should include the filter to reduce EMI unless the control circuitry shown is located near the motor. [Source: MAXIM Application Note]