An encoder makes it possible to control the position of a DC motor. In the video linked below, I illustrate how an encoder works, and then use a PID control algorithm to control the motor position. All of the steps are included so that you will be easily able to make the system yourself.
Here's the link: