Arduino PID Balancing of a Ball on Beam + code

 

Arduino PID Balancing of a Ball on Beam + code from youtube by Ali M. Ibrahim
recommended video : Ball on Beam Balancing using Arduino
recommended video : Life on a Balance Beam
To download code and more info:
http://mechatronicstutorials.blogspot.com/2014/07/balancing-of-ball-on-beam-using-arduino.html


I used Arduino as a PID controller to balance a small ball on a 4-bar mechanism.
An ultrasonic sensor detects the position of the ball.
A PID code is used to compute the angle of the servo motor based on the position of the ball.
I used Matlab to plot the position of the ball vs time.

Parts used:
- Arduino Uno
- Ping))) ultrasonic sensor
- 20 Kg.cm Digital Servo Motor
- 5 V DC power supply