MABEL - A Boston Dynamics inspired balancing robot

MABEL (Multi Axis Balancer Electronically Levelled) is a unique arduino/Raspberry Pi self balancing robot with movable legs.

Similar projects worth following
MABEL is an open source self balancing robot that is inspired by Boston Dynamics' famous handle robot. The robot is controlled via an Arduino that handles all of the PID calculations (based off of open source YABR firmware) based on the angle received from an MPU-6050 Accelerometer/Gyro, whilst the pi manages Bluetooth and servo control, running an inverse kinematics algorithm to translate the robot legs perfectly in two axes.


The goal of MABEL is to create an affordable legged balancing robot platform like the the Boston Dynamics Handle robot that can built on a hobby scale using cheap parts.

MABEL will be able to actively balance in multiple Axes and vary leg length depending on the surroundings to increase terrain and off-road performance, unlike the YABR on what the Arduino code was based.

MABEL (Multiple Axis Balancer Electronically Levelled)

Here's the first testing video of MABEL after finally being able to balance on her own. MABEL is using the YABR open source balancing firmware as a base to make calculated decisions using a PID control loop of how to stay upright based off of the MPU-6050 angle data received. The PID controller will then output a suitable correction to be made and this value is interpreted as stepper motor pulses that send the robot forward or backwards in order to stay at the desired set point (upright). Unlike the YABR project I've decided to use the widely available Arduino CNC Shield, to reduce soldering and make basically everything plug and play. You can find some detailed build guides on the YABR page or on my blog  as well as where I've explained the code changes I've made to make the new shield compatible.

MABEL is quite different from other balancing robots in that the legs are able to move and the robot does not need to run in a fixed position. This is where the Raspberry Pi and the servo controller come into play. I've written an Inverse Kinematics class in python that takes an (X, Y) coordinate and works backwards to calculate the angle of each individual robot joint required to move precisely to that position. Briefly, since we know the length of each leg section is constant, we can draw a virtual triangle using the X and Y component as the third line in the  triangle and calculate the angles in the triangle using the cosine rule. Here upper refers to the distance between the upper leg pivot and lower leg pivot (92mm), lower refers to lower leg pivot to wheel centre (75mm), X and Y are given by the user (also in mm).

In code this looks like:

# is an inverse kinematics module for MABEL to move the wheel (effector) in 2D Cartesian coordinates.
# Contributors: (@raspibotics)

# x translates the robot leg vertically and y translates the leg horizontally, each value should be in integer mm
# x is the distance between the upper leg pivot and wheel centre (Vertically) - acceptable range for MABEL (160-98mm)
# y is the distance between the upper leg pivot and wheel centre (Horizontally) - acceptable range for MABEL (-50, 50mm)

from math import acos, degrees, atan2

class IKSolve:  # IKSolve - Inverse Kinematics solver for MABEL

    def __init__(self, ru_home, rl_home, lu_home,  # IKSolve Constructor, Values are default leg section lengths in mm
                 ll_home, upper_leg=92, lower_leg=75):

        self.ru_home, self.rl_home = ru_home, rl_home  # Right leg servo home positions
        self.lu_home, self.ll_home = lu_home, ll_home  # Left leg servo home positions

        self.a_const_0 = (upper_leg ** 2) - (lower_leg ** 2)  # b^2 - a^2
        self.a_const_1 = 2 * upper_leg  # 2*b (c is unknown)

        self.b_const_0 = (upper_leg ** 2) + (lower_leg ** 2)  # b^2 + c^2
        self.b_const_1 = 2 * upper_leg * lower_leg  # 2bc

    def translate_xy(self, x, y, flip=False):  # translate_xy(x, y) Calculates the required angles to move to (x, y) mm
        if x == 0 and y == 0:  # (0, 0) resets servos to home position
            return self.ru_home, self.rl_home, self.lu_home, self.ll_home
                angle_a = degrees(acos(((self.a_const_0 + (x ** 2)) /  # A = Cos^-1((b^2+c^2-a^2)/2bc)
                                        (self.a_const_1 * x))))
                angle_a += degrees(atan2(y, x))  # Tan^-1(y/x)
                angle_b = 180 - degrees(acos((self.b_const_0 - (x ** 2 + y ** 2)) /  # A = Cos^-1((b^2+c^2-a^2)/2bc)
            except ValueError:
                print('Value specified is outside range of capable movement. Please specify a different value...')
        if flip is not False:
            return (self.ru_home - round(angle_a)), (self.rl_home + round(angle_b)), (
                    self.lu_home + round(angle_a)), (self.ll_home - round(angle_b))
            return (self.ru_home + round(angle_a)), (self.rl_home - round(angle_b)), (
                    self.lu_home - round(angle_a)), (self.ll_home + round(angle_b))

IKSolve = IKSolve()

Read more »


Project File for modifications in CAD.

step - 14.16 MB - 08/03/2020 at 13:35



Gear to drive leg sections. 3D Print 4x.

Standard Tesselated Geometry - 2.55 MB - 08/03/2020 at 13:34



3D Print LowerLeg.stl 2x

Standard Tesselated Geometry - 2.15 MB - 08/03/2020 at 13:34



Housing to hold 2800mAh LiPo battery. Only one required.

Standard Tesselated Geometry - 973.76 kB - 08/03/2020 at 13:34



Side panels that hold the upper servos and drive the Upper leg segments. 3D print 2x.

Standard Tesselated Geometry - 1005.64 kB - 08/03/2020 at 13:34


View all 12 files

  • 1 × 3D Print each component as specified
  • 1 × (Optional) - Rubber O rings or grippy material I've used my own 3D printed wheels with rubber o rings wrapped around, but you could buy your own wheels or use something else like elastic bands to achieve the same effect.
  • 1 × PCA9865 Servo controller Ideally HAT for raspberry pi
  • 2 × Variable voltage regulator One for 5V devices like the Pi and arduino, another for 7.4V servo power
  • 6 × Aluminium servo horns (MG996R)

View all 19 components

  • MABEL: The video

    Raspibotics01/24/2021 at 16:05 0 comments

  • MABEL uses legs to accelerate and brake!

    Raspibotics01/10/2021 at 09:48 0 comments

    So we're back in lockdown in the UK again which means I've got some more time to work on MABEL. This time I've put the legs to use and you can see in this preliminary test that by  moving the legs using the Inverse Kinematics script (written in the previous post) we can move the legs. This changes to the centre of mass of the robot and allows us to kick the robot forwards or backwards and help accelerate and decelerate the robot much more effectively. 

    At present moving the robot legs up and down is proving to be quite difficult as it tends to make the robot unstable. My solution is to write a script to smooth out the servo motion which should make the robot more stable moving in that direction.

    All driving in the video is done by changing the Centre of Mass (CoM) by moving the legs. This allows the robot to accelerate more effectively than by changing motor speed alone. It still needs work but it's getting there:

  • MABEL Drives!!

    Raspibotics08/12/2020 at 09:04 0 comments

    UPDATE: MABEL is now able to drive around wirelessly using a Wiimote as a controller. (I'll be publishing the code later on in the main project details for anyone building along.) The Pi can now communicate to the Arduino over a USB serial connection, although I had to solder the wires directly onto the pi and Arduino solder joints, as MABELs slim frame doesn't allow a USB cable to fit. In the future I'd like to move away from the WiiMote in exchange for a newer controller like the PS4 one. Using the joysticks I will be able to have velocity control over the robot for more precise movement and control. The next step for MABEL is to get the servos to move up and down whilst balancing, by using the handy PCA9865 Servo controller and the Adafruit ServoKit python library. MABEL is still a bit wobbly, but I've found that reducing the Kd PID constant helps to reduce oscillations when balancing. If you have ant questions about the build and want to build your own, feel free to contact me on, I'm happy to help!

View all 3 project logs

  • 1
    Step 1: Go to GitHub repo

    I've started putting all of the instructions on to the GitHub page - my robot is still a work in progress so please be patient, I'll probably put some instructions up here at some point too.

View all instructions

Enjoy this project?



Jacob David C Cunningham wrote 08/25/2020 at 19:32 point

Wow that looks great, do you have any thoughts on what to do if it does fall over/on its own? Can it self right somehow? My other feedback would be to use gearing at the bottom wheels so you have more clearance, otherwise the off road capability is impressive.

  Are you sure? yes | no

Raspibotics wrote 08/27/2020 at 14:58 point

No at the moment it's stuck if it falls over, but there's mounting holes for arms that could probably be used to self right in the future.

  Are you sure? yes | no

dmccue wrote 08/19/2020 at 17:38 point

Fabulous project!  Thanks for sharing!  I'm shopping for the parts and warming up the 3D printer now.

  Are you sure? yes | no

Raspibotics wrote 08/19/2020 at 21:00 point

Awesome! I've got some more details on my blog and GitHub, and you can always email me if you get stuck. Keep me updated, I'd love to start a gallery as a few other people are building one at the same time as me!

  Are you sure? yes | no

Josh Starnes wrote 08/04/2020 at 23:14 point

Cute robot, I wish I could get one of those working, I would have no idea how to implement the math. On a side note, " Shaky" seems like a good nickname.

  Are you sure? yes | no

Raspibotics wrote 08/05/2020 at 06:55 point

Get one built! I've already done the maths for you, also I should be able to tune out the shakes later on.

  Are you sure? yes | no

David Gonzalez wrote 08/06/2020 at 01:26 point

To be honest, I loved the shakes haha.

  Are you sure? yes | no

Dan Maloney wrote 08/03/2020 at 20:06 point

I really like this! Seems to have a case of the shakes, though. Do you think that's because of the relatively low mass of the design? At least compared to Handle - that thing was big and heavy, which I imagine evens out a lot of the sensor noise.

  Are you sure? yes | no

Raspibotics wrote 08/03/2020 at 20:08 point

I think it's mostly due to rough PID tuning, it's getting better, I just need to refine the PID constants to make it a bit smoother. That was just the first test.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates