3D Printed Hexapod
Seems like you want to build a Hexapod (or are just interested in robotics). Don't know why but since you're here, might as well tell you about the most important features about my design:
- Cheap: 120 € (see Parts (toBuy) file)
- RGB: 271 individual RGB LEDs for you to mess with
- Cable management: Cables are routed inside the leg. No cable loops that can get tangled
- ORP compatible: compatible with the Open Robotic Platform modules
- Bluetooth control: Remote control via phone app
This build is definitely not an easy one. But once complete it is very rewarding. For more information including the code check out my GitHub repository
Supplies
Screws:
- M2 (Cub head) 6mm *8
- M3 (Cub head) 10mm *12
- M3 (Cub head) 14mm *12
- M3 (Cub head) 20mm *6
- M3 (Cub head) 30mm *12
- M3 (Countersunk) 6mm *4
- M3 (Countersunk) 10mm *4
- M5 (Countersunk) 10mm *30
- M3 nut (Square) *48
- M3 heat set insert (OD 5) 5mm *53
- M5 heat set insert (OD 7) 5mm *42
Electronics:
- STM32...C8T6 (BluePill) *1
- HC-05 (Bluetooth module)
- PCA9865 (Servo driver) *2
- XL4016E1 (Buck converter) *1
- XL6009 (Blue Good) *1
- LED Ring 60 *1
- LED Ring 16 *1
- LED Ring 8 *1
- LED Strip 144LEDs/m *2
- 18650 Battery *4
- HX-2S-JH20 *1
- MGN996 Servo *18
- XT60 Female *1
- XT60 Male *1
- Wire (16awg, 20awg, signal wire, shielded wire)
You will also need an ST-Link (or some other programmer) and a Phone.
For me everything combined (excluding shipping) cost me around 120€, but that might differ drastically depending where, when and how you buy.
For more Information including Prices and Links take a look at the Excel sheet on GitHub.
Printing
Below are all the parts you will need to print. Everything is oriented the right way and supports have been added where necessary. Everything has been designed in a way to minimize supports as much as possible.
Print everything once except for the leg_set and leg_set_mirrored which you will need to print 3 times each.
Some of the body parts take up the entire build area so you will need a well levelled build plate, or even better mesh bed levelling. I don’t have that but it still worked out fine.
For the bushing_set you will need to try out different values for the XY Compensation. These bushings need to add some resistance to each joint to reduce chatter.
I printed with three shells and 10% infill.
Leg & Body
Once you have all the parts you can start building the legs. I don't have detailed build instructions for the leg or body but you can watch the build compilation of my two videos and take a look at the assembled 3d model.
I would highly recommend to first build a single leg to get some practice but also to find the right values for the bushings. If they are too loose the leg will have a lot of chatter. If they are too tight the leg won't move at all. In general the more mass a servo is moving the more resistance it needs.
Also make sure to zero each servo before building the leg. While building make sure that each joint forms a 90° angle. The curvature of the leg makes this a lot more annoying.
This is required to ensure the IK system for each leg works. If this is even slightly off, and it will be, you will have to try different offset values (in the “output.cpp”) to dial this in for each leg.
Wiring
Connect everything like in the wiring diagram above. If is the resolution is not enough you can find the image on GitHub. Be sure to use shielded wire for the connection between the STM32 and the servo drivers. I had some problems with interference without it.
One thing missing here is the XT60 connection between the battery and the rest of the circuit. You need a way to shut the hexapod down.
The LEDs are all connected in series in this order: Eye Centre, Eye middle ring, Eye outer ring, bottom ring, leg[ (front right) root -> tip (proceeding clockwise)
For the servos you can connect them to wherever is easiest. However you will need to set the channel for each servo in the "output.cpp" file correctly.
Leg[0].Servo[0].ch = 2;
Leg[0].Servo[1].ch = 1;
Leg[0].Servo[2].ch = 0;
Leg[1].Servo[0].ch = 6;
Leg[1].Servo[1].ch = 5;
Leg[1].Servo[2].ch = 4;
Leg[2].Servo[0].ch = 13;
Leg[2].Servo[1].ch = 14;
Leg[2].Servo[2].ch = 15;
Leg[3].Servo[0].ch = 18;
Leg[3].Servo[1].ch = 17;
Leg[3].Servo[2].ch = 16;
Leg[4].Servo[0].ch = 25;
Leg[4].Servo[1].ch = 26;
Leg[4].Servo[2].ch = 27;
Leg[5].Servo[0].ch = 29;
Leg[5].Servo[1].ch = 30;
Leg[5].Servo[2].ch = 31;
For naming information, see the GitHub page
On that node ensure that you bridge the first solder pad on one of the servo drivers. This will ensure that it uses a different I2C address. This second driver will continue the channel numbering of the first (16-31).
Programming
The code has been written in Visual Studio Code with the platform IO extension. I can't upload those files here so you will have to download them from GitHub.
To Upload it make sure you have VS Code and the PlatformIO installed and added the code downloaded from GitHub as a Project in the PlatformIO add-on.
From here upload the code. Be sure to use an ST-Link for this. You can use a simple FTDI Programmer or something similar but you will have to unplug the Bluetooth module to connect it and change the "upload_protocol" in the platformio.ini file from "stlink" to what your programmer requires. Check here for more info.
If you want to deactivate some functions, for example the LEDs, for some reason you can do that in the "header.h" file by commenting out what you don’t want. This can be great for testing new features.
You will also need to fine tune the servo angles by setting the angleOffset for each servo in the output.cpp file. If you set your values correctly it should look something like the images above. To make this easier you can uncomment "#define SERVO_CALIBRATION" in the "header.h" file. This will move every leg to it's origin.
Install Remote App
Install the application bellow. You will get a message saying this might be dangerous to install. This is normal so don't worry. If you don't trust me take a look at the MIT App Inventor project files on GitHub and compile it yourself.
Once installed make sure to allow "Nearby Devices". This is required for the app to find available Bluetooth devices.
Note that there are slider for controlling the Hexapods LEDs but that is currently disabled to reduce latency.
Downloads
Connect to Hexapod
The only thing left to do is connect to the Hexapod.
Turn your Hexapod on and pair to the Bluetooth module in you phones Bluetooth settings (only do this once). The default password is 1234 or 0000.
Once this is done open the Hexapod Remote app and connect to the Bluetooth module.
Once connected the Hexapod will have a simple startup animation and now you can control the hexapod using the two sticks, kind of like a drone.
Admire Your Work
Seeing the project work is the most rewarding thing for me. I know most people won't build something as complex as this but I still hope I was able to inspire you to build your own robotic Projects.
If you have any questions or suggestions, feel free to write me a comment.
Happy making :)