Knowing nothing about microcontrollers, I chose something easy to start, the Picaxe family. The learning curve is easy, it’s designed for schools. Of course, something this simple is going to have limitations and by the end of two years of development, I’ve bumped up against most of them, but I wouldn’t have done this differently.
Picaxes are PICs running an interpreted BASIC. Programming them requires only two resistors and a simple cable direct to your PC, programming in circuit and debugging happens over the same simple connection.
I ended up using the top of the line chip, the 40X1, to get enough ADCs to read all the sensors. I also had to overclock it from 4 to 16 MHz and even then, the tangled control registers for the LEDs meant that I ended up doing as much pre-processing of data on the laptop, not at showtime. Still, it does the job, and does it in a QFP package that actually fits into the tiny space available. (The newer X2 parts are most shiny and would have been used if they’d been out when I put this together.)
I2C is used to talk to the LED drivers and to the on-board 32 kB EEPROM where all the data patterns sit.
The centre board carries, from left, one green accelerometer board, a two-channel LM386 audio amp, the square Picaxe, the memory chip, the copper board for the regulated power, and then another green accelerometer board:
The most useful component I found to help with the Picaxe was an LED between an output pin and the +5 V supply. This is set to pulse on when the Picaxe is active, for that instantaneous, “is it alive” check. Connecting it to the +5 V supply means that it also turns on when the Picaxe is downloading a new program, ideal for solving connection problems.
Picaxes are tiny and easy, but seriously limited in capacity. Even for the grunty 40X1, you’re looking at a grand total of 28 bytes of data memory, with 95 bytes of additional storage, and 128 bytes in a scratchpad. Yeah, that’s not megabytes or kilobytes, that’s bytes. Want to measure the battery voltage with one of the ADCs? You need two bytes to store that.
Your program goes in the program memory, which can hold a total of about 1000 lines of code. Hence my initial idea of generating assorted pretty patterns failed abysmally and I went a much simpler route, which I’ll describe in the next installment.