To control the rotation speed and direction of a DC motor, we can use rotary encoder and Arduino. The article also provides the Arduino code.