I mentioned in my last entry that I’d been experimenting with the Not Quite C programming language for use with the Lego Spybotics brick. The hardware hack we made for line-following combined with a few lines of NQC code allowed one of the robots to successfully complete the line following course at Roborama 04.A (it took a last minute application of duct tape to block out some light leakage that was saturating the sensor). I still intend to write up the whole thing but I’m already contemplating further robot experiments that will likely involve a few of those new Maxwell 350F “D Cell” ultra capacitors.
Tag Archives: spybotics
Linux NQC for the Lego Spybotics Brick
When Frys was dumping Lego Spybotics hardware a while back for $29, quite a few DRPG people grabbed one or two of them. So we have a whole pile lying around and nobody knows quite what to do with them. The Spybotics brick is a bit more limited than the original RCX brick and, to make matters worse, they come with a Windows-only “visual” programming environment. I’ve been setting up programming environments on a Linux box at the DPRG Lab for various microcontrollers and wanted to figure out something useful we could do with all our Spybotics bricks.
I had wired my brick up to one of the Linux boxes and started experimenting when Ed Paradis noticed it and we got to talking. It turns out he’s been doing some work on robot swarm behaviour using Spybotics robots. He suggested we try Not Quite C. NQC compiles C-like source to the Lego bytecode format used by the RCX and Spybotics bricks. This is cool because you can write code in a familiar language. Ed gave me a copy of v2.5 and I started playing with it. There is also a newer version 3.0 but it’s still beta and didn’t compile on Linux or OS X. After a little hacking on the makefile and code, I got 3.0 to compile just fine. (patch submitted to the maintainers of course!)
Like most converted toys, the Spybotics units are not exactly ideal for real robotics use. They lack any sort of sensors that would allow odometery and, after a couple of weeks of trying, we could find no way to make them go in a straight line or do any sort of remotely accurate dead reckoning. On the other hand, a minor hardware hack turned the optical serial link used for programming into a tolerable line-following sensor. And the robot-to-robot IR communication makes them a cheap way of playing with swarm behaviours.
I’m told this month’s issue of Circuit Cellar includes an article on hacking the I2C bus on the Spybotic’s motherboard to allow more sensors. If it’s not too much work, this could make them a lot more useful.