In case you think that I am fixated with projects to sort coloured balls, over the past few weeks I have been looking at a robot arm project. Usually these don't interest me, as I much prefer a project with a well defined repetitive sequence of operations, rather than one which picks something up then drops it and then finishes. However, this particular arm was inspired by a video on youtube by mac550 which can be seen here. This elegant design using one motor to lift and counterbalance the weight of the other caught my fancy, and from the video I managed to build a similar robot arm, although I changed the turntable drive, substituting a worm drive for the wheel drive shown in the video. This arm worked, and can be seen on youtube here. However there were several unsatisfactory features: the lift and drop sequence was soon over, with not a lot to show for the work involved in building the robot. Also, I used a series of plastic boxes to support the spanner being moved, and also, suitably adorned with coloured tape to act as targets for the colour sensor, and these were all fiddly to set up and were easily knocked out of position.
After a break, in which I worked through Lauren Valk's excellent book The Lego Mindstorm NXT 2.0 Discovery Book I returned to the project. Laurens had used some coloured card tubes as objects for his snatcher robot arm to grab and lift. It occurred to me that these might be used as targets for the colour sensor to detect on my robot arm project. I designed some holders, which held the tubes side on, in such a way that it was easy to adjust their position and height. Also, in order to keep things in the right place I decided to use a lego 32x32 base tile to locate the various parts of the project. I ditched the previous spanner load for the project in favour of using a Lego 52mm ball, which fortuitously fitted into the jaws of the arm grabber. In the next version of the arm which can be seen here on youtube, I placed the ball on a simple frame and used a slide plus catching pen in which to catch the ball when it was deposited by the arm. A simple hand operated mechanism allowed for a second ball to be loaded, so the model could perform two iterations before stopping.
However, I really wanted to overcome the limitations of having a short program run before a manual reload of the balls was required. I began experimenting with the idea of a runway system, to collect the ball when it was dropped and allow it to run back down to the starting position. This would enable the project to run continuously, hence the name perpetual mover. After some experimentation I came up with a system which worked repeatedly, with only a very occasional dropping of the ball. I also did further work on the arm, adding some strengthening supports between the two sides of the arm, modifying the support of the colour sensor to move it nearer the axis of the arm, and adding first a sound sensor, later replaced with an ultrasonic sensor to allow a "hand wave" or similar to initiate each iteration of the program, although a fully automatic version, which doesn't use this sensor was also included.
As far as the program goes, it is fairly straightforward, although I developed it to use two parallel processes. One runs the sequence of moving the arm, detecting the ball position, picking it up, moving to the deposit position, dropping the ball, moving to the park position and lowering the arm. The other, polls a push sensor "emergency stop" button, which can be pushed at anytime after the program has started to stop the arm. (A short pause may take place before the current process in the parallel sequence finishes). A logic variable named start detects the first time this button is pushed when the program is first run, which starts the first iteration of the program, and then "arms" the second parallel process with the button switched to "stop" mode.
The final result works well, and allows, with the second version of the program continuous picking up, moving and dropping of the ball. Provided the cables are routed as shown in the build instructions, there shouldn't be any snagging problems: the arm can be raised and lowered manually using the gearwheel above the vertically mounted turntable motor. A lego 11 beam is used to set the height of the top of the two cardboard tubes.
Full build instructions can be downloaded here, and the two programs, the first using the ultrasonic sensor, and the second which runs continuously can be downloaded by clicking the appropriate link. Finally a movie showing the arm in operation can be viewed here.
If you build the project let me know how you get on at email robin dot newman at gmail dot com