Instructables

Ghetto Pixels - Building an open source BlinkM

Featured
Unless you've been living under a digital rock for the last few years, or just simply aren't interested in flashing lights, you'll already know about the awesomeness that is the BlinkM from ThingM. It's a very small PCB featuring a high power LED that responds very easily and cleanly to commands you give it. Devices like BlinkM's are often referred to as LED Pixels, because they can be linked together in fairly long chains, but still remain individually addressable (you can set the colour of each one to be different).

Right now, I'd like to give out mad props to ThingM and todbot, without whom there would be no BlinkM, and the world (or at least youtube) would be a much less colourful place. The aim of this instructable is not to take business away from ThingM, in almost all cases I would encourage you to buy a blinkM or two if you need them in your project, but there are some reasons why it's good to have alternatives and these are the ones I'm thinking of:
  • You need a lot of BlinkM's and can't afford to buy as many as you might need
  • You have all the bits needed lying around, and loads of free time and solder to make them
  • You like a bit of a challenge.
  • The form factor of the BlinkM doesn't meet your projects requirements (ThingM also do a variant called the MinM)
  • You are _really_ hung up about open source and want to stick it to the man.
For me, this project came about because of the first three in the above list. I needed 7 pixels, which is a few more blinkM's than my budget can stretch too, I had a bunch of parts already lying around and lot of spare solder (although the free time bit is always an issue) and yes, I'm a sucker for the impractical.  "Why buy something when you can spend hours and hours of your precious free time trying to work out how it's done and failing multiple times before finally suceeding, sort of, and ending up with something that is nearly, but not quite as good as you can buy."  I probably need to readjust my priorities in life.


So, The aims of this instructable will be to:
  • Introduce the reader to CYZ_RGB, an open source RGB Pixel firmware based on BlinkM
  • Show how to program the firmware onto a suitable Microcontroler
  • Suggest a way for building the pixel, that doesn't use Proto or PCB boards
  • Show how to use the Pixel.
From now on I'm going to stop using the name BlinkM to describe the product of this instructable, it's just not fair to ThingM. What I'm building isn't as good as a BlinkM, and I don't want people to think that the BlinkM is less awesome than it actually is, but it's been useful as an introduction because everyone is so familiar with the concept. From now on, I'm in the Ghetto Pixel building business.

Lets get started, gather your stuff.
 
Remove these adsRemove these ads by Signing Up
1-40 of 48Next »
sm119631 year ago
Has anyone been able to upload a stand alone script to one of these ghetto pixels?
FanjitaUK1 year ago
FYI : I've forked the original cyz_rgb project with a few fixes and extra functionality at https://bitbucket.org/Fanjita/cyz_rgb_fork.
smching1 year ago
Is it possible to run without an Arduno?
diy_bloke2 years ago
I could be wrong but I dont think the arduinoISP can be used to program a hex file. If it can then I have missed that :-)
bugsy10252 years ago
Hello jimthree,

I have been playing with this for the past 2 weeks... I have an attiny85 and im also using common anode but when I use the firmware that you have and also the one from CZY, it doesn't work. When I use the BlinkM flasher to burn... no problems and the works sequencer. I have no idea what im doing wrong. any insight?

just attiny85 using avr burn-o-mate with the fuse off for the 8 divide.

any information is helpful.
drewrox2 years ago
So, I've been eyeing this experiment for the past year, and this week, finally found enough free time to start playing. I'm not exactly having success quite yet, but I have the strange feeling I'm very close, and must be missing something. . .

So I bought 20 of the ATTiny45, and some LED's. The LED's haven't come in yet, but the processors have. I thought I could start playing, using some LED's I had laying around.

Okay, so after a little back and forth on the programming of the chip, I was able to get the Arduino as ISP working. I soldered a 8 PIN DIP to an Arduino Proto Board, and wired it up. I was able to flash it, and I had success. I disabled the CKDIV8 in the fuses.

I hooked up the ATTiny45 to a breadboard, and then proceeded to wire it up. I loaded up the Arduino Sketch for the BlinkMCommunicator, and the Sequencer with no lights coming on. I crossed the Ground with each of the resistor legs to make sure I had power, and I did.

So I dug into the sketch, and I was getting "Looking for a BlinkM: No I2C devices found"

I loaded up the multi-track sequencer, and did a scan, and it didn't find any either.

So, does this sound like an addressing issue? Anyone ran into this? Have any other ideas for me to check out?

Thanks so much in advance.
cnickerson2 years ago
This is an awesome instructable, but I don't understand why you don't just use a WS2801 chip or similar, they are a fraction of the cost (About $0.10usd each) and they address themselves...There would be no need to burn each chip with firmware and an address..
agr00m2 years ago
As requested, here's a little demo of 7 pixels I have working. I would have had all 10 going but I ran out of resistors :( I just bought another 40 chips, so within a week or so I should have 50 pixels in all up and running (assuming none crap on me). I'll definitely post my final product when I'm done too!

http://www.youtube.com/watch?v=IIGq40xvRec
mrtsunami923 years ago
Hey,
im using piranha common cathode LEDs, i can`t get it working :(
please help me
greets from germany.
jimthree (author)  mrtsunami923 years ago
No Problem! If you are using Common Cathode LED's then just use the original CYZ_RGB firmware from the downloads section of the website: http://code.google.com/p/codalyze/downloads/list

You don't need to use the firmware that I modified, because that's for the other type of LED's

Jim
what about the schematics ? still same ?
connect LED to PB 3/4/1 ? with resistors of course... cant get it workin :(

greets from germany!
jimthree (author)  mrtsunami923 years ago
Yea the schematics should be exactly the same. Have you checked that the LED is working? One thing I did when I was testing was to use individual LEDS and then you can bundle all the cathode's together to make a common cathode LED,. or all the anode's together for common anode. You really need to experiment with a breadboard. My guess is that if the LEDs you have are working, then the problem is going to (has to!) be programming the Chip. Make sure you know what you are doing with that. Tray and program a simple blinky light firmware on the chip. This might help: http://imakeprojects.com/Projects/avr-tutorial/

Jim
Hey,
AVR Studio 4 isn`t recognizing my USB tiny ISP.... what can i do ??? oO
if i flash the .hex via avrdude it gives me a "success" and a led lights up...
rgb led is connected to GND -- common cathode and the R, G,B with a resistor to PB 1/3/4

in BLinkM Sequencer, at scan I2C bus nothing is shown

help please!

greets from germany ^^
Sorry,
all working now :D Thanks a lot :D
but tell me, do i always have to connect ghettopixels--arduino--pc ??


greets
I'm having a similar issue with a common cathode LED except mine isn't even blinking when I connect it. I know i have the chip programmed correctly and fuses set, but I'm thinking it has to do with the common cathode wire, do you just have it hooked to ground? Maybe if you just told me what you did to finally get it working.
jimthree (author)  agr00m2 years ago
try giving the original CYZ_RGB firmware a spin, you don't need my firmware for CC leds. you can grab it from the downloads section of the website: http://code.google.com/p/codalyze/downloads/list

Jim
agr00m jimthree2 years ago
Yeah, I was using that one. I just finally got it working and wanted to post my findings. The current hex file must have the default address set to 0. So when starting the sequencer, you have to do this:

1. Open Edit > Edit Channel IDs and change at least one channel #s to 0 (easiest to just do the top one). This will make one of the sequences on the main screen address 0 and now should be tied to your chip/LED.

2. If you want to change it, highlight channel 0 (the one you just set), select Tools > Change BlinkM I2C Address, and enter the new address. The # along the left of the sequencer should change to.

3. If you go back to Edit Channel IDs, the LED should now glow the color of the channel ID in the list. If not...it's just a matter of continually trying to reset it. Some of them I had to close/open the sequencer, reconnect the Arduino, etc. but you'll eventually get it. The key though is to see if it glows the correct color when opening the Edit Channel ID menu.

Next I need to figure out how to run them from a single chip with pre-programmed sequences that I can control using like a push button switch to toggle through them! Any idea where I might find a tutorial on that? :)
agr00m jimthree2 years ago
Oh, I also wanted to ask, do you know how to hook them up so that you can run a string of them at the same time? I know the Arduino can only supply about 40mA, which is technically probably not even enough for 1 RGB if you're doing bright white.

If doing common Annode, I would think you just connect that to an external power source, then tie in the ground to the ground on the arduino. But for common Cathode, I'm not sure how you'd do that.
jimthree (author)  mrtsunami923 years ago
Yes, you'll need to have something that translates the serial output from the PC into i2C for the pixels. An Arduino does this very well, but you may find it's possible to make a BareBones Arduino (http://bit.ly/nJd3Xx), or even some custom Attiny firmware(http://bit.ly/rmCf8x) that that does this job for you, rather than tying up and Arduino.

Post some pics of your builds!

Jim
agr00m2 years ago
Can you power them all from the Arduino or do we need to hook them up to another power source? I'm thinking of you want multiple pixels on at the same time. I think the Arduino Uno can only supply about 40mA.

If so, how would you hook it up?
Mister_A2 years ago
Hi,

I'm trying to build one of these but I try to use it with my own arduino Sketch. I connect the RGB pins to pin 1,3,4 on my ATTINY45. But on Pin 3 and 4 the led simply blinks instead of fading on or of. On pin 1 the LED fades in and out like it should. If I have read the specs for the ATTINY45 correctly, only pin 0 and 1 support PWM. Is this the reason? But how does it work with this blinkm firmware then? They don't use PWM to fade the RGB leds in and out?

My source for my arduino sketch:
int redPin = 1; // Red LED,
int greenPin = 3; // Green LED,
int bluePin = 4; // Blue LED,

// Program variables
int redVal = 255; // Variables to store the values to send to the pins
int greenVal = 1; // Initial values are Red full, Green and Blue off
int blueVal = 1;
int i = 0; // Loop counter
int wait = 15; // 50ms (.05 second) delay; shorten for faster fades
int DEBUG = 0; // DEBUG counter; if set to 1, will write values back via serial

void setup()
{
pinMode(redPin, OUTPUT); // sets the pins as output
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);


}

// Main program
void loop()
{
i += 1; // Increment counter
if (i < 255) // First phase of fades
{
redVal -= 1; // Red down
greenVal += 1; // Green up
blueVal = 1; // Blue low
}
else if (i < 509) // Second phase of fades
{
redVal = 1; // Red low
greenVal -= 1; // Green down
blueVal += 1; // Blue up
}
else if (i < 763) // Third phase of fades
{
redVal += 1; // Red up
greenVal = 1; // Green lo2
blueVal -= 1; // Blue down
}
else // Re-set the counter, and start the fades again
{
i = 1;
}

// we do "255-redVal" instead of just "redVal" because the
// LEDs are hooked up to +5V instead of Gnd
analogWrite(redPin, 255 - redVal); // Write current values to LED pins
analogWrite(greenPin, 255 - greenVal);
analogWrite(bluePin, 255 - blueVal);


delay(wait); // Pause for 'wait' milliseconds before resuming the loop
}
jimthree (author)  Mister_A2 years ago
Hi there Mister A

So let me get this straight, you are using an arduino sketch compiled for the ATtiny45, probably using the core libs from the MIT group? That's very cool, I've been meaning to play with this for a while.

You are correct in both your points. Yes, the Attiny45 only has two PWM timers available, and yes the blinkM uses PWM to control all three colours.

The significant difference is that blinkM's and the CYZRGB code that we use here implement software PWM, rather than than using the hardware timers. (to be specific, I think they use the two hardware timers, and then the blue channel is done in software) . Read up on software PWM, that should give you some ideas.

Jim

corrupt852 years ago
Hi,

I would just liek toknow if this could be applied in the same manner to a Luxeon III Star Led like this one:

http://www.seeedstudio.com/warehouse/index.php?main_page=product_info&products_id=194.

i am kind of new to the whole electronics/led world and i've kind of hit a wall here.

im trying to get together an RGB LED preferably a luxeon or cree with super high light output and control the color sequences.

please advise,

Much appreciated.
jimthree (author)  corrupt852 years ago
Whooo there! Nope, i've not checked the link you sent, but i doubt it would work. The atTiny chip would not be able to provide enough current to power the Luxeon Led. You would need to get a "led driver" or make one yourself using transistors. It's beyond the scope of this instructable
Jim
jimthree (author) 2 years ago
Hi Scott. your breadboard looks fine to my eyes, but I can't verify that you have the -ve line from the tiny85 plugged into the cathode on the LED. You can tell the common pin from looking at the bits of metal inside the LED from underneath. don't rely on it being the corner with the flat edge.

The junk you are seeing in the serial monitor is almost certainly due to the eron baud rate. try changing the baud and seeing if you can get any sense out if it.

As you are using common cathode LED's your best bet would be to head over to the CYZRGB project and download their binaries, don't use mine.

Jim
Hi Jim,

Thanks. If by "-ve line from the tiny85" you mean PIN4 (GND) tied to the LED cathode, it's not. They're both tied to a common ground, but not each other.

And yes that's what you meant, I'm not sure exactly what you mean in terms of specifics... if I wire PIN4 to LED cathode, they'll connect but there won't be anywhere for GND to flow to.

Or maybe you meant something else by '-ve'?
jimthree (author)  scottinnh2 years ago
no, you are right, by -ve I meant ground. as long as bit the LED cathode and tiny85's GND are tied to a common ground somewhere, you will be fine. I think you should work out what is going on in the serial monitor first, as we know there is def. some problem there.
Jim
OH you're KIDDING me, Arduino IDE.

The Arduino IDE defaults to 9600 baud. The ThinkM script initializes serial to 19200 baud. Apparently the Arduino IDE can't detect this, self-adjust, or warn and so the text is garbled.. once I set the serial monitor to 19.2 I can read the output fine. Hopefully this helps someone else.

The LED still isn't doing anything, but at least I can start debugging it. Maybe I missed a setup step at the end. Feeling better at least :-)


Thanks

Hmm..

Serial console works perfect if I base a simple sketch around:
Serial.println("Hello World");

Let me ask this.. Are you using 0022 IDE?

I see in the BlinkMCommunicator sketch code, there have been past issues with it not working on a Arduino IDE release (there is a comment of 0012 incompatibility fixes in blinkM_funcs.h). It might be that again, or something else I just don't see.

scottinnh2 years ago
I took the suggestion to use common-cathode RGBs, and followed this tutorial, but I get no joy. Something's wrong obviously, but not sure what. Could a second set of eyes spot the problem?

The Arduino Uno has BlinkMCommunicator loaded. No errors uploading it. When I enable DEBUG in the sketch and open the serial console, each time I rese the Arduino it prints this junk: ¬Ö„ÖoÈg÷ãÃOþ

The ATtiny85 uses the type 85 firmware for CYZ_RGB. No errors when flashing it.

Arduino:
Analog IN A4 -> ATtiny85 PB0/PIN 5
Analog IN A5 -> ATtiny PB2/PIN 7
5V -> ATtiny Vcc/PIN8
GND ->ATtiny GND/PIN4

ATtiny85:
PB5/PIN1 -> empty
PB3/PIN 2 -> LED anode A
PB4/PIN3 -> LED anode B
GND/PIN4 -> Uno GND
PB0/PIN5 -> Uno A4
PB1/PIN6 -> LED anode C
PB2/PIN7 -> Uno A5
VCC/PIN8 -> Uno 5V

I saw in one comment that the schematic should be exactly the same if you use common anode or common cathode. So I did not change anything.

The LED is good.. if I move the 150ohm resistor to 5V, that color lights up.
At this point I can't tell if it's an issue with the controller on the Uno, my wiring, or an issue on the ATtiny.
Attached are some images (having trouble uploading them using Google Chrome.. second try..)
attiny-zoomout.jpgattiny-zoom.jpg
mrtsunami923 years ago
Hey all,
i build 10 "BLinkm clones" aka Ghettopixels.
now i want to place them in my floor and i want to use cat5 cable to connect them... will this work ? i got about 15meters length...

Thanks for upcomming answers
corrupt853 years ago
Hi, first of all congratulations and thanks for such a great tutorial!!!

My question is regarding a PCB boards. i see on this link (http://sjalbers.nl/Atmel/BlinkM/BlinkM.htm) that he has his mounted on PCB's. Ques: has he made these him self? if so how?? i really want to make some of these..

thanks

scottinnh3 years ago
Nice. And you made h-a-d. :-)

I just ordered most of the parts I needed for this... going to start by cloning 10.


For folks that appreciate this, there was another clone attempt of BlinkM someone did recently. It too is a nice effort (and includes a batch of custom PCBs): http://sjalbers.nl/Atmel/BlinkM/BlinkM.htm

Blinky stuff == AWESOME
I should point out for readers - this article text does not specify if the ATTiny45 should be 10PU or 20PU model.

I expect the 10PU is all that is needed (and if you notice, the author's bit.ly links actually link the 10PU model).

However, Mouser charges much less for the 20PU model ($1.87) vs the 10PU model ($2.30).

There may be other differences between the 10PU and the 20PU, however I can not qualify that (read the spec sheet).

Would be interesting to hear from some readers who made this..

jimthree (author)  scottinnh3 years ago
Thanks Scottinnh!

Yes good point, I was using the 10PU version because they were on special offer at my supplier, The 20PU's would be just as good, and could even be a bit better. I too would love to hear from anyone who has got a comparison.

Jim
jimthree (author)  scottinnh3 years ago
You are totaly correct! The glass wall project was a great inspiration for this project, and I used his build notes for reference. I certainly should have mentioned that in the instructable, thanks for linking it out.
Jim
great project. Couple of questions
!st how do I stop the flicker? some colors are solid and others flicker alot

I am using your firmware for the common anode and I finally got everything working alright. I am using the sequencer and everything works except when In upload to the blinkm. It doesnt seem to be holding the program. It just turns a solid color. Have you had this issue?

thanks
bryan
jimthree (author)  beverageexpert3 years ago
HI,

The flicker could be due to the 'Clock Div by 8' fuse being set, which would mean the chip is running 8 times slower than it could be. Read up on fuses and perhaps download something like AVR Burn-O-Mat to set the fuses using a GUI.

Yes, the firmware will only hold about the first 5 bars of a sequence generated with the BlinkM sequencer, but not the full sequence. If you want to use it in a stand-alone context, you'd probably be better of buying a proper blinkM. The guys who wrote the CYZ_RGB firmware sacrificed some (most) of the storage area for better colour interpolation

Jim
sydkahn3 years ago
great work - very complete - and with that little extra most people need to be successful doing someone else's project.

Wonder if a large surface mount type resistors would make it a little more compact.
1-40 of 48Next »