Arduino II: Walking Robot
or the second week of Arduino, we’ve learned controlling servos using Arduino. And we’ve been challenged to code different behaviors for two servos. A parallel program. What I came up was this nested loop, with two helper functions. The two servos were not running completely different programs though. They are still linearly related. But a differential function made the two sweeping in different patterns. The trick was to us nested loop and control both servos step by step, rather than wrapping each servo’s behavior in a separate function.
For the locomotive robot assignment, I’ve designed a walking robot with four legs. Inspired by animals like cats and horses. Four legs were divided into two pairs, with two diagonal legs in each pair. The legs push the robot forward by turning the servo backward. While the active pair moves back, the other pair reset to the forward position. And this reset happens when the active legs are perpendicular to the ground, which is the moment when the most clearance to the ground. The coding part was rather simple once the mechanism is designed. The only trial-and-error happened in setting the parameters compensating the rotational orientations for the servos.
For testing out the concept, I built the chassis (or say frame) first, with the servos and wood sticks only. After powering it up with the arduino, this little walker bot started crawling across my table.
The chassis of the walker was rather lean. Good news that there was enough space for mounting all the parts. Several recycled rubber band from grocery helped hold them onto it. With a tiny power bank on the belly and the arduino board on the back, it didn’t take long for everything come together. The walker was ready to walk right after stick the USB cable into the power bank. With all the extra cargo on the robot, it was clear that the robot cannot cross difficult terrain as before, but for flat table and hardwood ground, it walked really well. And the long and stiff serial cable served well as a handle for lifting the robot as well.