The Journey to Create a Tiny Quadruped Robot

Operate this DIY Boston Dynamics-like robodog with a basic PS3 controller and see how it walks.

This project was created by Miguel Ayuso Parrilla as a way to explore topics in control theory, mathematics, and programming. It was inspired by Boston Dynamics' quadruped Spot, and has the ability to walk, respond to environmental changes, and even run.

Electronics and Hardware

The central controller is a Raspberry Pi 4, which was chosen due to its speed and therefore its ability to run complex calculations quickly. Each leg is moved by three servo motors, for 12 total. An Arduino Mega is responsible for writing PWM signals to each servo, as well as reading data from an MPU6050 inertial measurement unit (IMU). The Pi and Mega communicate via a USB serial connection, which is easy to interface with and write to/from.

For power, there are six 7.5V rechargeable batteries in series that can provide up to 4A of peak current when needed. A PS3 controller interfaces with the Raspberry Pi 4 via Bluetooth to provide movement and action commands.

The Kinematic Model

Programming a system as complex as a four-legged walking robot would be nearly impossible to do without many abstractions. That's why this complexity is hidden away in a kinematic model, which takes various inputs such as body orientation, gait, and direction, and then maps each leg to a certain angle. Since each leg has three dimensions of freedom, and there are four legs, twelve total axes have to be taken into consideration. It operates by working backwards from where the foot is supposed to be positioned relative to the body and applies several calculations to update the rotational axes.

Making It Walk

Now that there's a way to place a foot in a certain position, the next step is to figure out what way the feet need to be placed. Just like how many frames comprise a video, multiple phases comprise each movement. First, there is a pattern based on which direction the robot is supposed to move in, which allows for a trajectory to be calculated. Next, target position coordinates are generated for each foot based on the phase, and these are used to guide the feet based on the kinematic model.

Programming

The program that determines leg movements and gathers input data is all done in Python to make development a bit easier. Serial commands are sent via USB to the Arduino for changing the foot positioning, and data is read on this interface to talk with the IMU. For the joystick, there is a simple joystick class that uses and underlying gamepad object from the evdev library. This greatly simplifies receiving inputs.

Simulation

Not only is there a physical robot to test walking patterns, but there is a simulator too that lets developers and hobbyists test their designs before deploying them. The application is based on the PyBullet physics engine and features a basic model of the robot with four legs consisting of three joints each.

Ongoing Problems and Solutions

This robot has incredible capabilities, especially for how simple it is. That's not to say that Parrilla didn't encounter any issues along the way, however. One main challenge to this project was controlling erratic movements, as sometimes the Pi would output a bad solution. This was corrected a bit later by offsetting the times in which each phase begins, thus giving the robot a bit more stability.

Evan Rust
IoT, web, and embedded systems enthusiast. Contact me for product reviews or custom project requests.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles