Controlling BlinkM Maxm via I2C

Hi,
I have an Aduino 2009 and a BlinkM MaxM LED.
I have read in the datasheet about how to set up I2C communication and make up commands. I made this script as example to blink the LED from white to violet:

#include "Wire.h"

void setup()
{
  Serial.begin(9600);
  Wire.begin(); // set up I2C 
  Wire.beginTransmission(0x09); // join I2C, talk to BlinkM 0x09
  Wire.send('c'); // 'c' == fade to color
  Wire.send(0xff); // value for red channel
  Wire.send(0xff); // value for green channel
  Wire.send(0xff); // value for blue channel
  Wire.endTransmission(); // leave I2C bus
}

void loop()
{
  Wire.beginTransmission(0x09); // join I2C, talk to BlinkM 0x09
  Wire.send('c'); // 'c' == fade to color
  Wire.send(0xff); // value for red channel
  Wire.send(0xff); // value for green channel
  Wire.send(0xff); // value for blue channel
  Wire.endTransmission(); // leave I2C bus
  Serial.println("white");
  delay(6000);
  Wire.beginTransmission(0x09); // join I2C, talk to BlinkM 0x09
  Wire.send('c'); // 'c' == fade to color
  Wire.send(0x88); // value for red channel
  Wire.send(0x00); // value for green channel
  Wire.send(0xff); // value for blue channel
  Wire.endTransmission(); // leave I2C bus
  Serial.println("violet");
  delay(6000);
}

For now am powering ther MaxM from Arduino board from +5V and GND pins while SDA is from Analog 4 and SCL Analog 5.

The MaxM turns on and starts its default changing sequence through colors but doesn't respond to my commands. I tried the other I2C addresses as well, including 0x00 (general).
While serial output correctly shows 'white' or 'violet' every 6 seconds there is no change at all from the LED, just the default sequence.

Can you suggest me what else I should try?

Thank you

You have not set up a fade time, that might be your problem if it defaults to very long.

Alternately try using the 'n' now command.

hi,
I tried n as well, but no change. :stuck_out_tongue:

Are you sure you have the data and clock lines connected correctly to the BlinkM itself? If not, it would never receive the commands and only display its default script.

I would suggest downloading the example programs from the ThingM website, here. Then try the BlinkMTester sketch.

Hi,
thank you for the suggestions. I checked the connections and all seems fine including
d = sda => analog in 4
c = scl => analog in 5
Right now I have the MaxM on a breadboard with wires connecting it to the arduino pins. I tried changing breadboard and wires but same effect.
I tried the BlinkMTester sketch and the output in serial window is a bunch of unreadable chars.

The only effect was that MaxM stopped the default color cycle (it still does cycle if unplugged from arduino and master board is powered by battery, so default scheme is still unchanged but that's no problem).

I also checked Analog pins 4 & 5 using a sketch with an ultrasonic sensor. They work fine.

The gibberish characters in the serial monitor window are from an incorrect baud rate. Make sure that the rate in the call to Serial.begin (9600) matches what you have set in the selector for the serial window, then close and reopen the serial monitor window.

If you get that going, you should get more diagnostic info.

You might also check the ThingM support forum for info: http://getsatisfaction.com/thingm.

I have only used a BllinkM not a MaxM, so I can't say anything else for sure.

By the way, there is a default fade set in the BlinkM firmware, but I don't know the exact value.

The next step might be to take a photo of your circuit and post that here also.

Hi,
it works! With the above code (both with 'c' and 'n' options).
Apparently it was some bad wiring from me... ::slight_smile:

Thank you for the links, they are helpful to understand this little thing better.

Am pleased by the MaxM luminosity. Can produce enough light to see well 15 mt away. Haven't tested it with cameras though.. next step :smiley:

Thank you so much Andy & Mike

regards