My favorites | Sign in
Project Home Downloads Wiki Issues Source
CYZ_RGB: An alternative firmware for [ BlinkM]
Updated Jun 28, 2010 by

CYZ_RGB: An alternative firmware for BlinkM

Version Beta 1

BlinkM is a Smart LED produced by ThingM:

BlinkM is a “Smart LED”, a networkable and programmable full-color RGB LED for hobbyists, industrial designers, prototypers, and experimenters.

Just connect it to an I2C bus and start sending commands like "Show RGB Color" or "Fade to HSV Value" and so on and so forth (it does much more; see the human-readable data sheet).

The original BlinkM firmware from ThingM is closed source due to licensing issues, so CYZ_RGB was written to provide an open-source implementation which can be shared and extended to support additional features.

The latest release implements all documented features of the original firmware with the exception of the built in light scripts which are sacrificed to make room for the extended features of CYZ_RGB.

In addition to the stock features of the BlinkM firmware, CYZ_RGB implements a 16-bit PWM routine and a logarithmic dimming table to provide smoother fades and more accurate color mixing. The normal BlinkM firmware controls the LED duty cycle on a linear curve, but the perceived brightness of the light output does not correspond to a linear scale. There is little difference between #808080 and #ffffff on a standard BlinkM although the expectation would be for the former color to be roughly half as bright as the latter. CYZ_RGB fixes this problem and fades are more linear.

Future work on CYZ_RGB may include expanding the I2C master-mode operation, adding support for 1Wire instead of I2C, supporting external timing/clocking for script synchronization, or supporting more advanced color transitions and fade easing. Of course, help is always appreciated!


If you decide to download and give it a try, you'll find a hex file that can be burned to your BlinkM, MaxM, or other similarly wired ATTiny44, ATTiny45, or ATTiny85 microcontroller. A binary including support for running the device in I2C master mode is not distributed in this release.

Browse the source code.

Download the latest binary release (beta1).

Subscribe to news feed to follow developement.

Get the sources with svn: svn checkout cyz_rgb


Use avrdude to flash the chip:

avrdude -pt45 -cavrispmkII -Pusb -b115200 -Uflash:w:slave.hex:a 

Interested? I need help

I'd like to hear from you. If you have any patch to submit it will be welcome.

Please not that my experience in C is very limited. And it approaches zero when it comes to microcontroller programming. So, if you are any good at it, please be patient and expect the worse... i'm a java programmer ;). When you stop feeling sick after reading the code, well, drop me a line

Implemented features

command namecmd charcmd byte# args# ret valsformatimplemented
Go to RGB Color Nown0x6e30{‘n’,R,G,B}yes
Fade to RGB Colorc0x6330{‘c’,R,G,B}yes
Fade to HSB Colorh0x6830{‘h’,H,S,B}yes
Fade to Random RGB ColorC0x4330{‘C’,R,G,B}yes
Fade to Random HSB ColorH0x4830{‘H’,H,S,B}yes
Play Light Scriptp0x7030{‘p’,n,r,p}yes
Stop Scripto0x6f00{‘o’}yes
Set Fade Speedf0x6610{‘f’,f}yes
Set Time Adjustt0x7410{‘t’,t}yes
Get Current RGB Colorg0x6703{‘g’}yes
Write Script LineW0x5770{‘W’,n,p,d,c,a1,a2,a3}yes2
Read Script LineR0x5225{‘R’,n,p}yes1
Set Script Length & RepeatsL0x4c30{‘L’,n,l,r}yes
Set BlinkM AddressA0x4140{‘A’,a...}yes
Get BlinkM Addressa0x6101{‘a’}yes
Get BlinkM Firmware VersionZ0x5a01{‘z’}yes4
Set Startup ParametersB0x4250{‘B’,m,n,r,f,t}yes
Pre-defined light scriptsyes 5

x Only available in subversion head.

2 Max 10 lines. Only valid commands are go and fade to RGB. Script number 'n' is ignored, can only write script 0

4 current head version returns 0.1

5 only script 1. no predenfined script 0.

Goals for next release

  • Write a comprehensive test suite
  • Decouple cyz_cmd from cyz_rgb (done)
  • Decouple usiTwiSlave from cyz_cmd
  • Reduce binary footprint (now 4072b of 4096 available) (now 3740b, but still too big)
  • Add ability to write 2 scripts

Matteo Caprari <matteo.caprari>

Comment by, Sep 16, 2008

Matteo, thanks for kicking this project off. AVR programming is new to me but I think what you are doing will be of use to me on a hobbyist project that I'm working on. The little I've figured out thus far led me to believe I needed BlinkM to be a master on the bus. Thanks again for sharing your work.


Comment by, Jul 10, 2009

Any updates on this project?

Comment by, Nov 18, 2009

Hi, thank you for starting this project i've been looking for an open source alternative to the blinkM for some time now. I'm having some trouble using this firmware though. I'v built a blinkM using an attiny45v which should be pin compatible with the attiny45 and i have used an rgb led with common cathode. The problem is that only the red led lights up and there's no change in color. Could there be some difference between attiny45v and attiny45 so that the code doesn't work as supposed to?

Comment by, Dec 18, 2009


I've been browsing the source and running the test code under gdb to learn what's there. Looks good!

I'm new to avr programming (but have embedded software/hardware development experience), so I thought I'd look at this code as a starting point.

Not doing a blinky thing--I just wanted to see an implementation of the code for receiving commands over I2C.

Anyway, I noticed what I think is a bug on line 72 of test_ring_buffer.h. The msg buffer is only 20, but line 24 sprintfs more than 20 characters to msg. That will cause something to get trashed,I think.

I understand this is just test scaffolding code, but I thought you might want to know.

The test code (test failed, until I changed that buffer size (msg100?. Now they all pass. (cygwin platform).


Dave Thomas

Comment by, Jun 13, 2010

Has anyone else seen the "only red lights up" issue enkelbici wrote about? I am running into that same problem on "brand name" BlinkMs? I am trying to reprogram. Ideas on what could be wrong would be deeply appreciated.

Comment by project member, Jun 28, 2010

For anyone else who might be following along here, the new beta 1 release fixes the broken hex files from the former release along with adding a couple other great new features. It is also the first binary release for the ATTiny44 based BlinkM MaxM hardware.

Comment by, Jun 28, 2010

Yay John! Blinkenlights enthusiasts around the world send their thanks!!

Comment by, Jan 11, 2011

Nice work! Flashed the firmware onto 4 tiny85's in blinkm-like circuits. The PWM was really choppy until I realized that I needed to unset the div8 fuse; now everything is working great.

Comment by, May 18, 2011

Do you have any circuit examples? You don't seem to mention whether its setup for common anode or cathode RGB leds.

Comment by, May 20, 2011

I'll second that request for a reference circuit. I have some tiny45's that i'd like to use for this. Does anyone have a schematic?

Comment by, May 20, 2011

There is a blink clone schematic on this site: and you can find the offical schematic on the blinkm site here: I'm going have a go ast breadboarding one of these, and installing the cyz_rgb firmware. I'll document my build and post back.

Comment by, May 20, 2011

That reference circuit denotes common cathode then, the short amount of stuff that I've found on the net says to use some npn transistors to allow you to use common anode, I figured something like this would be suitable, the transistor is a 2n3904, I'll be using a piranha rgb led:

E ---- GND

B ---- 1k? resistor ------ analogWrite pin

C ---- Resistor ---- Led color Cathode

5v ---- rgb common anode

This is untested, anyone got any thoughts? I thought you might be able to invert the pwm signal so zero is full on and 255 is full off with a register bit but I'm unsure of how to do it, if it's possible without having to rewrite the code or use transistors that would be fantastic?

Just as a quick test with a red led in place I used the blinkM firmware, there is a reflashing tool, all the firmware files are in the reflasher download:

I'm using an arduinoISP on the arduino, for anyone else if you're using a 328 based arduino connect a 120ohm resistor between 5v and reset on the arduino, that will disable the serial reset on the arduino bootloader and stop it interfering with uploading to the attiny.

I used avrdude to program cyz_rgb onto the chip, using vista:

avrdude -P com3 -b 19200 -c avrisp -p t85 -v -e -U flash:w:cyz_rgb_slave_attiny85.hex

Don't forget to set the fuse bits, default is 0x62 for the lfuse, div8 needs flipping, to make the lfuse 0xe2:

avrdude -P com3 -b 19200 -c avrisp -p t85 -v -e -U lfuse:w:0xe2:m -U hfuse:w:0xdf:m

for each of the above commands substitute your programmers port for -P, baud rate for -b, programmer type for -c and chip ID for -p to suit (I think an attiny45 is t45).

I hope that helps someone else :)

Comment by, May 20, 2011

Can we use chips other than an attiny44/84 as the master? something like an attiny 2313?

Comment by, May 21, 2011

OK, 2313 only has 2KB of flash, so that's out of the question but the 4313 could be ok.... 4pwm pins. Looking through io.h it's just a question of putting a define in and remapping the pins?

Comment by, May 21, 2011

It should be a pretty easy change to the code to support common anode LEDs, as all my superflux RGB's are CA, I'll investigate this. Jim

Comment by, May 21, 2011

What should the behaviour be when applying (just) power to a blinkm with the CyzRGB firmware installed? Does it have a startup script?

Comment by, May 21, 2011

I've moved on to trying to compile the code myself, but AVR-GCC complains:

AVR Compiler: master.c --> master.o ../master.c: In function 'vector_5': ../master.c:94: warning: implicit declaration of function 'CYZ_RGB_pulse' AVR Compiler: usiTwiMaster.c --> usiTwiMaster.o AVR Compiler: cyz_rgb.c --> cyz_rgb.o AVR Compiler: cyz_cmd.c --> cyz_cmd.o AVR Compiler: color.c --> color.o AVR Linker: master.elf out/master.o: In function `vector_5': master.c:(.text+0x6a): undefined reference to `CYZ_RGB_pulse' make: [out/master.elf] Error 1

Does anyone know what's going on here? Jim

Comment by, May 21, 2011

Not entirely sure what's going on there but it looks like it can't find a header file in the linker stage?

I don't think matteo's cyz_rgb firmware has any scripts on it, he uses the eeprom for something else I think. I tested mine using the blinkM reflasher app. I used single leds instead of an RGB, once I knew the chips worked I moved on to my transistor based circuit using common anode RGB leds, everything worked fine (piranha 5mm super-flux RGB leds common anode). I'll test cyz firmware tomorrow but I think you should be able to use the blinkM example apps. to control the cyz_rgb firmware?

Comment by, May 22, 2011

In the source I downloaded, I can't find any function called CYZ_RGB_pulse() altough it's clearly being called in the timer overflow interupt (ISR) in master.c. I can only assume the source zip package is incomplete, I'll try and grab the code direcly from svn and see if that is any different. Jim

Comment by, May 22, 2011

It should be in cyz_rgb.h and cyz_rgb.c looks like they removed it in r290 but it does appear to be there in 289?

Comment by, May 22, 2011

I think that it looks like it just wasn't removed in master.c, CYZ_RGB_pulse was used in slave.c as well in revision 289 but is removed in 290, I would hazard a guess at removing it from master.c in revision 290 and see how you go, if not revert to revision 289?

Comment by, Jun 20, 2011

Hey Folks. I've used cyz_rgb in an instructable, you can see it here:

Comment by, Aug 7, 2011

Hi, I've built some Ghetto Pixels according to the tutorial posted. Having a slight problem though. After I got them put together, I can play light sequences directly through the BlinkM sequencer, but after I upload them nothing happens. The LED just turns green and does nothing else. Thoughts?

Comment by, Aug 10, 2011

Hi, have the same Problem as jimth. Any Ideas whats happened to the code ? Will there be a fix the next time ?

Thank You.

Comment by, Sep 12, 2011

Having an issue when trying to compile avrgcc. Error (copy / pasted)

AVR Compiler: master.c --> master.o ../master.c: In function 'vector_11': ../master.c:94: warning: implicit declaration of function 'CYZ_RGB_pulse'

Any idea of the cause / solution ?

Comment by, Nov 14, 2011

You guys can try contacting jimthree directly, or bringing his attention here. He's been awesome about answering some questions I had, on Instructables.

I haven't got so far as to potentially hit your problems (yet?). It's built, but I'm troubleshooting something else.

Comment by, Jan 1, 2012

After some struggling, I seem to have finally got the current slave firmware running on my ATTiny85.

Some notes to save others some time: - As mentioned above, just delete line 94 of master.c to get it all to compile. - Edit the makefile to set MCU to your chosen device, and make the 'out/slave.hex' target. - Most convenient way to flash the HEX for me was to use the official BlinkM reflasher. - Connections to ATTiny:

- VCC and GND as normal. - PB0 -> i2c data (Arduino pin A4) - PB1 -> blue LED via appropriate resistor - PB2 -> i2c clock (Arduino pin A5) - PB3 -> red LED via resistor - PB4 -> green LED via resistor No further hardware apparently required.
- When first booted, my CYZ_RGB wasn't responding to i2c scans from the BlinkM Arduino sketches, and it has no default startup script, so sits at 'off'. This had me convinced for ages that it wasn't working. Try 'A9' from the BlinkMTester sketch, which sets address 9. After that, BlinkMTester etc. were able to find my CYZ_RGB OK with scans. 'p1' will run the inbuilt script, showing a rapid one-off cycle through red-green-blue.

I'm not completely sure that the CYZ_RGB firmware is working 100% with script writing and playback, though. It looks to me like script playback may be running off the end of the script, and crashing (or maybe just processing junk script data).

Comment by, Jan 1, 2012

And it seems that the bug with running off the end of the script is because the script length is never stored along with the script. It looks like the boot parameters should include a script length attribute, updated by the SET_LENGTH_AND_REPS command.

How do I submit a patch to this project? It could also use a simple common-anode switch, too.

Comment by, Feb 21, 2012

David, Have you done any more work on this code? I'm no programmer but intend to use the code here. if you have some refinements to share, where can i find them? Parts are arriving soon :)

Comment by, Feb 29, 2012

I added a few extra features to the command set (from memory, the ability to go into sleep mode, and to loop N times) that were useful to me.

I've not heard anything from the project maintainers, so I guess I'll fork the codebase and upload my changes to github or similar.

You should be able to contact me at this email address if you want the changes sooner. I should say that I found the code quite buggy, and only fixed the things that I needed to. You may find that the official BlinkM firmware is more stable, if it suits your hardware.

Comment by, May 9, 2012

Is there a support forum for this? I'm having some issues getting it to work with a PIC 18F4520 and would like to see if anyone can help me troubleshoot. For whatever reason, all my chips have the address of 0x07, regardless of using the Set_Address? function.

Comment by, Dec 9, 2012

Hy, I am really attracted by this project. I think that the key point of all this ThingM project, is the FreeM. The wireless control with IR is cheap and efficient. To be the perfect slave of Arduino project, it should be extended to other remote control such as RF(868Mhz), wi-fi, bluetooth, aso. Arduino domotic project requires slave controller to do simple and repetitive actions.

Comment by, Dec 13, 2012

I've added an unofficial fork, including my patches, at .

Comment by, Dec 19, 2012

david's hint on setting the address via A9 is absolutely key.

Has anyone demonstrated the scripting working via BlinkMSequencer2? it's not working for me.

I've tried david's fork as well.

Sign in to add a comment
Powered by Google Project Hosting