Friday, 13 July 2012

I would like to introduce you to my robot. This is a Lego Mindstorm NXT 2.0 and yes, it’s a real robot, programmable and all. The Mindstorms are a set sold by Lego that includes a collection of Lego Technic pieces, three motors, four sensor and a “head”. One can then use these parts to built an endless number of machines. Once on has built the body, the head can be linked up to a computer for which Lego provides a simple program to write programs for the robot. These can be downloaded onto the head and off it goes. The four sensors supplied are a touch sensor, a microphone (above the head in the picture), a light sensor and an ultrasound sensor to measure distance (the “eyes”).

I had entirely forgotten that I had taken this set to London but when I came across it a few days ago, I just had to built something. Since I didn’t feel like doing a massive 3D puzzle, I settled for one of the designs provided by Lego to get back into it. Two motors control the right and the left wheel respectively and the third one opens and closes the grabbing arms. The touch sensor is linked to the crossbar in the front, the light sensor is installed behind it pointing down and the microphone is above the head.

This is a simple example for the sort of program supplied to it. Each block stands for a particular action. The green blocks control the motors and the orange block deals with feedback from the sensors. I wanted to start with something easy so I wrote it a program to go around and avoid obstacles. This is what I actually told the robot:

Turn both wheels forward indefinitely (first green block) until the touch sensor is pushed (orange block). Then stop and backtrack one full turn of both wheels (second green block) and turn slightly to the left by turning the right wheel forward by two turns (last green block). Repeat indefinitely (the orange box around it all which represents a loop)

Want to see this particular program in action? I made a little video for you which doesn’t want to be embedded for some strange reason. Just click the link, which should take you to YouTube. Can you see how the robot responds to the crossbar being pushed when it comes up against something?

At some point I really want to get an infrared sensor. That will allow it to detect heat and I am planning on using this to make it chase peoples feet. Nothing like having your own pet robot chasing your guests around. :D

PS: I’m in Germany for the weekend so I will reply to all comments when I get back on Monday!