Jan 05

How to Build a BlinkM Clone

The original BlinkM was the first in a series of I2C controlled RGB LEDs from ThingM. It’s easy to integrate into projects and control with anything that supports I2C. At its base level it is an ATtiny45 and a Piranha RGB LED. For anyone who wants a simple, elegantly packaged component I would highly recommend that you buy one of these. I am more of a do it yourselfer so I decided to build my own out of parts I had laying around.


Here are materials I used in my project:

  • ATtiny chip (I’ll be using the ATtiny85 but an ATtiny45 will work too)
  • RGB LED with a Common Cathode
  • 3 resistors
  • Jumper cables

This project is very tolerant to variation and you can really do it however you see fit. If you don’t have an RGB LED and want to use individual LEDs that will work. If you have a common anode LED instead of a common cathode LED you will need to use a different firmware package but it’ll work as well. The point is to have fun and learn.

Firmware upload

The firmware for the BlinkM is currently closed source. The reason for this is that the patent for controlling RGB LEDs over I2C is owned by Phillips/NXP. ThingM has licensed these patents to produce their line of BlinkM products. You’ll notice that the license for the BlinkM firmware states that it is for personal use only, not for internal business purposes or for commercial gain. Keep this in mind if you would like to produce a product using this technology.

Because this is closed source it led to the development of an open source alternative: CyzRgb. This firmware is fairly similar to the BlinkM firmware with some additions (like a logarithmic curve for more accurate colors) and some subtractions (it only has 1 script as opposed to the 18 BlinkM has). Some people have noted it’s buggier but if you want to make something that is physically different from the BlinkM (like using a common Anode LED) you will need to use it.

ThingM offers a simple way to upload the firmware through which is called the ReflashBlinkM. This program can be used with the ArduinoISP and can be used to load raw ATtiny chips with their firmware. To do this you’ll need to setup the Arduino ISP wiring as described in the Run Arduino Code on an ATtiny article. Once it’s all connected then start the ReflashBlinkM program:

  1. Select the BlinkM firmware to use (if you are using CyzRgb, select custom and pick the .HEX file from their binary zip file)
  2. Click ArduinoISP on Arduino
  3. Select the port your Arduino is currently on
  4. Click Reflash

ReflashBlinkM using ArduinoISP

It will show the progress in the text at the bottom. When it says “Reflashing Done!” you now are ready to use your ATTiny as a BlinkM.

NOTE: This worked for me when using my UNO but not with my Leonardo.


Now that you have an ATtiny programed with the BlinkM (or CyzRgb) firmware it’s time to build the rest of the circuit around it. It’s important to make sure the correct colors are attached to each pin. This circuit can run on 5v or 3.3v.

ATTiny blinkm clone wiring


Now that it’s all hooked up it’s time to test it out. When you first power up a newly flashed BlinkM it will run a default script which flashes through white, red, green, blue and off then starts again.

ThingM offers a package of example code which includes a handful of sketches for controlling it with Arduino. I found it easier to just extract the whole zip file to my Arduino Sketch folder. The all-in-one sketch for controlling everything the BlinkM does is BlinkMTester. With it you can use the serial monitor in ArduinoIDE to view a menu of options. If you are using ArduinoIDE 1.0.2 this will not work, it functions properly on version 1.0.3. If you are using a Leonardo you need to send “?” to get the menu to show up.

BlinkMTester Arduino Sketch Menu

Next Steps

This is an easy component to work with on its own or to integrate into existing products. I created mine as an exploration of the product but I foresee it having functionality in future projects where a diagnostic light is needed. In addition, since it works over I2C it’s compatible with a variety of development boards including the Raspberry Pi.

Aug 02

Arduino Controlled Garage Door – Part 1

Robotics and automation is a lot of fun as a hobby, however it can also be a great tool to solve common problems. Being fairly new to Aurdino and robotics, one area that seems within reach as a beginner’s project is home automation. I recognize that I’m not going to wake up one morning and be ready to deploy a system like SARAH from Eureka, but taking baby steps towards that goal seems like the best way to gain valuable experience and learn the challenges associated with such a system. The ice breaker project I’ve decided to use as a kickoff is a control mechanism for my 2 garage doors.

Current setup

The current setup I have in my garage is 2 Craftsman garage door openers. They are controlled through a set of wireless remote controls as well as a button wired directly to the units that allows the doors to be opened and closed from inside the garage.

garage door openergarage door buttongarage door remote

I want to leave the wireless modules alone, so I’ll be connecting to the wired connection for this project. On some initial testing I discovered that the 2 wire cable connected to the button on the wall is a 25v/2mA powered connection. When the button is pressed it connects the 2 contacts and the door opens, closes or stops. The relays I have are capable of handling 30v at 3A so this was a great fit.

Adding functionality

The main purpose of this project is to develop a system to detect if the garage doors are opened or closed (a problem my wife and I often encounter after leaving the house – did we remember to close the door?) and to be able to open or close the doors from anywhere, perhaps through an app on our smart phones.

This is really a 3 part problem

  1. Create a module that can open and close the doors
  2. Setup Arduino Ethernet to control the module remotely
  3. Develop a way to detect if a garage door is open or closed

Garage Door Control Module

With that in mind my first step is to build a permanent version of the I2C relay circuit from the Relay over I2C article. This modified version will need connect the door opener button circuit. The existing button will stay in place as a manual override (just in case the Arduino based system is not working).

The materials I used are:

Here is what the module looks like:

Relay Control Module - TopRelay Control Module - Botton

As a side note this is the last time I’ll try to solder a board like this, I’m going to have to test out the laser printer method to create a PCB next time.

This is a modified version of the code used in the relay article. When the module received a “1” or “2” over I2C it will switch on the appropriate relay then turn it off.  This essentially simulates a button press.

// Garage Door Control Module
// Fork Robotics 2012

#include "TinyWireS.h"                  // wrapper class for I2C slave routines

#define I2C_SLAVE_ADDR  0x26            // i2c slave address
#define RELAY1_PIN         3
#define RELAY2_PIN         4

void setup(){
  TinyWireS.begin(I2C_SLAVE_ADDR);      // init I2C Slave mode

void loop(){
  byte byteRcvd = 0;
  if (TinyWireS.available()){           // got I2C input!
    byteRcvd = TinyWireS.receive();     // get the byte from master
      switch (byteRcvd) {
        case 0x01:
        case 0x02:

void Press(int RELAY,int ontime){ // poor man's display
    delay (ontime);
    delay (ontime);

The code for the Arduino is the same as the one used in the Relay Control over I2C article.

Here is a video of the initial testing:

Next steps

At this point this module is still a very manual proposition. The module needs to be attached to an Arduino that in turn needs to be connected to a computer. The next step will be to create a web based interface to control this (and others in the future) module.