Use of PID to get the required RPM.

Try this:
http://forum.arduino.cc/index.php/topic,8652.0.html