Arduino DC Motor
This Page describes how to control a brushed DC motor with an Arduino microcontroller board.
The controller can vary the speed of the DC motor either by changing the voltage applied to the motor. Alternatively, the pulse width modulation (PWM) technique can be used, in which the transistors, through which the current passes to the motor, are periodically switched on and off such that the current flows in pulses. The frequency of these pulses must be high enough that the inertia of the moving parts of the motor prevents the rotation from slowing down noticeably. The speed is then controlled by changing the fraction of the time in which the current flows.