The following is a PID motor speed control simulation written in Processing.
The simulation models standard motor movement, including inertia, viscous friction, back-emf, motor constant, inductance, and resistance. A PID control loop was simulated to control the speed of the motor.
This simulation was written as a precursor to a hardware implementation of a motor speed PID controller.