Roland Pelayo has used the single board computer, the famous Raspberry Pi or RBPi to help a hexapod robot learn to walk. The RBPi allows the robot to run in an autonomous mode, so it walks without assistance, avoiding obstacles. Alternately, it can also operate in a manual mode, whereby a user with a smartphone can control the robot. Most interestingly, the hexapod walker follows the tripod gait, just as most six-legged insects do.
Roland prefers to use servomotors to control the gait of the hexapod robot. According to Roland, using three servomotors to control the movement of the six legs of the robot, strikes a balance between performance and price. He added another servomotor for moving the eyes of the robot.
The servomotors allow the robot to move in four directions, forward, backward, left turn, and right turn. The robot moves by tilting itself to the left or the right, and then moving the leg lifted by its tilt. Roland has drawn diagrams explaining the movements of the robot. The backward and turn right movement of the robot is basically the reverse of its forward and turn right movement respectively.
Therefore, the front and corresponding back legs of the robot are interconnected to two servomotors, one to the left pair and the other to the right. The third servomotor helps to tilt the robot.
The RBPi allows the hexapod walker to operate in two modes. The first is the autonomous mode, which allows the robot to roam around freely, avoiding obstacles in its path. For instance, if it detects an obstacle in front, the robot walker takes two steps backwards, turns right, and then moves forward again. The second mode is for allowing the user control the movements of the hexapod robot using a smartphone on the same network as the robot is.
Roland has designed the program to allow the RBPi control four servos simultaneously, while reading inputs from a sensor detecting obstacles. The RBPi also connects to a network for the remote wireless control. Using an RBPi for the project was simpler for Roland, as the RBPi features on-board wireless connectivity.
Roland uses three Tower Pro SG-5010 servomotors, two for moving the legs and the third for tilting the hexapod walker. A fourth micro servo motor, a Tower Pro SG-90, helps to move the head and the eyes. An RBPi2 fitted with a USB Wi-Fi dongle helps to control the four servomotors. While the RBPi runs on a small power bank, the servomotors have their own separate power source. An ultrasonic sensor, HC-SR04, performs the obstacle detection.
As the echo produced by the ultrasonic sensor may cross the 3.3 V levels, Roland placed a voltage divider in between to connect to the RBPi, as its GPIO pins cannot accept voltages above 3.3 V.
As Python is already installed on the RBPi, Roland used it to write the program for the Hexapod walker. However, he also needed an extra library called pigpio, mainly for controlling the servomotors. He used SSH to access the RBPi remotely and installed the extra library.