How to Build a Hexapod Walker Robot?
For my next project, I decided to create my version of a popular robot project: the hexapod walker. This Raspberry Pi-powered robot will have an autonomous mode where it runs by itself and avoids obstacles and a manual mode where it can be controlled by a smart phone. Interested? Here’s how I did it.
Hexapod Walker Concept
This hexapod walker will follow the tripod gait, which is used by most animals and insects. The tripod gait is illustrated below:
There are lots of ways to use this gait in a hexapod walker. I chose to build a three-servo motor version which I found to have a balance between price and performance. Then I added another servo motor where the “eyes” of the robot are mounted. The robot will have three movements: forward, backward, turn right, and turn left. Any movement always involves tilting the robot to the right or left and then moving the leg that is lifted by the tilt. Below are the diagrams for the movements (a gray on a leg means the weight of the robot is on that leg).
The turn-right movement is basically the turn-left movement in reverse. To make a three-servo motor design possible, the front and the corresponding back leg need to be interconnected while the third servo motor tilts the walker. This hexapod walker can operate in two modes. In the first mode (autonomous) the walker is free to roam. If it detects an obstacle, it will go backward two steps and then turn right. The second mode will allow the user to control the movement of the hexapod walker using any smartphone connected to the same network as the robot. Based on my design requirements, I needed a controller that can 1) control four servos simultaneously 2) read input from an obstacle-detecting sensor 3) connect to a network for wireless control. Creating an Arduino Hexapod Walker was tempting, but the added cost in featuring wireless connectivity plus the extra challenge (Arduino would be easier) made me decide to go with the Raspberry Pi.
Required Materials
After deciding on what controller to use, I choose the rest of the components. Here they are:
- 3 x Tower Pro SG-5010 Servo Motors (for the legs and tilt)
- 1 x Tower Pro SG-90 Micro Servo Motor (for the head)
- 1 x Raspberry Pi 2 (with USB WiFi dongle) or Raspberry Pi 3
- HC-SR04 Ultrasonic Sensor – this is the obstacle detecting sensor.
- 9″ x 3″ Acrylic Board
- 1/2″ x 1/8″ Aluminum Bars
- Screws and nuts
- Batteries. The servos should have a separate source from the Raspberry Pi. My RPi runs on a small power bank.
Building Instructions
The hexapod walker have three major parts: the body/platform, the legs, and the head.
Building the Body
Here’s an example layout you can use to build the body of the walker. I used an acrylic board as my platform. Details of the legs follow.
Building the Legs
Here’s a layout for the legs. Mine used 1/2″ x 1/8 ” aluminum bars. The legs should be hard enough to hold the weight of the hexapod walker. No plastics please!
Mounting the RPi and Head
I added holes on the acrylic board then I attached the RPi with screws and nuts. The head part consists of the ultrasonic sensor and the micro servo attached to the board. I used hot glue to attach the sensor the micro servo:
Wiring Connections
Here’s how I connected the components:
tilt servo - > GPIO4
right leg -> GPIO21
left leg -> GPIO6
head -> GPIO26
HC-SR04 trigger - > GPIO23
HC-SR04 echo - > GPIO24