Towers of Hanoi



It started when I found a ancient RV-M1 industrial robot sitting in the basement at CCSF. Apparently it had been donated a while back, but didn’t include the manual so nobody had really used it. After a little googling I was able to locate the manual and the service manual. The robot arm is so old that it uses a DB25 serial port, so I had to convert it to the not-quite-as-old DB9 port. After a little fun messing with the serial pinouts I was able to speak to the robot using a USB serial adapter and my macbook. The RV-M1 has a gigantic “computer” box attached to the robot arm that will do the inverse kinematics, you you can specify a 3D coordinate and press go. I quickly found out that the joint servos are quite strong and fast, and there is no protection to keep you from smashing the arm into the table. fun!


At some point I decided to get the robot arm to solve the Towers of Hanoi puzzle. After doing a little reading I was particularly intrigued by the legend behind the game;


There is a legend about an Indian temple which contains a large room with three time-worn posts in it surrounded by 64 golden disks. Brahmin priests, acting out the command of an ancient prophecy, have been moving these disks, in accordance with the rules of the puzzle, since that time. The puzzle is therefore also known as the Tower of Brahma puzzle. According to the legend, when the last move of the puzzle is completed, the world will end.


I had recently heard in an astronomy class that scientists predict that our sun will die in approximately 5 billion years, and in it’s final stages of life it will swell up and swallow the earth — surely this will be the end of the world. The problem is that with the original 64 disks, even if the priests moved one disk a second, it would take 585 billion years to finish. The robot arm is fast but it definitely can’t make a move in 1 second.


With the idea that the robot would go in a display case at school, I decided on one move every 70 seconds and 51 disks, for a total completion time of 4,992,815,678.847 Years, just in time for the end of the world.


The RVM1 has a pretty limited reach in any one dimension so in order for it to handle 51 disks they needed to be thin and each disk could only be 1/8″ larger than the previous. Using a threaded rod and a router table I built a jig to precisely cut round plastic disks.


confetti maker




The 5 different plastic colors made for some pretty saw dust.


washer detail

Since the rules of the game only allow the player to handle the top most disk in any stack, I outfitted the robot arm with a magnet and countersunk steel washers in the bottom of each plastic disk. By just bringing the arm near the top disk, it grabs onto it, and then once the disk is on the pole, I can just swing the arm away to release it. It works really well.



Getting the algorithm for solving the puzzle into Processing was no problem, as this website has the problem solved in almost every language.

It hasn’t finished the puzzle yet… luckily. This video shows a much faster version.

Comments are closed.