Start with a potentiometer for speed control - it will be much simpler than an encoder.
Get a simple program working that makes the motor stop and start and run at different speeds before you try to add features.
If you want to identify the RPM of the motor you will need something to detect the revolutions. For a small DC motor I use a QRE1113 reflective optical sensor that detects a blob of white paint on a small black disk fifed to the motor shaft.
...R