With the chip shortage still raging on, building a ZeroBug with the rare STM32F103 is becoming increasingly difficult. I was looking for a replacement for a while, even considering an ESP32. But now that the powerful Raspberry Pi Zero 2 is here, an additional microcontroller might not be necessary at all to control the servos. To experiment with a Raspberry-only approach I created a new PCB.
Removing the microcontroller means that the Raspberry Pi has to control the servo driver by itself. That’s why a second PCA9684 PWM-driver is needed. The i2c pins are conveniently positioned on the existing connector so no change is needed there. The microcontroller and its USB port together with lots of smaller components are no longer needed. With much fewer parts, the PCB can be shrunken down the the Pi-Zero size. By using the Pi’s internal 3.3 voltage, even the 3.3V regulator can be taken out (the board still needs a 5V LDO to power the Pi). I also put in a chunky 1.6 mF capacitor to make sure the Raspberry Pi doesn’t reset while the servos move.
The new, smaller PCB and the Raspberry Pi can be mounted horizontally in the Hexapod while still leaving room for servo wires.
Software-wise a few changes had to be made. The Raspberry Pi now has to take over all the tasks of the microcontroller that was running the gait engine. To make everything run in a Python environment, I had to port the entire gait engine to the new language. As Processing(.org) features a Python-mode I used this for testing the code (the Python-based simulator is also available GitHub: https://github.com/CoretechR/ZeroBug-Lite). Adafruit has a nice CircuitPython library that makes it easy to control the PCA9685.
With everything assembled and programmed, the ZeroBug can walk with only a Raspberry Pi Zero as its brains. How well does it work? I did some testing but cannot say that the „ZeroBug Lite“ version is as reliable as the microcontroller-based one. For one, the output enable signal that tells the servo drivers to stop is only controlled by the python script. When the software is abruptly stopped, the servos can’t be disabled. And as the Pi can’t measure analog signals, there is no way to monitor the battery voltage without additional hardware. The software at least needs more work to build in the same kind of safety checks that were implemented in the original robot.
If you are interested you can check out the new GitHub Repository: https://github.com/CoretechR/ZeroBug-Lite
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.