Help get this topic noticed by sharing it on Twitter, Facebook, or email.

Use blikm directly from linux i2c bus

I want to work with the blinkm directly from an alix box that has an onboard i2c header. The box runs ubuntu, and so far I learned, that it should be possible for example by using i2cget and i2cset from the package i2c-tools which is part of the lm-sensors project.
Has anybody here tried that?
I think it's possible, but not straightforward. So, before diving into, I hope, someone already invested the time...;-)
2 people have
this question
+1
Reply
  • In the meantime, I'm trying the same thing on another device. This time it's a bifferboard.
    http://blog.famzah.net/2009/12/05/i2c...
    Some things work communicating with the blinkM, but some things are a bit strange:

    #i2cset -y 0 0x09 0 0x6E b
    #i2cset -y 0 0x09 0 0xAA b
    #i2cset -y 0 0x09 0 0x00 b
    #i2cset -y 0 0x09 0 0x00 b
    I would expect it to be red, but it's green

    i2cset -y 0 0x09 0 0x6E00 w
    i2cset -y 0 0x09 0 0xAA00 w
    -> blue

    i2cset -y 0 0x09 0 0x6E00 w
    i2cset -y 0 0x09 0 0x00AA w
    -> green

    i2cset -y 0 0x09 0 0x6EAA w
    i2cset -y 0 0x09 0 0x0000 w
    -> dark

    i2cset -y 0 0x09 0 0xAA6E w
    i2cset -y 0 0x09 0 0x0000 w
    ->red

    i2cset -y 0 0x09 0 0x006E w
    i2cset -y 0 0x09 0 0xAA00 w
    -> dark

    i2cset -y 0 0x09 0 0x006E w
    i2cset -y 0 0x09 0 0x00AA w
    -> blue
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • I'm looking at the i2cset manpage from lmsensors and I think out of the box it can't be used reliably with BlinkM. It assumes the I2C device has a register model, which works fine for temp sensors and such. Since BlinkM commands are longer than register writes, I think the BlinkM is getting confused by using two i2cset commands .

    It looks like however that an update to i2cset has been checked in that allows for I2C block writes: http://www.lm-sensors.org/changeset/5911 If you can get a version of i2cset that has these new features, I think it could work.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • Scott Ellis has a project on git hub that works very well on gumstix overo running angstrom linux (and beagleboards - small modification)

    https://github.com/scottellis/overo-b...

    just need to set i2c bus speed as per his other page
    http://www.jumpnowtek.com/index.php?o...

    Works well with multiple blinkm's on i2cbus 3
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • output from Scotts program

    root@overo:~/scottellis-overo-blinkm-71fbc48# ./blinkm

    Usage: blinkm

    The led address is optional and defaults to 0x09.
    Use a comma separated list to address multiple devices in one command.
    The color arguments are optional and default to zero.

    Available Commands
    find-leds
    set-rgb [-d led] [-r red] [-g green] [-b blue]
    get-rgb [-d led]
    fade-rgb [-d led] [-r red] [-g green] [-b blue]
    fade-hsb [-d led] [-h hue] [-s saturation] [-b brightness]
    fade-random-rgb [-d led] [-r red] [-g green] [-b blue]
    fade-random-hsb [-d led] [-h hue] [-s saturation] [-b brightness]
    play-script [-d led] -s
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • root@overo:~/scottellis-overo-blinkm-71fbc48# ./blinkm find-leds

    Scanning I2C bus for BlinkM devices...
    Found an uknown device at address 9 (0x09) : 0x6164
    Found 1 device

    put them into separate posts as kept getting chopped off
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • It also works well from python using smbus :

    import smbus
    i2c = smbus.SMBus(0)
    i2c.write_byte(0x09, 0x6f) # 'o' -> stop script
    #dark
    i2c.write_byte(0x09, 0x6e)
    i2c.write_byte(0x09, 0x00)
    i2c.write_byte(0x09, 0x00)
    i2c.write_byte(0x09, 0x00)
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned sad, anxious, confused, frustrated