Pages

Follow the reluctant adventures in the life of a Welsh astrophysicist sent around the world for some reason, wherein I photograph potatoes and destroy galaxies in the name of science. And don't forget about my website, www.rhysy.net

Sunday, 24 August 2014

LEGO FTW

If you're reading this and thinking, should I buy a "Lego Mindstorms kit ?", let me save you the trouble and say yes. Yes you should. Because it's brilliant. Don't bother reading the rest of the post, because that's all you need to know.

I'm a great believer in self-rewarding for significant achievements. Completing my PhD got me a laptop, now 4 years old and still going strong - the second most expensive thing I've ever purchased, but by far and away the best. Publishing my thesis data got me a large glass brick (full of thesis data), which I use in just about every presentation possible. This time I'm celebrating publication of another data set, one which took an inordinately long time.

Lego Mindstorms has always been a case of, "yeah, looks fun, but I don't think I want to spend £200 on Lego." Fortunately, I had a £100 gift voucher from my friends at Arecibo when I left.
"I'll spend it wisely", I said.
"That's a shame, we were hoping you'd spend it foolishly", they said.
That was obviously a far better idea, so that's what I did.

I am not a hardware person. As a child, Meccano was OK, but I didn't have the patience to screw everything together (though for some reason typing in programs on a ZX Spectrum wasn't a problem). Woodwork was just a bit meh. Sewing was tedium itself. As for electronics, circuit diagrams give me a paroxysm of bewilderment while my soldering was the inspiration for the death scene of the T1000 in Terminator 2.

But even I can put Lego together from a kit. Plus I already know how to code in Python (which you can use to control Mindstorms if you're that way inclined, and I am), and the fact the kit comes with the parts for not one but five different robots sealed the deal for me (actually there are now official guides for fifteen !).

Each robot comes with 5 different "missions" which can involve modifying the robot and/or the code to control it. So far I've completed the missions for the most basic robot, the "Tracker". This is a simple tracked robot that demonstrates just about all the major features. It took me about 1-2 hours to construct.

In the box, you get bags and bags of >500 Lego pieces. Sadly there's no plastic container within the box to hold them all, so, having read another review beforehand, I went out and bought some Tupperware boxes. That was extremely sensible, since the raised rims of the lids stop the pieces from falling off when I'm gathering the requisite parts. The parts in each bag were pretty well organised so I kept them in the same system. It's simple to find whichever part I need.

I don't recommend just throwing all the parts in a big bag unless you want to give yourself massive Lego-rage later. Especially since there are a few parts you only get one of. Seriously, no, don't do it. Those boxes were quite a lot more full before the Tracker was built, and there's more in the shoebox.

Apart from the Lego, the box contains the instructions for the most basic robot (with handy parts guide and a ruler), and the cover of the box detaches to form a mission mat (where you can test some of the specially-designed programs). The full manual and instructions for the other robots are available online, unfortunately there's no printed version. But you're going to need to be on a PC to program the robot anyway, so that's not really an issue*. A nice thing about the online guide is that it gives you full 3D, rotatable views of each step of the build process, which can be incredibly helpful when assembling some of the more fiddly bits.

* I think it is possible to program the Lego directly, but I can't imagine why you'd want to.

Batteries aren't included either, so go out and buy a few packs of AA and AAA batteries (requires 6 AA and 2 AAA). You'll also, annoyingly, need a very small crosshead screwdriver to open one of the battery compartments.

The build quality is what you'd expect from Lego - genius. Unlike the cheaper imitations everything fits together pretty easily, but is robust enough to withstand some persuasion, when needed. Things don't fall apart unless you want them to. Assembling the Tracker was about the closest I've felt to being 10 years old again since Jurassic Park was re-released at the cinema. Sheer delight. In about an hour - a very, very happy hour - I had a little tracked robot roving around the house, servo-motors making pleasant whirring sounds.

Next step, add lasers.

The basic idea of Mindstorms is very simple - you have a programmable brick which can take input from different sensors and control different motors accordingly (the brick itself can light up, show simple images on its quaint LCD screen, and make sounds - "INPUT, STEPHANIE !"). The demo program just makes the robot rotate and move a bit, then stop. Switching it to manual infra-red control was simple and a lot more fun. The robot easily clambers over small obstacles and even quite respectable slopes.
(sometimes the IR stops working and I have to turn the robot off and on again, but I haven't updated the firmware yet)

Things get more interesting with the various missions, which teach you how to program the robot and use the different sensors. Programming is done not by typing out code (that's possible but I haven't tried it yet) but by visually placing different blocks in a sequence. Each block can take input from the sensors (e.g. determine how far away the nearest obstacle is with the infra-red sensor), affect the program itself in some way (e.g., wait for a few seconds, repeat some action), or control a motor.

The instructions on how to create the program blocks were simple, though the interface itself could maybe be a little streamlined. It has a few too many similar buttons that do different things, for example, a + button in one place will start a new project, whereas a + button very close to it will merely start a new program. I'm not really sure what the distinction is for, other than causing confusion when I press the wrong button. However, actually "writing" the programs is very easy indeed - it's an intuitive drag-and-drop interface.

The only difficulty I ran into was enabling the Bluetooth connection to the computer. The programmable block can connect via USB, Bluetooth, or wi-fi (but wi-fi requires a USB dongle, not supplied). Unfortunately the USB slot isn't accessible on the assembled robot, so Bluetooth was the only practical option. It wouldn't have been majorly difficult to take the programmable block out, but it would have been irritating - the cables that connect the sensors and motors to the block are long and inflexible, making things a bit awkward.

Anyway, I found the secret was to enable Bluetooth on the block (duh), but not to use the blocks "connections" setting to find the PC. Instead, use the Mindstorms software on the PC to connect to the block. That seemed to do the trick. So now I can press a button on my PC and a little robot will start shooting plastic balls at some miniature rubber tyres. Which is immensely satisfying.

EDIT : After updating the firmware, the only way I can connect via Bluetooth is to make a connection via the Lego brick itself, then turn it off, then connect using the PC software. That's quite annoying as it takes 1-2 minutes to do this. On many (most) designs, disconnecting the brick would be very difficult or even impossible without disassembling the entire robot.

Things got more interesting with the other Tracker missions. The basic model has a spinning blade, while others have a bazooka (shoots plastic balls a few feet), a gripper (very cool, my favourite - robots with hands are just innately more awesome) and a hammer (classic Robot Wars). My favourite mission was with the hammer - the program makes the robot jerk around like it's developed an unfortunate disorder, hammer twitching spasmodically, until you sneak up on it from behind. Then it turns around and gives you a good thump. Wonderful.

All of these accessories connect interchangeably to the "medium motor" (the large motors are used to drive the caterpillar tracks) and demonstrate ingenious ways that rotational motion can be used to do cool things.

As you can see, a rather nice feature is that there are enough parts to build all the accessories separately - you don't have to take apart the bazooka to build the gripper. Sure, it could use a few more spares, but it's hardly lacking.

With the kit you get a touch sensor, a colour sensor, and an IR detector (which can find the distance to nearby objects). It can also, somehow, sense the direction to the IR controller. You can also buy extra sensors online (the manual even mentions that it's designed for use with third-party sensors), like temperature and ultrasound (a Lego sonogram , anyone ?). The output of the sensors was easy to understand in the program builder - it was trivial to make the robot stop when it detected an obstacle, for instance. You can even control the whole thing from a tablet, though I've yet to try that.

The recommended age for this product is 10+. That's just stupid. If I had a ten year old there's no way I'd share it with them. They won't enjoy it on as many levels as I do.

I'd love to tell you more but I think I desperately need to build the six-legged walking robot now.