ES-71AdvancedPremium

ESP32 PID Ball and Beam (HC-SR04 + Servo + I2C LCD + 3 Potentiometers)

The classic control engineering experiment on your desk: a servo tilts a beam and PID holds the ball on target. Three potentiometers change Kp, Ki and Kd live: with P alone the ball swings, D damps it and I cancels the beam's slight lean so the ball lands right on target. The I2C LCD shows the beam, ball and target, plus settling time and overshoot. In SIM mode a physics model rolls the ball; in REAL mode an HC-SR04 measures it.

0.0(0)
ESP32 PID Ball and Beam (HC-SR04 + Servo + I2C LCD + 3 Potentiometers)
A small balancing rig that keeps a ball exactly where you want it on a beam by tilting the beam. Turn three knobs to change the controller's gains live and watch the ball swing at first, then calm down and settle on target; a distance sensor tracks the ball and a servo tilts the beam. You get to try the idea behind self-balancing robots and drones with your own hands.

Source Code

Premium Content

The source code, block version and FAQ of this project are open to Premium members.

  • All Project Code
  • Block version
  • Frequently Asked Questions