Experiments in wearable electronic art.


Leave a comment

As I mentioned in my last post, I was faced with the task of reprogramming the address on ten of my MinM LEDs. I had this program sitting around for doing that. You’d twiddle a global variable (the new address you want the MinM to have), plug in the single MinM, upload the program, and it would send a broadcast to set the address. This was just plain dangerous. If I had mistakenly had my entire MiniMe buss plugged in when this program was loaded into the Arduino, it would have blasted all 50 of the LEDs to that same address. Then I’d have to reprogram each one back. I decided to find a better way.

My solution was to make an interactive program. It’s my first, but it’s already proven super valuable. I can give it simple one-letter commands in the Serial Monitor, and it does my bidding. Here’s the usage:

AnthrolumeTest v1.0

?             Print this usage information.
@n[nn]        Set MinM to address n[nn].
d             Dump I2C address map.
h             Print this usage information.
r g b c m y k All MinMs red/green/blue/cyan/magenta/yellow/black.
t             Run anthrolume hardware test suite.
v             Print AnthrolumeTest version.
w             All MinMs white (NOTE: supplement Arduino power!)

The ‘t’ command tests that there’s a device present on all the expected addresses for my anthrolume hardware:

>Command: t
* Devices found on I2C buss:
 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 48 49 50 51 52
53 54 55 56 57 58 59 
* Anthrolume device presence:
  Missing device addresses:

This conveniently points out that LED 47 is missing. Maybe it’s missing, or more likely plugged into the wrong four holes of its 8-pin header connector. There are easy commands for slamming the whole buss to a particular color, which is handy for measuring how much current the harness draws under different conditions.

So faced with my readdressing task, I added the “@” command, which lets me interactively write addresses. Since this test program already has the address-harvesting code in it, I made the @ command super-conservative. It checks to make sure there’s only one device responding on the buss before sending any commands to reprogram. And since it knows the address of the existing device, it doesn’t use the scary “broadcast” address anymore, avoiding the ugly blasting problem I mentioned above. This program is hella handy – I bet I’ll be adding commands to this thing a lot.

Author: regenesis

Seattle New Media artist.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s