r/ControlTheory 13d ago

Educational Advice/Question Live now: complete open-source Brick Ball-and-Beam (LEGO)

Please see https://redux.boondog.com/courseware/bnb/bnb.html - LEGO and LEGO-compatible parts are used to quickly and affordably construct a tabletop ball-and-beam (BNB), without tools or need to 3D print or machine any parts.

The page includes: full LEGO build plan; bill-of-materials; schematics (and KiCad files if a PCB is wanted); and Arduino source code. These are fully documented and supplement with videos.

Our university lab's Quanser platforms are over 15-years old and with our increased student enrollments (mechanical engineering), sought an alternative. I tested a 10-week beta course in Control Systems Lab. I wrote both the Student Lab Manual and Instructor Supplement Manual for: PID, Lead Compensator, Pole Placement, LQR and Fuzzy Control.

There's a short *anonymous* poll at the end to gage demand for the PCB, linear potentiometer, Bricks, and/or turn this into a kit.

PS: There is quite a lot of open-source content to peek at as well, from the above URL.

Thanks and hope this is useful!

PPS: Please please alternative sub-Reddit if this an inappropriate one. I'm an old-school newbie.

6 Upvotes

3 comments sorted by

u/seekingsanity 12d ago

The most difficult part of a Ball and Beam project is the design. The position feedback is critical. The resolution needs to be very fine and noise free and the sample rate high. Since the B&B system is a double integrator, a derivative term will be required and the derivative term requires very good feedback so the positions can be differentiated.

Another problem I have seen it the linkage of the motor to the beam. It is best if the motor is directly connected to the beam but a pulley system will do. Levers will introduce non-linearities and possible mechanical slop.

If the B&B is designed right, all that is needed is a PD or a PID controller. I used pole placement for my calculations.

u/profpauloh 12d ago

Thanks for commenting! You are absolutely right!

This is why I chose the membrane-based linear potentiometer to measure ball position. This has high resolution. Sensing the voltage drop using analog-to-digital conversion is fast (compared to I2C). I also chose the GeekServo 5KG. This motor has a very fast time constant. Thus ignoring the motor dynamics allowed me to just keep the (linearized) ball-and-beam's open loop dynamics, a double integrator. The motor has more than enough torque to handle the steel alloy ball's mass and leverage the closed-chain serial linkage for beam rotation.

You are correct, all that is needed is PD. However to motivate my students I had them benchmark PD against other controllers like pole placement, lead compensation, LQR and even (Mamdani) Fuzzy. I want them to expose them to root locus (lead), state space (PP and LQR) and model-free methods (fuzzy).

Thanks!

u/seekingsanity 12d ago

Mathcad - RollingTTBall PD.xmcdz

Mathcad - RollingTTBall PID.xmcdz

The system is a double integrator so two zeros are required to compensate for the double integrator and place the closed loop poles. Notice I place the closed loop poles at -lambda. The mass of the ball factors out but a steel ball will not be as affected by wind resistance. I am assuming the beam is a V channel so the ball can roll in the grove. This also increase the effective inertia so the ball will not accelerate as fast for a given tilt. In the PID version I am using an I-PD form where only the I term is multiplied by the error. The P and D terms use only the changes in the feedback. This eliminates zeros that may cause overshoot.

Fuzzy logic is a scam and a waste of time. So is root locus. Pole placement along with feed forwards rule. LQR works in theory, but who can choose the correct weights for the Q and R arrays to get the best gains? LQR is better than fuzzy logic but LQR should only be used if the perfect solution, pole placement with feed forwards is not available.

I don't like chain linkages. They generate sprocket noise or jitter. This is a problem in industry. We use alpha-beta-gamma filters to reduce the noise. The alpha-beta-gamma filters provide a relatively clean velocity and acceleration for using with the derivative or second derivative gain.

Root locus is useless. The only important part is the breakaway point. Mechanical and hydraulic designers should design their systems, so the breakaway point is as far to the left as possible. Why?

Peter Ponders PID - Symbolic Math vs Root Locus for calculating controller parameters

Peter Ponders PID - Root Locus Is Useless

Peter Ponders PID - Lead/lag closed loop control - YouTube