Introduction: 3D Printed Raspberry Pi Spider Robot Platform
This is a fun beginner project for anyone to make! It is a four legged spider robot platform using Raspberry Pi as the brain, 3D printed parts as the body, and many readily available electronics from amazon or banggood. No custom PCB is required. With step-by-step video guides it is a good project for anyone who wants to tinker with Raspberry Pi, Python programming, 3D printing, and robotics.
Step 1: Supplies
As mentioned above all of the electronics are readily available on Amazon or Banggood or even your local hobby store. Here is the bill of materials with links provided for you to make this robot:
- 1 x Raspberry Pi 3B+ .................... Amazon // Banggood
- 1 x 5MP OV5647 Pi camera module .................... Amazon // Banggood
- 1 x POWERADD 5000mAh Power Bank (needs to be this one or similar size)
- 1 x PCA9685 16 Channel 12 Bit PWM Servo Driver .................... Amazon // Banggood
- 1 x LM2596 Buck Converter, DC-DC step down module .................... Amazon // Banggood
- 12 x MG90S Servo motor .................... Amazon // Banggood
- 4 x Lipo 3.7v battery .................... Amazon // Banggood (if you are unable to get this battery then get a similar size one with capacity around 700mAh)
- 1 x Toggle Switch .................... Amazon // Banggood
- Some Jumper wires .................... Amazon // Banggood
- Some M3 nuts & bolts .................... Amazon // Banggood
You will need a 3D printer or access to 3D printer to print the body parts of the robot. I can recommend the 3D printer that I use, this one is a real workhorse: https://www.flashforge.com/product-detail/4
Additional tools that you will need: soldering iron, heat shrink tubes, electrical tape, zip tie, pliers, hot glue gun, and screwdriver.
Step 2: Print 3D Printed Parts
List of parts needed to be printed:
- 1 x Body
- 1 x Joint 1
- 1 x Joint 2
- 1 x Joint 3
- 1 x Joint 4
- 1 x Thigh 1
- 1 x Thigh 2
- 1 x Thigh 3
- 1 x Thigh 4
- 1 x Calf 1
- 1 x Calf 2
- 1 x Calf 3
- 1 x Calf 4
- 1 x Pi camera mount
- 1 x Cover
- 4 x Tip (glue)
- 4 x Tip (smooth)
Each leg is has three components: joint, thigh, and calf. For ease of assembly all components of a leg are numbered. All parts can be printed using PLA. You can print all the Joint parts together in one go and same for Thigh parts and Calf parts as shown in the picture. Supports are needed for Body, Joints, Thighs, Pi camera mount, and Cover.
If parts don't fit together properly feel free to change the dimensions of any part.
Step 3: Raspberry Pi Setup
This Raspberry Pi setup video is for setting up a headless Raspberry Pi and accessing the Pi using a laptop via VNC. You need a power supply for the pi, micro SD card, microSD card to SD card adapter or USB microSD card reader and obviously a laptop. All these components should come with the canakit from the Raspberry Pi 3B+ link provided in step 1. You can also do this with a desktop computer as well. Keep in mind there are other ways to setup a Raspberry pi do whatever you are most comfortable with. My setup is more economical compare to the regular setup.
If your Raspberry Pi is not running properly open command line and type these two lines: "sudo apt update" and "sudo apt full-upgrade"
Here are all the software links to complete this step:
- Raspberry Pi Imager: https://www.raspberrypi.org/software/
- Putty: https://www.putty.org/
- Advanced IP Scanner: https://www.advanced-ip-scanner.com/
- VNC: https://www.realvnc.com/en/connect/download/viewer/
Step 4: Assembly of the Robot
The assembly video guide can be split into two parts. First part is hooking up the circuit to test servo motors. Second is the assembly of the robot. Some sanding of the 3D printed parts might be needed in order to fit some parts together. Keep in mind the video is a guide, you can switch up the order of assembly if you want, however, you should always test the circuit first.
Wiring diagram and table are provided. I did not show the complete wire up of servo motors in the diagram, because it will be too messy. The wiring table gives a batter idea. On where each servos should be connected to the ports of the PCA9685 servo driver. To give an example on how to read the table, first row reads Calf 3 to 0. This mean the servo motor that controls Calf 3 (the 3D printed part) connects to the 0 port on PCA9685.
If you are curious on how the four li-po batteries are connected. They are a set of two 3.7v li-po batteries in series, which makes it a 7.4v battery pack. Then it is connected by another identical set in parallel. Each li-po battery has a 700mAh capacity. This makes it a 7.4v 1400mAh batter pack. Putting batteries in series will add up the voltage. While putting batteries in parallel will add up the capacity. Side note, there are two power sources on this robot the li-po battery pack is for powering the servo motor. While the power bank is for powering the Raspberry Pi.
Here are all the software links and command lines to do this step:
- WinSCP: https://winscp.net/eng/download.php
- Adafruit_Python_PCA9685 module: “sudo pip3 install adafruit-pca9685”
- Pygame module: "sudo pip3 install pygame"
Step 5: Play! and the Possibilities:)
Congrats!! on building a four legged spider robot. To operate it there is a picture of the keyboard control provided. Hope you learn something and have fun!
The possibilities to expand and upgrade this robot is endless. For example, I have included a HC-SR04, ultrasonic sensor mount in step 2 so you can make the robot walk by itself with some additional code. I also included a place to mount a MPU-6050 sensor on the Body (picture provided) with some additional code you can make the robot self-stabilizing. Moreover, you can switch the Pi 3B+ to a Raspberry Pi 4 to gain more computing power. Then you can use OpenCV to let the robot have computer vision for stuff like face detection and object detection. Your imagination and ability are the limit ;)
Please like and subscribe my videos I am building a youtube channel: https://www.youtube.com/channel/UCFj6tFPxIVaNm1r6...
Feel free to ask any questions about the project
Second Prize in the
Battery Powered Contest
9 months ago
Hi Morris, I have a problem with this setup. I did everything, test it an retest it. I have 5.5V on output, 5.5V on input of the LM from batteries. I've tried to connect the LM on raspberry on both( 5V or 3.3V), but I have the same problem - on first test for servos, they are not moving. When I measure on LM for each pin, I have like 0.48V for pins 0-5 and 15-10, where servos are connected, and 0 for the rest 4 pins. I2C is activated. What can I do wrong? Any ideas?
Reply 8 months ago
Sorry for the late response, when you said you "measure on LM for each pin" what do you mean? Cause the LM2596 Buck Converter should only be connected to the servo driver... Check your wiring.
Good luck, unless you already figure it out, in that case good job!
Reply 8 months ago
Hi there and thanks for your answer. I've figured it out what was the problem. My servo controller was broken. After I've changed it, everything was fine. Thanks for your project. Was great to do it! :D
1 year ago
Hi, Morris, I got a question about the battery. After boost the rasp and servo, it can run movementlib.py successfully, but when runs the program, the noise of the current disappears, the multimeter shows there is no voltage on the input of PCA9685. When I cut off and restart, it works again as last time. It this problem related to the battery? I guess maybe I used two 2000mAh batteries rather than four 1000mAh, the current is not enough to supply? Any response will be appreciated!
Reply 1 year ago
With battery swap could be tricky, because it depends on the voltage, capacity, C-rating, and how you connect the them (i.e. series or parallel) to get it right. Your 2000mAh capacity sounds good, so if you think the problem is the current maybe check your C-rating. C-rating is a battery's current rating or the amount of current the battery can provide. You can find it by this formula: C-rate [A] = discharge [C] x Capacity [Ah]
hope this helps
1 year ago
Kullandığım raspbery pi 3 te Advanced IP tarayıcı da görebiliyorken şuan bir daha yaptığımda ise orada göremiyorum ama güç ısığı yanıyor ve sd kartım çalışıyor. Sizce bu neden kaynaklanıyor olabilir yardımcı olabilir misiniz?
Reply 1 year ago
Sometimes it takes a while for the Raspberry Pi to boot up so maybe wait for like 3 to 5 minutes before you scan it. And if that doesn't work you can always delete your SD card and start the process again.
hope this helps
Question 2 years ago
This may be a dumb question, but how do you charge the Lipo batteries once they're embedded in the chassis?
Reply 2 years ago
You can easily disconnect and remove the Lipo batteries for charging or replacement. Watch the assembly video and you will understand.
2 years ago
I want to contact you personally so we can do some projects together, I wonder if you can give me your email so that I can contact you.
Question 2 years ago
Just a question: why did you put two separate power sources? Is the 0.5V difference worth adding another battery? Do you want the rPI to be powered even when the motors get powered down for some reasons or it is just to avoid tinkering with the rPI power?
Reply 2 years ago
The main reason why I separate the power sources is because, when servo motors are switching directions. It can cause the voltage to fluctuate significantly, which is bad for the Pi. Powering multiple servo motors using the Pi's 5V power pin can easily cause a power supply brown-out and mess up the Pi.
Plus, sometime I just need Pi to be powered so I can write code. Another benefit is expandability, you can easily scale up this robot by using more powerful servo motors that required higher voltage with the same circuit.