ZeroBug Is a 3D-Printed Micro Servo Hexapod Powered by a Raspberry Pi and STM32

The DIY robot can be controlled via Bluetooth gamepad or web interface.

Cabe Atwell
25 days agoRobotics / Sensors

ZeroBug is a 3D-printed micro servo hexapod that runs on a Raspberry Pi Zero and an STM32F103. The STM32 controls its leg locomotion, reverse kinematics, and 18 servos, performing calculations at 50Hz to ensure smooth, highly precise movements.

The robot features a custom locomotion engine, Bluetooth game controller support, and a claw for object manipulation, all put together with custom 3D-printed parts and cheaply obtained standard hobby servos.

The STM32 handles all the heavy lifting to make the bot move, sending commands to control the robot directly with a simple serial protocol. A Raspberry Pi Zero running an improved version of the software from a previous bot project, ZeroBot, connects to the serial interface. This software hosts a web interface for touch and mouse controls, while support for wireless gamepads is available via Pygame.

The STM32 is controlled with a simple protocol over UART, which can receive commands from either a USB or the Raspberry Pi Zero. The Pi itself runs a python script that handles the Websocket communication, UART, and pygame. When a client connects to it, the website loads that controls the ZeroBug via keyboard, mouse, or touch inputs. Any inputs are translated by the Pi and sent as serial to the STM32. Additionally, a periodic heartbeat signal is relayed to the STM32 so it can stop the servos in case the Pi freezes up. The microcontroller and Pi combination should keep the bot functioning smoothly.

A custom circuit board holds the STM32, a PWM controller, and a few other components while the Pi plugs into the back of the PCB. The 18 motors make up most of the monetary cost of the project — the posted design used Emax ES08A II micro servos, which come in at around $100 for the full set. They also draw a lot of current, which was accounted for with six 1.2V NIMH cells to make the necessary 6V and no voltage regulator required. Limited IO and timers on the STM32 mean that it only handles four of the servos, while the rest are controlled with a PCA9685 PWM driver.

The post details more of the design choices for the electronic components, and the PCB layout, source code, and STLs are all available on GitHub.

Related articles
Sponsored articles
Related articles