# logo Hexapod A Hexapod Robot using Raspberry Pi Zero W ![banner](imgs/banner.jpg) ## Introduction This is a hexapod robot based on [Smallp Tsai](https://github.com/SmallpTsai)'s [hexapod-v2-7697](https://github.com/SmallpTsai/hexapod-v2-7697) project. This project reused most of the mechanical design in the original project, but with a full redesign of the circuits and software. The table below shows the difference between this project and the original one. | | Original hexapod-v2-7697 | This project | | --------------- | ------------------------ | ----------------------------------------------- | | Controller | Linkit 7697 | Raspberry Pi Zero W or Raspberry Pi Zero W 2 | | PWM control | Custom circuit board | 2 x PCA9685 motor driver boards | | DC-DC | 7 x mini360 modules | 2 x XL4005 5A Max DC-DC modules and 1 x mini360 | | Power | 2S Lipo battery | 2 x 18650 batteries | | Remote | BLE | WiFi | | Remote software | Android and iOS | PC, Android (WIP) | ## Mechanism ### Bill of Materials (BOM) #### Servos 18 TowerPro [MG92B](http://www.towerpro.com.tw/product/mg92b/) are required. > The dimension of 3d printed part is highly dependent on the servo's size. Modification is required if you want to use alternative servos. #### 3D-Printed Parts ##### Body x 1 | Filename | Thumbnail | Required | | -------------- | ----------------------------------------------------------------------- | -------- | | body_top | body_top | 1 | | body_bottom | body_bottom | 1 | | body_side_wall | body_side_wall | 2 | | body_back_wall | body_back_wall | 1 | | battery_box | battery_box | 1 | | battery_holder | battery_holder | 2 | ##### Leg x 6 | Filename | Thumbnail | Required | | --------------- | ------------------------------------------------------------------------- | -------- | | thigh_top | thigh_top | 1 (x6) | | thigh_bottom | thigh_bottom | 1 (x6) | | joint_cross | joint_cross | 1 (x6) | | joint_top | joint_top | 2 (x6) | | joint_bottom | joint_bottom | 2 (x6) | | leg_top | leg_top | 1 (x6) | | let_bottom | leg_bottom | 1 (x6) | | foot_top | foot_top | 1 (x6) | | foot_bottom | foot_bottom | 1 (x6) | | foot_ground | foot_ground | 1 (x6) | | foot_tip | foot_tip | 1 (x6) | | servo_horn_j1j2 | servo_horn_j1j2 | 2 (x6) | | servo_horn_j3 | servo_horn_j3 | 1 (x6) | #### Others | Name | Spec | Thumbnail | Required | Note | | --------- | ------- | ---------------------------- | -------- | ------------------------------------------------- | | Screw | M2 6mm | ![6mm](imgs/M2_6mm.JPG) | 54 | Servo Arm: 1 x 18
Joint: 4 x 6
Thigh: 2 x 6 | | Screw | M2 10mm | ![10mm](imgs/M2_10mm.JPG) | 24 | Thigh: 1 x 6
Pin lock: 1 x 18 | | Screw | M2 30mm | ![30mm](imgs/M2_30mm.JPG) | 36 | Servo: 2 x 18 | | Nuts | M2 | ![6mm](imgs/M2_nut.JPG) | 36 | Servo: 2 x 18 | | Pin (304) | M4 6mm | ![pin](imgs/pin_M4_6mm.JPG) | 18 | Servo: 1 x 18 | ### Leg Assemble #### Assembly video #### Exploded view LegAssemble #### Detailed steps - **Step 1** - Combine `thigh_top`, `MG92B` and `thigh_bottom`, use M2x30mm screw and nut to secure them together. LegAssemble1 - **Step 2** - Grab one `joint_cross`, `joint_top` and `joint_bottom` and combine them LegAssemble2 - **Step 3** - First put 2 x `MG92B`, `leg_top` and `leg_bottom` together with M2x30mm screw and nut. Then attach `joint_top` and `joint_bottom` altogether LegAssemble3 - **Step 4** - Grab `foot_top`, `foot_bottom` and `foot_ground` (and `foot_top`) and assemble them. LegAssemble4 - **Finish** - Great, you got 1 leg done, 5 more to go :) LegAssemble5 ## Electronics ### Bill of Materials (BOM) | Name | Thumbnail | Required | | -------------- | ----------------------------------------------------------------------- | -------- | | Raspberry Pi Zero W or W 2 | raspberry pi | 1 | | PCA9685 motor driver | PCA9685 | 2 | | XL4005 DC-DC step down | XL4005 | 2 | | Mini 360 DC-DC step down | mini360 | 1 | | Toggle switch | toggle_switch | 1 | ### Connection Diagram diagram ## Software ### Raspberry Pi #### Requirements Raspberry Pi is running [`Raspberry Pi OS`](https://www.raspberrypi.com/software/). - Enable `I2C` by using ``` bash sudo raspi-config ``` - Install required packages ``` bash sudo apt-get install python3-numpy python3-pip ``` - Install required Python modules ``` bash pip3 install adafruit-circuitpython-servokit ``` > Tips: It is convenient to debug code on Raspberry Pi through VSCode's remote feature. #### Running The hexapod program, located under `./software/raspberry pi/` is written in Python. Use the following command to start it manually. ``` bash python3 hexapod.py ``` ### PC PC program source files are located under `./software/pc/`. The compiled progarm can be downloaded under the [release](https://github.com/rookiepeng/hexapod/releases) page.