Sunday, October 22, 2006

iPod Robots?

It ran through my mind when I discovered the iPodLinux project last year (a very personal discovery, but iPL has been going on at least since 2003), that the iPod would be a very powerful brain for an intelligent robot (and I wasn't alone in pondering this). With CPUs running at 80MHz, plenty of storage space for robot learning, and a serial I/O (Gens 1, 2 and 3), it would be possible to control a robot with the Apple music player. In fact, the Roomba is already electronically compatible with the iPod serial port (Gen 1, 2 and 3), and its hacking is officially backed by iRobot. Wouldn't it be fun to start experimenting iPod-brained robots?

Sparkfun, one of my favorite outlets for sensors and ICs, has a few related iPod and Roomba development items: iPod Console and Roomba RS232 adapter, but they wouldn't be necessary once the iPod communicates directly to the Roomba.

Saturday, October 14, 2006

Old school tricks gone forever. Or not?

In the days of yore, we had OS 8 on our Beige PowerPCs and we liked it. If you are too young to remember those glorious days of Mac tradition, when MS Windows was really, REALLY bad, and
when Napster was the bomb, then open your ears and listen up. If you are one of those old Mac users, maybe this will bring a tear to your eye, nostalgia for the long gone era of Classic.

Back in the age of Classic, the average electronics student/Mac user had a few tools to survive a day of hacking. If, like me, you had a classic EE/CpE course track, you may or may not have used these Apps, and then sadly see them fall in the void of non-support.

Logic Sim (Shareware) by Arnaud Masson
This software was awesome for the Intro to Logic and Computer Architecture class. It was possible to make logic functions, counters, memories, and user-defined modules. The only equivalent in the PC world was MultimediaLogic (another great app), and it was rather easy to design and test in real time.

As11/Sim68 (Free) by Motorla/Tomaso Paoletti
Great for the Intro to Assembly and Computer Architecture courses. One program to assemble, one to simulate, in continuously or step-by-step. Catching instruction bugs was a breeze with Sim11, reducing those all nighters to 3 hour sleeps :)

However, with the coming of Intel Macs, Classic apps become completely unsupported by Apple. Could this be the end of these tools? It may not be, as much as Steve wants OS 9 gone forever. There is this little Classic replacement that has been lurking the Mac underworld since the days of BeOS: SheepShaver. This webpage shows how to get your Virtual Classic machine on your Intel Mac. Just be warned: it crashes a LOT, a lot more than OS 9 in old Apple hardware.

There must be many more resources that the two I used most heavily. Anyone else had a way to make Classic work in their engineering career?

Related links

Classic 68hc11 resources:
More educational classic software:

LogicSim screenshot taken from Dan Stone's webpage.

Saturday, October 07, 2006

LEGO Mindstorms: the Super-Easy way to make robots. Part 1

Ok, I will take a break from the long winded Microchip tutorials for now. No, don't worry, I won't leave the fact that you need C programming for your PICs. It is just that this blog needs to focus on lighter things and different topics too, like other micros and electronic stuff.

In this post I want to tell you that the LEGO Mindstorms IS supported by your Mac. And, although it is not supported officially by the LEGO Group, it may be a good thing that you don't use their super-easy graphical programming environment. If you have never seen it, here's how a code snippet would look like:

In this partial blog post, I will describe just one of them:

1. NQC (Not Quite C)

I used this excellent bytecode compiler (the code is interpreted by the RCX firmware, not run on the processor itself) during my undergrad junior year to program a line following robot. I used an iMac with OS 8.5 back in the time, but NQC has been ported to OSX in 2004. I recommend this package if you have just outgrown the LEGO Environment and know basic C syntax.

One advantage of using the LEGO firmware to run your bytecode is that you have all the firmware functions at your fingertips, like tone generation, power modulation (PWM), sensor conditioning (this is tricky business with the LEGO sensors), and LCD handling without even worrying about includes or libraries. The LEGO Group has taken care of all that for you. Another big advantage is multithreaded execution out-of-the-box. I guarantee you will really like this feature.

However, there are a few downsides such as a 32 variable limit, integers only, and no parameter passing. You really have to try it if you own a LEGO Mindstorms set. Here's a screenshot:

MacNQC handles your serial infrared tower (RIS 1.0) with the help of a USB-serial adapter, and USB Infrared tower (RIS 2.0) after installing the appropriate drivers.

MacNQC was created by Dave Baum, and is currently maintained by K. Robert Bate. Thanks to you both for this excellent application!

Two last details: while MacNQC is the friendly GUI application, but uses the older version 2.5r1 of the core compiler. The latest version (3.1r4) is available for OSX, but in command-line flavor only. Also, the new LEGO Mindstorms NXT officially supports OSX, through the magic of LabVIEW, no less!

The picture on top shows the Mushi Mushi 7 by Jin Sato.

Install the GNU PIC tools in your Mac

The GNU Pic Utilities is the open source way to code your PIC chips. Most PIC varieties are supported, I think. At the very least, it supports my two preferred models: the 12F675 and the 16F688 (respectively the smallest and the largest PICs supported by the Pickit 1). These tools are just one of the many Unix tools that have been rapidly finding their way to aid our tasks in our OSX computers.

In order to install it, you need first to install Xcode. I had version 2.3 intalled, but 2.4 is out now (it shouldn't make a difference, but there's always a chance of some source code not being compatible with the latest GCC compiler). Download Xcode directly from Apple.

After installing Xcode, go to the GPUTILS website and download the source package gputils. Uncompress it and move the folder in your home directory. Open Terminal and type:

~/$ cd gputils-0.13.4
~/gputils-0.13.4$ ./configure
[returns a long output, should be very fast]
~/gputils-0.13.4$ make

[returns a long output, it takes a longish time]
~/gputils-0.13.4$ make install
[returns a long output, should be fast]

Hopefully, to this point, you will have no compiler errors, and ideally no warnings either. To check that the install went by correctly, check the /usr/local/bin directory and verify that the files gpasm and other gp-somethings exist in there.

Next you want to include that directory in your PATH. To do this, type in Terminal cd ~ to return to the home folder, next type pico .profile to bring up a text editor with the .profile file, or to create it if it doesn't exist. Add as the last line:

export PATH=$PATH:/usr/local/bin

Press CTRL-X, then Y to exit and save.

Now to finally test this install, I will refer you to another blog. Since I have not been successful yet, at personally assembling my own code, go to Micah Carrick's intro to GPUTILS in Linux.

Post your comments and share if you were successful at assembling your PIC ideas!