This is BrainLog, a blog by Dan Sanderson. Older entries, from October 1999 through September 2010, are preserved for posterity, but are no longer maintained. See the front page and newer entries.

December 2009 Archives

December 30, 2009

Alternative Programming Languages for Lego Mindstorms NXT

Lego Mindstorms NXT includes a visual workflow programming language called NXT-G, which is based on LabView. Simple NXT-G programs are easy for beginners to put together, but venture outside of a window's worth of building blocks and both the visual language and the program editor start to bog down. You can upgrade to LabView Educational Edition, but it's the same visual language. Anyone who has used a text-based programming language (basically any other programming language) starts to miss typing commands in a file editor pretty fast, and professional programmers are usually eager to teach their kids text-based languages.

Thanks to Lego's noble and common sensical offering of open development libraries and specs for the NXT, there are quite a few alternative programming languages and environments to choose from, both commercial and free. The most popular free solution appears to be NBC & NXC, an assembly language and a C-like threaded high-level language, respectively. The BricxCC IDE is only available for Windows, but the command-line assembler and compiler are available as source and as executables for Mac OS X and Linux. The book NXT Power Programming covers NXC, NBC, and BricxCC in 560 pages.

While I haven't tried it yet, I'm intrigued by pbLua, a Lua compiler that runs on the NXT brick itself. Loading programs is just a matter of transferring the source code files over USB or Bluetooth. This requires replacing the brick's firmware, but it's easy enough to fetch the original firmware from Lego to restore it. (In contrast, NXC programs don't require customized firmware.) For fans of IDEs, the site recommends using Eclipse with an appropriate Lua plugin, though this provides no special NXT programming or debugging features.

The Wikipedia article on Mindstorms has a survey of programming environments. Chris Anderson at Wired recommends RobotC, a C-like language and $30 Windows-only IDE developed at the Carnegie Mellon Robotics Academy with an interactive real-time debugger. (I'd gladly pay $30 if there were a Mac version.) Dick Swan, an author of RobotC, has a write-up of various options with excellent comparison charts, though I suspect it's slightly out of date.

Dick's charts highlight another good reason for choosing an alternate programming language: execution speed. RobotC claims an execution speed increase of as much as 130 times over NXT-G. Essential if you're going to attempt a Sudoku solver (which was written in NXC).

Oh by the way, when I linked that Sudoku solver video, I overlooked that the inventor has a great website with building instructions and NXC source code, and the same for a nice Rubik's cube solver.

December 29, 2009

The Acme School of Stuff was a kid's TV show from Canada from 1988 to 1990. The producer and host, David Stringer, has put a bunch of clips of the show on YouTube. Here's one on the Toronto subway system:

December 28, 2009

So what's the difference between the Lego Mindstorms NXT 2.0 kit we all got for xmas and the NXT 1.0 kit? About 170 pieces. The CPU is the same, the sensor selection is slightly different, and there is a different assortment of pieces for building models with older instructions. 1.0 came out a few years ago, 2.0 is new as of August 2009.

This means that many good books that were written with the NXT 1.0 kit in mind (such as "One-Kit Wonders") don't quite work with the 2.0 kit, since they require a different set of pieces. Unfortunately, so far Lego has not offered their own expansion set to make the new set compatible with old model instructions (as they supposedly did once or twice in Mindstorms history). Fortunately, an independent seller of Lego items is selling a NXT 2.0 retrograde kit with the missing 170+ pieces for $80. Bill also offers an upgrade kit for an NXT 1.0 that brings it up to par with the newer version.

Hooray for BrickLink, the fan-maintained database and marketplace for trading Lego pieces and products.

I take it the PC software that comes with NXT 2.0 is radically different, and not available in Bill's retrograde kit (though not exactly necessary). The NXT brick firmware is also a major upgrade, and it's not yet clear whether Lego will offer a free upgrade for older NXT bricks that have the same hardware specs. I can't imagine Lego wants to force loyal fans to buy a new complete kit just for the software, even if they can't justify manufacturing their own retrograde kit. [Update: Not sure why I wrote this paragraph. Lego makes the NXT brick firmware available for free download, and so far I haven't seen statements indicating that NXT 1.0 bricks can't be upgraded for the newer features like sound. I did see folks complaining about software differences, but I'm unclear on their nature and whether up- or down-grading is necessary for practical purposes. Bill makes it a point to mention that his retrograde kit doesn't include the NXT-G v1 CD-ROM, but I'm not sure why you'd need it. Comments welcome.]

NXT 2.0 FAQ [PDF] by has this to say on the difference between 1.0 and 2.0:

The NXT 2.0 set has a bigger and revised element assortment of 619 elements, 16 building and programming challenges for 4 new fun and action-packed robotic models complete with building instructions. The new hardware mix consist of an NXT micro-controller, 3 Interactive Servo Motors - with built-in Rotation Sensors, 1 Ultrasonic Sensor, 2 Touch Sensors and the new Color Sensor with triple functionality; it acts a Color Sensor - detecting different colors, as a Light Sensor - seeing different light intensities and also works as a Color Lamp.

EA to release new Simpsons iPhone game based on the old arcade Simpsons beat-'em-up, with all new levels and environments. The PDF fact sheet has screenshots.

December 26, 2009

Installing Lego Mindstorms NXT on Mac OS X 10.6 Snow Leopard

Did you get Lego Mindstorms for a holiday gift? Do you have a Mac running Mac OS X 10.6 Snow Leopard? Perhaps by now you've noticed that the software installer doesn't actually install the MINDSTORMS Here's the fix, thanks to and the forum, with an important addendum from this thread:

  1. Copy all of the files from the install CD to a folder on your desktop. You will be modifying an installer package to disable a piece of it.
  2. Find the Parts folder, then open it and find either MindstormsUnivEdu.pkg or MindstormsUnivRet.pkg. (Mine is the latter, I assume that's the "retail" version vs. the "educational" version.) Right-click and select "Show Package Contents."
  3. Open Contents, then Resources. Right-click the preflight file and select "Move to Trash."
  4. Navigate back to the MindstormsUniv....pkg bundle and double-click it to start the installer. Follow the instructions to complete the installation.
  5. Back in the Parts folder, double-click legodriver.pkg and follow the instructions.

You can now go to /Applications/LEGO MINDSTORMS NXT and double-click MINDSTORMS to open the application. If you get an error about a file missing (error "1003"), make sure you did the last step with legodriver.pkg. You may still need to run the full installer (the one that offers to install Adobe Flash Player and requires that you reboot the computer) to install the engine directory.

LEGO Mindstorms Sudoku Solver:


December 22, 2009

This TV commercial for City Harvest is pretty cool:

But the making-of video is especially cool:

An iPhone mounted to a makeshift motion tracking rig, with 3 "witness" cameras. It's almost as if I could do this myself with a desktop computer, $1,000 worth of software, and, well, probably mad skillz I don't have (the compositing looks hard). I like how even the City Harvest sticker was added digitally, but I guess that's the easy part.

(Via TreeHugger.)

December 19, 2009

Pomplamoose - Always in the Season:

Pomplamoose Music's YouTube channel. Subscribe.

Pomplamoose Music's MySpace page, with free downloadable MP3s, and originals worth paying for. You can also buy their originals via Pomplamoose Music's iTunes link.

The C Programming Language, by Brian W Kernighan & Dennis M Ritchie & HP Lovecraft.

4.10 Recursion

C functions may be used recursively; that is, a function may call itself either directly or indirectly. Uninquiring souls may take this as just another peculiarity of those C folk, of whose ways their neighbours speak little to outsiders but much among themselves.

Keener news-followers, however, wondered at the events of the winter of 1927-28, the abnormally large number of calls placed upon the stack, the swiftness with which that list was sorted, the disturbing lack of heap allocation throughout the proceedings, and the secrecy surrounding the affair.

People in the nearby towns had talked about C for nearly a century, and nothing new could be wilder or more hideous than what they had whispered and hinted years before. Many things had taught them secrecy, and there was now no need to exert pressure on them.

December 17, 2009

The Known Universe by AMNH:

Mag+, a concept video on the future of digital magazines.

December 16, 2009

Snow Leopard Update for ScanSnap. Up until November 2009, the driver/app for the Fujitsu ScanSnap didn't work 100% on Snow Leopard, but the fix is finally out.

MIT TechTV has machine shop intro videos.

December 15, 2009

Moebius Transformations Revealed:

Put This On: Season One reached its Kickstarter funding goal in time! Less dumpy clothing here I come!

December 11, 2009

Get Lamp: The Text Adventure Documentary is now accepting pre-orders at a 25% discount. $30 gets you 2 packed DVDs when it comes out in March.

Jason's BBS documentary DVD set is a treasure trove of footage, and I expect Get Lamp will be just as good. BBS wasn't especially well edited or concise, but for archivists and nostalgia buffs, more is simply better.

Via Jason, see this talk on IF by J. Robinson Wheeler. J-Rob's IFWiki profile.

December 8, 2009

Panic's lost 1982 artwork. Found. A beautiful joke with a limited audience, much appreciated. And actually for sale!

December 7, 2009

Beatles 3000:

December 1, 2009

Old Bits lists video games that were released a year ago, and are therefore probably available for $18 instead of their $60 release prices. Brilliant! I loved being reminded to buy Prince of Persia.