Tuesday, December 11, 2007

Never power down

Low power consumption computing is an interest of mine. While we have things plugged into AC that never really go off, they still consume a fairly high amount of power.

No, I'm talking about devices that never truly cut off. Or, at least, some portion of a device that never cuts off. How about a pico power AVR or MSP430 that runs off of a small coin cell battery for months/years. Running while quietly collecting data or waiting for a command from you to turn on it's host (we are still talking about parasitic computing here).

What useful things can we do actively under 1mA, while periodically sleeping at under 10uA?

Friday, November 23, 2007

... or is this more appropriate?

Someone at work (thanks, Rob K.) pointed out how maybe my "Biotrophic Parasitic Computing" idea is similar to the relationship between Remy and Linguini in the movie Ratatouille.

Does that sound more pleasant?

Wednesday, November 14, 2007

Biotrophic parasitism as a computing strategy

Biotrophic parasitism is a form of symbiosis between a parasite and it's host. The parasitic organism doesn't destroy it's host, but co-exists with it.

This presents an interesting strategy for embedded computing, or more precisely, the augmentation of existing embedded computing devices. This has, lately, become a consuming interest of mine. But, before I dive into that, here is something a bit more lurid.

This was the basis for my original line of thought: Parasitic fungi that control the behavior of the host. Unfortunately, this is not symbiotic, as the host is ultimately consumed or destroyed. I don't seek to replicate that type of relationship in my embedded augmentation experiments. But, outside of the grisly demise, it's pretty close to what I am talking about.

Consider this: You want to modify the behavior of your Roomba. You attach a microcontroller that feeds off of the Roomba's power and augments the Roomba's behavior through the "Open" serial interace. That microcontroller can be said to be parasitic. If the microcontroller is small enough (e.g. consumes little power from the host) and is well behaved (e.g. won't cause the Roomba to ignore it's cliff sensors), then it is a Biotrophic Parasite.

There are some microcontrollers (and of greater interest: microcontroller boards) that are well suited to biotrophic parasitism. For example: the Lilypad and this (3 for $10) board from TI, that can be programmed by this $20 development board.

Interestingly, I've been doing something along the lines of parasitic computing at my day job.

As I play with my iRobot Create (and forthcoming Roomba), I hope to exploit this technique further.

I like to call it Biotrophic Parasitic Computing.

Wednesday, May 23, 2007

Crypto for Everyone: Scripting and truly transparent systems

The idea of writing tools using standard unix scripting facilities (e.g. sh, awk, sed) may seem like a exercise for idle minds, but it has certain qualities that may make it beneficial to the end user at large.

That benefit is transparency.

For example, consider a simple blowfish encrypt/decrypt application. There are dozens of implementations in C, Perl, Tcl, Python, Ruby, etc. But, each comes with a certain amount of baggage. For Perl, Tcl et al, you have to make sure you have the right version of the interpreter installed as well as the right libraries. With C and C++ you have to make sure you have the compiler on hand with the correct libraries (unless you are willing to install an opaque binary).

However, a blowfish application that is written using always available OS facilities (under the assumption that your OS comes loaded with standard GNU utilities) is both portable and transparent. A blowfish implemented in gawk and bash/sh is very transparent. The user can see what is going on and even make modifications. Beyond that, adopting the "unix way" could make the usage of such an application transparent: it operates as a typical unix filter command where you can use pipes (and redirection).

This is an interesting idea (to me at least). Download blowfish.sh and you have an encrypt/decrypt solution (assuming you have gawk installed). Now, just use it. Pipe to it. Put it in /usr/local/bin (or some other convenient path) and use it as often as you would "cat" or "ls". It's not terribly fast, nor is it terribly efficient, but you can see what it does and can change it, play with it and make it do what you want it to.

This is all part of a copious free time deep thinking effort I've been up to. I am trying to figure out how to offer the simplest tools (simple in terms of installation, configuration and modification) to environments that lack such tools. It seems that everytime I (we?) think of an easy (usually GUI based) way of doing things, such as encryption, I (we?) get caught up in trying to provide the most sophisticated solution. Either that solution is never completed or simply doesn't "take".

Sure, blowfish.sh has vulnerabilities (mostly regarding typing passwords on command lines and buffering decrypted output), but for most users who do not do encryption, this offers some level of protection.

Now, you could argue that most "users" don't know how to use the unix shell or simply don't use unix (MS Windows is used by most of the computing world). But, you could wrap blowfish.sh in a BAT file or simply add a little more scripting to automatically encrypt samba mounted directories from a unix box (see my last post). This too sounds unsafe, but it is much safer than keeping your currently unencrypted list of credit cards, bank account numbers and passwords sitting around on a laptop drive.

Tuesday, May 22, 2007

Never underestimate the power of a small unix + lots of shell scripts

I've been wondering how to solve some home "IT" problems. You know, things like backup, password management, picture management, encryption of financial documents, etc.

I wonder what the combination of FreeBSD, bash (or ksh93!), gawk and samba would do for me.


If I could samba mount all of the primary Windoze harddisks (kitchen, guest room, etc), I could write a few scripts to do all of the dirty work. There is quite a bit of power and flexibility in having a smallish unix server controlling all of the MS beasts.

This would solve so many problems...

Tuesday, April 24, 2007

Cool eval board

This has caught my interest:

It's the Atmel AVRUSBKEY eval board. It does USB 2.0 as both host and controller. 16MB Flash on board with a joystick and a couple of LEDs.

Just $30. But, for some reason digi-key has upped their price to $50. What gives?

Monday, April 02, 2007


My current CFT activities have been consumed by Mailsavant. Mailsavant is a dual purpose CFT project. On the one hand, it wants to be a haven for email junkies like me. On the other hand it is meant to be the manifestation of some ideas I have regarding writing software.

As a haven for email junkies, I am building Mailsavant to offer what may be regarded as a retro interface for the internet. I already use email to post/manage content to my other blog. But, I would like to leverage email as a replacement for other casual web site interactions. In particular, I am building an event notification service that can be fed primarily via an email interface (no clicking on calendars, when I want to be notified "next Tuesday at 3pm" of a particular event, I *say* exactly that in an email subject line. The system acknowledges that it received my notification request and then dutifully notifies me of that event as it nears.

The idea that such software would not only be useful, but well designed/implemented is the other focus of this CFT. I am taking a very minimalistic "Software Tools" approach to development. Most of the software will be written in a combination of AWK and (posix compliant) Unix shell (along with stock programs that come with Unix -- ls, grep, find, etc). My programming methodology will follow the "Unix Way" (small tools with each tool accomplishing just one thing). I have my own bizarre reasons for doing this, one of which I want to avoid software bloat and *seriously* contemplate how to build an internet service from scratch with no preconceived notions or shortcuts.
Yes, everything will be written in AWK, including the SMPT mail server and mail delivery agent. And it will be built to be robust and stable (with decent performance too).

Very few open source libraries will be utilized. I expect the calendaring app will take less than a couple thousand lines of code.

Stay tuned.

Tuesday, March 13, 2007

Cure for the programming humdrums.

This book never fails to inspire me to write code. It is one of the few computer books (perhaps along with this) that I can say actually affected my perspective on programming. Since programming is as much a part of me as performing music is a part of a musician, these two books have had profound effects on my life.

As much as I like toying with hardware, at the end of the day I am a programmer. I may no longer care to follow the current fads and coding crazes, but I still love to code.

I'm hoping some bedtime reading of the former (Literate Programming) will help cure my current programming humdrum.

Tiny, tiny interpreter

I've yet to find a suitable scripting language for the Turtle. Its probably about time to consider rolling one of my own. I will probably use Tcl (circa 6.7) as a model. Rather than be "string" based, this language will be "array of byte" based, which will require some additional parsing. However, parse-on-the-fly model of early Tcl will be used (i.e. no intermediate byte code, no complex parse tree).

Friday, March 09, 2007

(Re)Kickstarting the Turtle

I've been taking a break from the Turtle (the iCreate robotic platform). But, now I'm trying to get myself back into the groove.

The way my mind works: I'm not motivated very much by hobbyist pursuits. That is, my CFT is usually grounded in building something practical. This is not a criticism of the wonderful Maker mentality. It's just that I don't seem to possess that gene (the one where you hack/make for just the intellectual gratification).

Now, mind you, when I draw or paint I am doing it solely for my own gratification. But, these days, with such limited CFT, I tend to want to make stuff that has some practical purpose (even if it is just to further my knowledge -- so I can do greater things). Maybe its my 40 year old brain screaming "do something useful".

I am working on some C functions to allow the AVR chip to control the Turtle. Of course, there is nothing special about this. I just really need to get something running so I can start programming the Turtle to do something "interesting".

Over the next few days, I need to determine what "interesting" is.

Wednesday, March 07, 2007

Logo is Lisp (sort of)

I've had an interest in Logo for the past 20+ years. Or, more specifically, I've known about Turtle graphics for over 20 years. I never really immersed myself in the Logo language though. I've always end up implementing Turtle graphics in my favorite language du jour.

Now that I have kids, I have to ask myself: When it is time for them to learn how to deeply interact with the computer (beyond browsing, games and paint programs), is Logo still the language I want to introduce to them?

Scratch is amazing, but something is missing when you don't "talk" to the computer in a written language (Scratch is a visual programming environment). Most of what you need is there, but there is no poetry.

I am very fond of Logo (and not just from a teaching kids perspective). I like its simplicity. I like the way it has a low entry level but no apparent "top" that would cause you to defect to another language. Logo is a dialect of Lisp. It's a simple Lisp with syntax added and parens removed.

I still think it is relevant. Do you?

My 8 year old son plays with Scratch from time to time. We haven't tried any "educational" stuff with it yet. Still, my son has an aptitude for math. Does he need it hidden by the layered GUI facade of Scratch?

Distracted by interesting books... again.

For a little nighttime reading, I've been re-reading Mindstorms. This led me to purchase Turtle Geometry. Both books were published around 1980, but are still more than just historically interesting documents.

Currently, I am mini-obsessed with working through at least some of Turtle Geometry. I know -- this is hurting my CFT projects, but I've been sleepy and too focussed on my day job to do any C & micro controller hacking at night.

Back soon...

Friday, March 02, 2007


I've been spending time bouncing between here and BLOGnBOX (a blog about blog software).

I've obviously have too much Copious Free Time ;-)

Saturday, February 24, 2007

HLL - High Level Languages?

Here's a cool idea: The turtle is programmed by having the brain (ATmega128) read scripts off of an SD card. So, this can't be C. I need a simple (s-i-m-p-l-e) scripting language running on the ATmega128. Something Lisp-y would be nice. Forth is a bit too low level (I don't want to hack the hardware with this language, I just want to use it to send commands to the turtle).

Still searching....


Software is tricky stuff. I do it for a living. Integrating lots of open source code is very tricky stuff. Nothing ever quite configures the way you exactly need it.

Circuit design and soldering is tricky stuff to. Even breadboarding gets tricky when you have to hunt down that 48 ohm resistor and mail order it. Then, half way through the delivery time you realize that you need a 22pf cap too.

I'm going to try and minimized the tricky stuff for my iRobot (turtle) hacking. Where I can buy a "module" I will (rather than code up work-a-rounds or do any major soldering).

For example, I decided to go with a simple ATmega128 board rather than the butterfly. Why? Well, the butterfly already required me to solder header pins (for UART, JTAG and ISP to start). Plus the UART has a voltage converter (14v RS232) where the turtle wants TTL level serial. I would have to hack the butterfly (either with solder: put another level converter in or through software: utilize the SPI ports for UART). Hacking the butterfly was starting to look ugly.

With the ATmega128, so far everything is about jumper cables. This is simple and clean. I should be able to just hook it up directly to the turtle.

Now, regarding software...
I want the turtle's brain (the ATmega128) to be able to take instruction from files on an SD card. I need an SD card holder that has header pins I can connect to the SPI on the ATMega128. Okay, that was simple. But... How do I interface the SD and 128? Well, I need an SD driver and a FAT file system. There are some free implementations out there (of varying quality), but the real question is whether or not I want to take the time to "port and integrate" as well as if I want to suck away a significant portion of my precious 4K RAM (on the ATmega128).

Sigh. Money to the rescue? I am looking at this. It does everything I would normally do on the ATmega128 (regarding filesystem and driver mgmt). I have to think about this. Simplicity = Money? Complexity = Time/Effort?

Friday, February 23, 2007

The Butterfly has been set free.

The Butterfly will be freed to work on other projects. The new brain for the turtle is an ATmega128 from MicroController Pros:

Tuesday, February 20, 2007

Alternates to the Butterfly

Creating a decent DSL that consumes no more than 1K RAM is a challenge (for me at least). Certainly coding the runtime/VM in C adds to the challenge (and bloat).

However, all I really need is a looping facility, conditionals and some primitive form of global variable creation (1K is not a lot of space to get fancy and do closures, recursion and other forms of state capture).

First, thing is first: I need to study the iRobot Create Open Interface and see what kind of commands I need to send and responses I need to react to.

In the meantime, I stumbled upon this ATMega128 board. Nice price, more memory (4K RAM) and perhaps more suited to my task than the Butterfly.

Saturday, February 17, 2007

DSL for Butterfly/Turtle

So far, the few languages I've seen for the AVR chipset are too general. I want to program the Butterfly to manipulate the Turtle. This is the only domain that I need to deal with. I could use a Domain Specific Language (DSL) that only addresses fundamental language constructs such as iteration and branching. The domain specific part just needs to manipulate the Turtle by way of the iCreate command set... And, all of this in 16K program (flash) space and 1K dynamic (RAM) space.

This should get interesting.

Thursday, February 15, 2007

The little problem of RS-232 interfacing...

The turtle wants 0-5V (TTL) serial communications. The AVR butterfly has a level shifter that brings it's UART to RS-232 levels. A simple jumper between the butterfly and turtle would have been nice. Instead I have to look into using the turtles level shifting DIN connector.

But wait! According to this I can use the USI pins to emulate UART. This would be nice. Just 3 plain jumpers between the butterfly and turtle and a lot of tricky software ;-)

How to program a butterfly..

The AVR Butterfly is based on the Atmel AVR ATMega169. This mcu has 16K of program space and 1K RAM. That 1K of RAM isn't too bad when you consider that this chip is expected to be programmed in C.

I'm getting pretty good at cutting C for the AVR chips. But, this would prove to be too cumbersome to really do anything "interesting" with the iRobot iCreate (which I refer to as "the turtle"). I could write C code to do some basic tasks, but I'd rather have a means of scripting the turtle. On a bigger mcu (ARM7, etc) I'd just load up Lua or Tcl (or some implementation of Scheme). But, 1K isn't a lot of space for dynamicism.

So, I am going to scour the web for any decent alternative programming languages for the AVR (but not BASIC and what FORTHs I've seen don't do much for me). If I can't find one, I may have to roll my own!


It has finally been released to the public. This is very cool and (hopefully) very important. I always thought that Logo was tremendously interesting and important as a tool for kids to learn modeling and problem solving, but the reading/typing requirements were to high for, say, a 6 or 8 year old.

So, a graphic oriented way to program sounds about right these days, especially if capable of doing multimedia. Squeak Etoys seemed to have to high of a bar for beginners, but Scratch seems just about right...

Friday, February 09, 2007

Jumper wires?

How come these simple things are so hard to find? I see vendors that sell jumper pins. I see vendors that sell controller boards with mounted jumper pins. But these same vendors never carry jumper wires.

Okay, found one.

I need about 25 jumpers for the Turtle's cargo bay connector.

Thursday, February 08, 2007

Choosing an AVR C compiler

This blog is lacking in pictures. I need to fix that. Unfortunately, for this post, C compilers don't make good photo material...

Choosing a C compiler should be a trivial matter, right? Hobby project? Limited budget? WinAVR or the GCC/AVR toolchain under linux are the sane choices.

Unfortunately, at work, I am using the world's most expensive C compiler (IAR) for my AVR work (its over $2000 for a full version; a "free" version is limited to 4K of code) and I am more familiar with it than the GCC/AVR toolchain.

A couple of other vendors offer 2K code limited "free" versions and aren't too pricey, but we are still talking about over $500.

Then, there is Rowley Crossworks AVR.

Rowley comes with a 30-day evaluation and a "personal" edition costs $149. From what I can tell it is the full blown version, but you can't use it for non-hobby projects. And, it has some "migration" compatibility with IAR! Plus, it is supported under Linux as well as Windows.

But, why in the world would I pay for a compiler?

Let's look at the potential negatives and my answers to them:
  1. My source code won't be of use to those without the commercial compiler. True, but I am emphatically NOT trying to do a software project here. Binaries are royalty free and people will be able to "port" my code to GCC if they wish.
  2. There are more libs (and support) for GCC/AVR out there. Arguable. Besides, I am going with "lightweight" here. No external libs, no OS.
  3. No Emacs. Well, IAR supports external editors, but the other IDEs don't. I've been using emacs for 20+ years now... hard to give it up.
A big plus for a commercial IDE/compiler: JTAG support. Sure, I could use Atmel's free AVR studio with WinAVR to do this, but I am looking to spend less time hacking my development environment and more time hacking robots.

I'm currently evaluating the Rowley compiler.

Monday, February 05, 2007

Potential Butturtle Project

I won't kid myself and think that people actually read this blog, which makes it all the more unusual that I actually wrote this sentence....

But, I digress. While I am waiting for parts, I have started thinking about what I would have the AVR Butterfly do to the iRobot Create (which I re-christened "Turtle").

One thought is to have the butterfly use its new host (sounds parasitic, eh?) to roam around a room. I could mount a simple proximity sensor and have it head toward any object it detects until it hits it (and then it veers off to another direction). This would meant to model a butterfly flitting from flower to flower.

Or maybe it should have "moth-like" behavior and use the AVR Butterfly's built in light sensor to head toward light -- no wait, I would need 2 sensors (one left and one right) to do this, but you get the idea.

I don't have any practical plans for this Butterfly/Turtle hybrid, which makes it all the more fun.

Sunday, February 04, 2007

Interfacing hardware needed

It looks like I'll be able to butcher the RS-232 shifter cable that came with the Turtle to adjust line levels between it and the Butterfly. Rather than use the DIN connector, I'll just remove the inline shifter board from the cable and hook it up to the Cargo connector (DB25). (Picture coming soon.)

Now, about that DB25... I am ordering this to provide an easy breakout to standard header pins.
So, I'll be waiting for USPS snail mail to arrive (this week?).

Saturday, February 03, 2007

The Turtle has arrived.

The iRobot Create has arrived. It looks pretty durable and steady. The AVR butterfly will swim in the cargo bay.

The first thing I've noticed that I'll have to deal with is that the Cargo DB-25 connector supplies 5vDC (TTL) for serial communication. The butterfly has an RS-232/TTL level converter on board, so they are currently mismatched.

I'll either need to route around the butterfly RS-232 level converter or bring the Cargo connector up to RS-232 levels (blech). Temporarily, I can use Create's serial cable (which plugs into a side mounted DIN) -- it has a built in level converter.

Monday, January 29, 2007

Butterfly on a Turtle

I just ordered an iRobot Create. I didn't order the command module because I want to use my AVR Butterfly instead. What am I trying to build? I don't know. I'll just figure it out as I go ;-)

Robots, Robots, Robots

I've been gone for a couple of years (not that anyone would have noticed -- wow, blogger still has my stuff). Since this is easier than updating my personal website (despite the fact that I developed a full blown content management system to do that -- see this for an example), hopefully there will be robot stuff appearing here.