Lego Climbing Robot

Way back in January I watched a Google tech talk video Lego Engineering: from kindergarten to college. The talk stresses the importance of teaching engineering in schools. A few days later at breakfast I started talking with my oldest daughter, Alexandria, about engineering and what it is that engineers do. I said that engineers use what they know about science and how things work to find solutions to challenges. I threw out a challenge as an example: Build the tallest possible tower that fits in our house and then build a robot to climb it. It was just an example but she got really excited about the idea. “Can we build it. Can we. Can we.” she said. I said “sure”.

In March I posted a preview of the robot with a picture and promises of more details to come. Its taken me way to long to finally write it up. The robot has been done since May and has made a dozen or so ascents. Making the video is what caused the delay.

Here is what I remember of the process.

I asked Alexandria what the tower should be made of and where is the tallest place in the house. Wood and K’NEX were the candidate tower materials. We had just gotten some K’NEX for Christmas so that seemed like the more interesting choice. We measured a few places in the house and found that the tallest possible place was the stairs that went from the basement to the second floor but in at least one spot it would be too narrow for a robot. The second tallest place has a ceiling fan in the way. That left the play room which has a sloped ceiling just over 11ft at its highest. We have a large Lego collection including the RCX so it was clear that the robot would be made out of Legos.

Tower01

One weekend morning Alexandria and I set out to build the tower. We were both new to K’NEX so we started by just playing around with different ways of connecting them. We each came up with a tower design. Alexandria’s was stronger (and looked cooler) but used more pieces. We decided to go with her design after removing some parts to conserve materials without reducing the strength. In the end we ran out of some parts so we switched to a simpler design that used parts that we still had plenty of for the top of the tower. The total height of the tower is 10ft 9in (3.28 meters). The tower has a ladder built into one of its faces for the future robot to climb.

Later, my other daughter, Isabella, helped build the tower base out of wood. She cut strips of wood and screwed them to a piece of scrap plywood to hold the tower steady as the robot climbed. There are no guy wires or anything else holding the tower steady.

With the tower complete it was time to work on the robot. I knew that this would be much more challenging than the tower but I still wanted to involve the kids as much as possible. We talked about how design ideas can come from watching other things work including nature. We acted out how people climb ladders and modeled the motion of a simple arm with Legos. I played a little with a motorized elbow and shoulder but quickly realized that it would end up being too heavy, not strong enough and use more motors than the Lego RCX can control (it has a maximum of three outputs).

I switched to a design that used rack gears to move an arm up and down. A quick test showed that driving the rack gear directly from the motor would not have enough power to lift the robot. Gear reduction would be needed. This was a good opportunity to demonstrate to the kids how you can trade speed for power with different size gears.

Climber V1 Motor

The robot has two climbing arms. The left and right sides are mirror images so Alexandria and I built one side each in parallel. At this point we had a good motorized climbing mechanism with switches so that the robot controller would know when the arms were at their farthest extent either up or down. It used two motors and two switches. The arms had enough reach for the ladder rung spacing but how it would grab and release was still an unsolved problem and turned out to be one of the hardest.

I used a section of the tower ladder for testing out various designs for how the robot arms would grab and release. The general principals were fairly simple. It needed a pivot and a curved or angled piece to move the hook out of the way as the arm moved up past the next rung. It would then need to snap back into place so the hook could engage the rung as the arm moved down. Selecting just the right combination of pieces that would work with the K’NEX ladder design was very challenging. I worked on this many nights without finding a solution that I thought would be robust enough.

Climber V1 claw

I stopped working on it for a while and it might have become another uncompleted project if Alexandria hadn’t reminded us to get back to work on it. I finally came up with a design for the grabbing hook. The blue curved part and the pivot point near the rack gear allows the hook to move out of the way as it slides past the ladder rungs. Then a rubber band snaps the hook back into place. The black piece sticking up contacts a switch on the down stroke.

Deciding where to place the RCX programmable brick was a challenge. Putting it on top of the motors would move the center of mass too far way from the ladder, which would make it difficult for the hooks to grab on. This lead to the hinged design that allowed the robot to drive up to the tower then fold flat and hang down as the robot climbed.

Here is the first version of the climbing robot:

Climber V1

With the mechanics working it was time to start programming. I like to use the text based NQC language for programming the RCX rather than the Lego Mindstorms picture based language. It is also easier to setup and use on Linux.

To get the kids involved we did the exercise described in the Lego Engineering video. We built a simple car and measured how far it went when the motor was turned on for one second. Then we placed a Lego minifig 4 feet from the starting line. The challenge was to figure out how long to run the motor so that the car would come as close as possible to the minifig without running it over. We had a lot of fun doing this. However, I bet it wasn’t so fun for the minfigs that got run over.

The program moves each climbing arm independently. There are two switches for the arms: one detects when either of the arms is all the way down and the other detects when either arm is all the way up. Because the switches are shared by both arms the program must keep track of which direction the arms are moving. If both arms are ever both up or both down there will be problems. The program counts each arm stroke and displays the count on the RCX display. It also makes a beep sound on each stroke. This beep turned out to be helpful during video editing. At start up it goes through a test cycle to make sure each arm can move all the way up and down. If something goes wrong during the startup tests it will play an alert sound and end — better to find a problem before it starts to climb.

While testing it became clear that more gear reduction was needed. As soon as the batteries lost more than one tenth of a volt the robot would start having trouble climbing. I added a battery voltage test at startup so it won’t climb if the battery is low.

Using what was learned I redesigned the robot. The gear ratio was 8 to 40 before and I added another 8 to 40. This gave a great deal of torque (and also means the robot climbs much slower). I found that if the switch or program was even a little delayed at turning off the motor it would rip the robot apart. So I did more redesign to make the switch contacts more robust and the overall structure stronger.

The original challenge had nothing to say about how the robot would get down or if it even would. There were plenty of details to work out just to get it to climb up but the getting down problem was in the back of my mind the whole time. While working on the hooks the general idea came to me that rubber bands would be used to pull the hooks away from the rungs while the arm moved down. The tricky part is that the same rubber bands would have to be slack on the way up. I came up with a passive mechanical design where a bar across the top of the tower would trip a lever as the robot climbed past it. This would tension the rubber bands. The lever is designed with another rubber band so that it snaps into either the up or down position and won’t stay in between. This mechanism was in the first version of the robot but it was never tested (since the robot had trouble getting to the top). This too was improved in the second version.

Here is what the second version of the robot looks like:

Lego Climbing Robot 01

The climbing direction lever can be seen in the climb-up position. You can also tell that the motor was reversed and the extra gears added to the outside. This allowed for the extra gears to fit in a very small space. Climbing down requires a different algorithm than climbing up. A switch is used to detect when the lever is in the down position. Even with the switch I consider it a passive design because no motor is used to change the mechanical configuration. When the robot reaches the bottom the folding action causes the lever to move part way up (releasing the switch). This is how the program detects when it is all the way down. When testing the robot would sometimes stop halfway down. The reason was that any small movement of the lever could release pressure on the switch. Given the sensitivity of the switch and the delicate balance of the rubber bands the problem was best solved in software. The program requires that the switch be off for two full cycles before ending. This is why it keeps climbing for a moment when it is at the bottom.

This project marks the first time that I used Lego modeling software. While redesigning between the first and second versions I wanted to remember the way it was in case I needed to go back. I had wanted to try modeling software for a while. On my previous Lego video I got some requests for how it was made. This time I have a model to share (see below for the link). The software I used is MLCAD (under Wine), and LDView. This site is required reading for getting this stuff running on Linux. I installed LeoCAD also but in the end preferred MLCAD. I even installed Lego Digital Designer (again using Wine) but this official program does not have very many parts and is not as powerful as the others (it looks and feels like a toy). Note: I had to turn off Compiz for LDView to work (Ubuntu 8.04).

cockpit.jpg

Isabella and I built the cockpit together and Isabella made the minifig pilots.

The robot had one more problem. At the very end when the wheels would first touch the ground the robot would fall over backwards. The reason was that the car wouldn’t fold back up. I tried adjusting the car so that it stayed partially folded (like a hockey stick rather than a straight line) but this moved the center of mass so that the hooks wouldn’t grab reliably. It took me a long time to figure out a solution. After considering all kinds of ideas that would require an extra motor the simple solution can be seen in the last picture. To wheels sticking out the back of the cockpit would hit the ground first and start the car folding.

So now its May and the robot is done. It’s final weight is 900 grams (32 ounces). It climbs up and down flawlessly. A number of visitors get to see it but the project was always intended to include a video to share on YouTube. Here again the project stalls until November.

The last time I edited a video was back when I was running Windows 2000. I used Adobe Premiere 6 and After Effects. Linux doesn’t have as many video editing options as Windows. One program that I saw mentioned a number of times is Cinelerra. Unfortunately it consistently crashed after a few seconds of playing any video I loaded from my Camera. (The camera is a SANYO xacti.) I also found the Cinelerra documentation to be very poor. While looking for another program I found a forum where people were voting for their favorite Linux video editor program. Someone asked why Blender wasn’t on the list. The response: its a 3D modeling program. There were a number of follow ups explaining that while it is a 3D modeling program it also includes a very good video editor. There was something about the responses that made me want to try it. Blender is open source and cross platform, which is great. The documentation is good and the community seems very active. There are many tutorials. The down side is that it has a steep learning curve. When you first start it up it is difficult to even find the video editor. Because of the quality documentation and tutorials I kept at it. It took several hours to get used to the program but the whole time I had the feeling that the effort was worth it – that knowing this software would be useful. I’m very happy with Blender. I found that it can do all the things that I had previously done with the Adobe products.

I shot a bunch of views of the robot and the tower. Then two complete runs up and down the tower. Each run was a continuous shot. I did two runs so that I could cut between them to get views from different angles. The beep the robot makes at the end of each stroke, while not intended for this purpose, helped me to sync cuts between the two shots.

The music for the video is from the Nine Inch Nails album Ghosts I-IV, which has a Creative Commons license. (How cool is that?)

The model is available as a zipped LDraw format (.mpd) file here. The model isn’t 100% identical to the final robot. In some cases the part library didn’t have the exact part I used. Some details such as the rubber band connectors were left off. You can compare with the video and pictures above. The model is organized into sub models and includes some steps. It is provided as-is with no warranty. It was never tested by building the robot from scratch. The NQC program source is also provided as-is with no warranty. Here is a direct link to the YouTube video “Lego Robot Climbs K’NEX Tower”

We hope you enjoy the video.

5 thoughts on “Lego Climbing Robot

  1. As usual I don’t understand all the technical stuff but I am so impressed that Alexandria and Isabella were involved. You are a great Dad.
    Mom and Grandma (respectively)

Comments are closed.