The photo and YouTube video above is a Lego-based Ball-and-Beam (BNB). The BNB is a classic setup used to demonstrate and teach control systems design. The objective is to keep the ball centered in the middle of the beam. When the ball is perturbed (i.e. pushed away from the center), the beam's angle is adjusted to restore the ball to the middle. Real-time step response plots (i.e. perturbation) from Excel data streaming, are shown below.
This tutorial presents the Parts List, Lego Build Plan, the mechanical and electrical construction, and operation. This version employs the Arduino UNO. However, a version using the NXT Brick and NXC language can also be used.
Motivation was to provide every student a tackle box of parts. They could quickly assemble the Lego BNB without any special tools in under 30-min. Students can design controllers and run BNB experiments in their dorms, libraries, or classrooms. When the lab lessons are concluded, the BNB can be quickly disassembled and the tackle boxes can be stored until the next time the lab is offered. The total cost runs about $250 USD - the bulk of this cost is the Arduino UNO, EVShield, and Spectra Sensor linear potentiometer.
This Tutorial assumes the reader has the following background and interest:
Part Name/Description | 2024 Price [USD] | Quantity | Notes |
---|---|---|---|
1-1/4 inch Hard Wear-Resistant 52100 Alloy Steel Balls | $4.52 | 1 | McMaster-Carr Part 9528K44 |
Spectra Symbol Sensor Linear 300mm Connector | $31/73 | 1 | Digikey Part 905-1055-ND |
EVShield for Arduino Duemilanove or Uno | $75.75 | 1 | Sold by Mindsensors.com |
Arduino Uno REV3 | $27.60 | 1 | Any Arduino UNO can be used |
Male-to-Male Jumper Wires | $8.29 | 1 | Only 3 jumper wires are needed |
9V 2A Power Supply for Arduino Uno | $9.20 | 1 | Needed to power Arduino Uno and NXT motor |
XFasten Double Sided Woodworking Tape 1/2" x 36 Yards | $16.49 | 1 | Sold as 4-pack by Amazon. Just need about 12-inches/td> |
Use three male-to-male jumper wires to connect the Spectra Symbol sensor to the EVShield. The EVShield's pinouts are shown in the figure below and detailed in the EVShield Advanced Development Guide (PDF). Make sure to power the Arduino UNO with the 9V 2A power supply. Not only does it power the Arduino UNO, but it will also drive the NXT motor (which can draw up to 1 to 2 A when loaded).
A range of experiments can be conducted. For example, the beam's length can be changed by adding or removing Lego bricks. One could also change the pivoting position. One would re-attempt PID control given these physical changes. Future work would be use this Lego BNB to compare different control techniques (e.g. optimal, fuzzy, sliding mode) to PID. These would be topics in future Lego BNB tutorials.
For questions, clarifications, etc, Email: paul.oh@unlv.edu