Mood Cube – Arduino + BlinkM

An Arduino & BlinkM installed inside a photo frame cube.

Ambient technology is the current rage for presenting information in a unobtrusive and, sometimes, sublime manner. Information suited for an ambient format ranges from complex number-laden data streams to simple one- or two-digit numbers. The idea here is that you can glean the same information by simply looking at the color of a cube, rather than consulting a sensor’s text output.

While this project doesn’t directly take advantage of ambient technology, it does show you a great method for generating a simple color-changing LED that can be integrated into any number of projects. By combining the open-source Arduino microcontroller circuit board with a “smart” LED called BlinkM, you can build a simple mood cube that randomly generates a spectrum of sumptuous colors.

By pairing a sensor with this Arduino-based mood cube to input data, you can create a more ambient-like experience:_


  • Ambient Mood Cube – Install an ultrasonic motion detector and have the cube change its color due to your personal proximity. Kinda like a colorful greeting for a close encounter.
  • Interactive Ambient Art Cube – Add an accelerometer and create a cube that changes its color based on X-Y-Z orientation. Play with it, toss it around; the color changes due to your movements.
  • Weather Cube – Connect a barometric pressure sensor to the Arduino and program specific color changes for different barometric pressure readings. For example, make high pressure green, low pressure red, rising pressure, blue, and falling pressure yellow.


Time: 1 hour
Difficulty: Easy
Cost: $73.86 [Battery-Powered Version]


Power Options


1. Cut six 2 ¾-inch squares of self-stick matte paper. Apply each square to one window of the photo frame cube.

2. Plug the BlinkM LED into the analog pins 2-5 of the Arduino USB board.

Mood Cube – Power Supply

A DIY 9V power supply for the Arduino-based Mood Cube.

3. Determine which power option you would like to use. If you select the battery option, solder the 9V battery snap connector to the 5.5/2.1 Coax plug. Alternatively, you can power your color mood cube through the USB port of your PC.

4. Program the Arduino board with our sketch code. This code will occupy approximately 4584 bytes of Arduino’s flash program space.

5. Plug the 9V battery into the Arduino board. Move the Arduino power supply selection jumper to the EXT position. Install the board inside the cube. Bask in the vibrant glow of your continually changing color cube.

Mood Cube – showing its colors

An approximately 2-minute run of a “random” color sequence from the Mood Cube.

Arduino Sketch Code:

Here is the program used to generate random colors for the BlinkM LED.

  * le Color Cube

  * 26 Feb 08

  * Derived from BlinkM code
  * @
  * BlinkM
  * Arduino Diecimila

_// BlinkM connections to Arduino_
_// PWR - -- gnd -- black -- Analog Out 2_
_// PWR + -- +5V -- red   -- Analog Out 3_
_// I2C d -- SDA -- green -- Analog In 4_
_// I2C c -- SCK -- blue  -- Analog In 5_

_// Note: This sketch resets the I2C address of the BlinkM._

#include "Wire.h"
#include "BlinkM_funcs.h"


_//New BlinkM address_
**int** blinkm_addr = 0x10;
_//Color variables; red, green, & blue, will be assign a random value_
  **long** red = 0;
  **long** green = 0;
  **long** blue = 0;

**void** setup()
_//Random noise on Analog Pin 0 will set a random number seed_

  _  //Setup BlinkM: pins, address, script halt, fade speed_

**void** loop()
_//Seed red with a random value_
  red = random(257);

    BlinkM_fadeToRGB(blinkm_addr, red, green, blue);

_//Seed green with a random value_
  green = random(257);

    BlinkM_fadeToRGB(blinkm_addr, red, green, blue);

_//Seed blue with a random value_
  blue = random(257);

    BlinkM_fadeToRGB(blinkm_addr, red, green, blue);