⟢ ARAI Lab · Learn · Control Systems

PID vs. Neural Network

Two controllers drive the same robot. Tune the PID by hand, train the network by trial and error, then stress both and see which one holds up. Pick a robot to start.

Stress tests

None of these were in the network's training.

PID—
Neural network—
TargetPIDNetwork
ScoreboardPIDNetwork

For instructors and students

Use the playground to build intuition, the lecture notes to learn the math, and the MATLAB lab to collect real numbers. The same robots and controllers run in all three, so results match.

Lecture notesHow it works: equations of motion for all four robots, PID and cascade control, the neural network, training by evolution strategies, and results.14 pages · PDF Lab manualA 3-hour MATLAB lab: pre-lab questions, six parts with sample code and data tables, deliverables and a grading rubric.5 pages · PDF MATLAB codeAll four robots, PID and network controllers, training code, and six ready-to-run lab scripts.MATLAB R2019b or newer · no toolboxes · ZIP
Instructors

Request the instructor key

Reference values for every lab part and the pre-lab answer key. Enter your details and we will email the key to verified instructors.

Sample MATLAB · PID vs. network on the arm
P    = arai_params('arm');                                           % 'arm', 'segway', 'twolink' or 'drone'
cond = default_conditions();                                         % normal robot; try cond.payload = 2.5
trP  = simulate_robot(P, make_pid([30 20 4]), cond);                 % PID: [Kp Ki Kd]
trN  = simulate_robot(P, make_nn(pretrained_weights('arm')), cond);  % trained network
plot_compare(P, {trP, trN}, {'PID', 'Network'});
print_metrics(P, {'PID', 'Network'}, [compute_metrics(P, trP), compute_metrics(P, trN)]);

% Train your own network by trial and error (a few minutes)
[p, loss] = train_es('arm', 300, 1, struct('pop', 12, 'eps', 2));

References

Control and learning

  1. Ziegler, J. G., & Nichols, N. B. (1942). Optimum settings for automatic controllers. Transactions of the ASME, 64, 759–768.
  2. Åström, K. J., & Hägglund, T. (2006). Advanced PID Control. ISA.
  3. Barto, A. G., Sutton, R. S., & Anderson, C. W. (1983). Neuronlike adaptive elements that can solve difficult learning control problems. IEEE Transactions on Systems, Man, and Cybernetics, SMC-13(5), 834–846.
  4. Hunt, K. J., Sbarbaro, D., Żbikowski, R., & Gawthrop, P. J. (1992). Neural networks for control systems: A survey. Automatica, 28(6), 1083–1112.
  5. Grasser, F., D’Arrigo, A., Colombi, S., & Rufer, A. C. (2002). JOE: A mobile, inverted pendulum. IEEE Transactions on Industrial Electronics, 49(1), 107–114.
  6. Spong, M. W., Hutchinson, S., & Vidyasagar, M. (2020). Robot Modeling and Control (2nd ed.). Wiley.
  7. Salimans, T., Ho, J., Chen, X., Sidor, S., & Sutskever, I. (2017). Evolution strategies as a scalable alternative to reinforcement learning. arXiv:1703.03864.
  8. Kingma, D. P., & Ba, J. (2015). Adam: A method for stochastic optimization. ICLR. arXiv:1412.6980.

From the ARAI Lab

  1. Tatoglu, A., Greenhalge, S., & Windheuser, K. (2016). Utilizing reaction wheels to increase maneuverability and localization accuracy of a hovering robot. ASME IMECE.
  2. Tatoglu, A. (2017). Parameter identification and closed loop control of a flywheel mounted hovering robot. ASME IMECE.
  3. Tatoglu, A., Campana, C., Nolan, J., & Toloczko, G. (2020). Fuzzy logic controller design of a single stage fluid valve based robotic arm. ASME IMECE.
  4. Genc, Y., Altuger, G., & Tatoglu, A. (2025). In search of a lightweight “good enough” offline generative AI for mobile robots: Performance benchmarking. International FLAIRS Conference.

Cite this tool

Tatoglu, A. (2026). PID vs. Neural Network: An interactive control playground [Software]. ARAI Lab, University of Hartford. https://autonomoussystems.net

Want to tune real robots?

The ARAI Lab at the University of Hartford builds legged robots, autonomous vehicles and AI controllers. Students from any engineering or computing major are welcome.

© 2026 Akin Tatoglu, ARAI Lab, University of Hartford. Free for teaching and learning with attribution. Do not copy or republish this tool or its code without permission.