I started this project after I graduated from Berkeley. I wanted to see if I could make a self-leveling table with an Arduino and spare servos that I had from our capstone project.
The original premise was to have 4 servos (2 sets of opposing servos) to balance a table on 2 axes. I am currently still working on settling a design and figuring out the geometry of the servos as the table rotates (it is harder/more complex than I had originally assumed). I will update this page as I create new designs or reach new milestones.
Quick Jump
Design 1
Design 2
Design 3
Functional Build
Design 1: 4 Servos With 8 Ball Links
At this point, you can see that in order to rotate the table about its centroid, opposing servos did not rotate as inverses of each other. After doing the geometry by hand, I found these two curves for servo angles versus table angle:
This came as an absolute surprise to me that the servos would not just rotate as inverses of each other.
Design 2: 4 Servos With 4 Ball Links and 2 “Elbow” Hinges
To reduce the inaccuracy of the previous design, I replaced the connections at the servo horns with 1-DOF connections. This eliminated the yaw and elevation problems seen in the first design.
After trying multiple configurations of hinges, I found that it is very unlikely that there is a solution that will allow the table to rotate about 2 axes that are both through the centroid of the tabletop while using 4 servos in the current setup.
I determined that removing 1 servo and replacing it with a stationary post (with a ball link) would allow the desired rotations, except one axis of rotation would not be through the centroid of the table.
I ran the numbers on what varying the connector arm length and the length of the servo horn do to the total table rotation.
This first graph shows the table angles with varying connector lengths (represented as “l”). The graph shows that the total table angle range is pretty much identical between all connector lengths, it’s just the center angle that changes.
This second graph shows the table angles with varying servo horn lengths (represented as “h”). The graph shows that the total table angle range is increased as the servo arm length increases. This is a great discovery, except I am limited by the servo horns that came with the servo, so I’m limited in this sense.
I cut the wood and assembled everything. I also created a basic sketch on the Arduino to read the table angle and actuate the servos. Right now I am only using a proportional controller to make sure that everything works. This video shows the fully assembled table working (mostly) as intended. There is a slight yaw problem due to the hinge (on the right-most servo at the start). wobbling and torquing the servo horn. The table only has a ~15 degree total range due to having such a small servo horn length. I have larger servo horns (almost 2x as long) but they are for different, continuous servos that I have. I may create a second version of the table that uses these larger servos for a better table rotation range.
Isometric view of servo angle surface.
Top-down view of the servo angle surface.Side view of the servo angle surface.
These equations use the angle of tilt between the table top and the base. In order to enact this architecture, I had to move the accelerometer from the tabletop itself down to the base. This way, the servos could use the table angle determined by the accelerometer to move the tabletop to a level position. The problem with this setup is the fact that now there is no direct feedback of the tabletop angle, which can introduce more error in the steady-state table position than if the servo is directly on the table top. This would be easy to solve if I had a second accelerometer, but I do not.
I finally finished debugging and perfecting the Arduino code and the table is fully functional! The table works on both axes and stays within 1-2 degrees of level. There are still a few annoying problems with the servo horns flexing, causing the table to yaw, but this can be combatted with more rigid servo arms and connections.