BlinkM Smart LED as the Smallest Arduino

Did you know you can run Arduino programs on tiny BlinkM Smart LEDs? It might make BlinkM the smallest Arduino so far. To use a BlinkM as an Arduino, all you need is the free Arduino software, a low-cost AVR programmer, some wire, and a BlinkM. Here's a quick video showing how it all works.

BlinkM Capabilities as an Arduino

The BlinkM board doesn't have nearly the I/O pins and other features of a real Arduino board. But it is very tiny. Here are its capabilities: - 0.4" square (MinM), or 0.6" square (BlinkM) - 8MHz clock speed - 8k bytes Flash ROM (4kB on ATtiny45) - 512 bytes RAM (256 bytes on ATtiny45) - 512 bytes EEPROM (256 bytes on ATtiny45) - 5 I/O lines total, partitioned as: - 3 high-brightness LEDs in RGB package - 2 digital I/O lines - 1 analog I/O line (shared with digital)

And if you snip off the RGB LED, the three I/O lines used by it can be used as analog or digital inputs.

Most libraries will probably not work without some modifications. You don't get a hardware serial port either, but SoftwareSerial works.

Software Setup

To enable the Arduino software to program BlinkMs, you'll need to teach Arduino about new "Boards". This is done via a set of config files and AVR core code. This work has been done by the High-Low Tech group at MIT and Alessandro Saporetti.

The zip file contains everything you need. This zip file works for Mac OS X, Windows, and Linux.

Unzip the file, and copy the resulting "hardware" folder into your Arduino sketchbook folder. You can find the location of your sketchbook by opening the Arduino preferences and looking at the "Sketchbook location" field.

Restart the Arduino software and the "Tools" -> "Board" menu should now have entries for BlinkMs. There are three sets of entries, depending on the type of BlinkM and programmer you have. Select the entry that is correct for your hardware.

BlinkMuino Arduino IDE

Hardware Setup

You will need an AVR-ISP programmer to program the BlinkM boards. If you have an Arduino board, the ArduinoISP sketch turns the Arduino into an AVR-ISP programmer. However, it doesn't work for all Arduino boards. Or you can use a regular AVR-ISP programmer. These are fairly low-cost: the Atmel AVRISPmkII is 35 USD, while the Adafruit's USBtinyISP is 22 USD.

With a programmer acquired, wire up the BlinkM to it. If using a regular AVR-ISP programmer, it should be wired up like below. The intro video shows a practical method of using a breadboard and jumper wires to convert the 6-pin AVR-ISP connector to something a BlinkM can use. Note that some programmers do not supply power to the BlinkM, so you may need to run power too.

BlinkMuino AVRISP

If using AruinoISP, the hookup is as below. See the diagrams and photos on the ReflashBlinkM page for details.

ReflashBlinkM: Updating BlinkM firmwareReflashBlinkM: Updating BlinkM firmware

Using BlinkM as an Arduino

Now load up one of the example sketches located in the "hardware/blinkm/examples" folder of your Arduino sketchbook.

When you press the "Upload" button, the Arduino software will use send your program to the AVR-ISP programmer you've hooked up and it will program the BlinkM.

While the BlinkM is being programmed, its blue LED will flash. Once it stops flashing, the BlinkM starts running the Arduino sketch. At this point you can disconnect the BlinkM from the programmer and use it however you like. It runs stand-alone, no computer or Arduino board required, just power.

As an example, below is the "BlinkMuinoServoKnob.pde" sketch shown in the video. It assumes it is hooked up to a potentiometer knob and a hobby servo as in this diagram:

BlinkMuino ServoKnob

 * BlinkMuinoServoKnob -- Control a servo with a knob 
 * 2011 - Tod E. Kurt - -

// BlinkM / BlinkM MinM pins
const int redPin = 3;  // 
const int grnPin = 4;  //
const int bluPin = 1;  // PWM, will blink when programming
const int sdaPin = 0;  // PWM, 'd' pin, can be digital I/O
const int sclPin = 2;  // A/D, 'c' pin, can be digital I/O, or analog input

const int servoPin = sdaPin;
const int knobPin  = sclPin;

int pos;
int pulseWidth;

void setup() {
  pinMode(redPin, OUTPUT);
  pinMode(grnPin, OUTPUT);
  pinMode(bluPin, OUTPUT);

  pinMode(servoPin, OUTPUT);
  pinMode(knobPin, INPUT);

  digitalWrite(grnPin, HIGH);     // do a little "hello there" intro
  digitalWrite(grnPin, LOW); 

void loop() {
  digitalWrite(redPin, HIGH);     // say we're doing something
  pos = analogRead( knobPin ); // ranges from 0-1024
  analogWrite( bluPin, pos/4 );
  pulseWidth = pos + 1000;    // convert to microseconds pulsewidth

  digitalWrite(servoPin, HIGH);   // make servo pulse
  digitalWrite(servoPin, LOW);

  digitalWrite(redPin, LOW);      // say we're done

Getting BlinkM back to Factory Firmware

Programming a BlinkM board with Arduino sketches erases the normal BlinkM firmware. If you want that functionality back, there is a collection of BlinkM factory firmware files and an application to program them called ReflashBlinkM. Use this to get your BlinkM back to factory-fresh conditions.

ReflashBlinkM: Updating BlinkM firmware

Have Fun!

Using the BlinkM board as a general purpose microcontroller board is a real blast. It's astounding being able to reprogram something so small with the easy-to-use Arduino software. If you develop something neat with a BlinkMuino, let me know in the comments.