Introduction: Dr Blinkenlights... (or How I Learned to Afford the BlinkM)
Luckily, the hardware is open source and somebody has brought out an alternative firmware (although if you know where to look, you can find the official firmware).
This is the story of my trials and successes while making a much more affordable unit. (There seemed to be more trials than successes)
I am in no way an expert on this sort of thing and I did a lot of research along the way. I will be linking to the different sources that I used and lessons that helped me along the way.
This was partially made possible by Jimthree and his fantastic Ghetto Pixels. https://www.instructables.com/id/Ghetto-Pixels-Building-an-open-source-BlinkM/ I wanted a more robust unit with the possibility of removing the attiny for other projects if required. Thanks Jimthree!
Before we get into it, here's a little taster of what we're going to be making today...
So... (Deep breath) Here goes!
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: First Things First. Gather Your Weapons!
Before we get into the juicy stuff, we're going to have to get our supplies together. These will be divided between software, hardware and documentation.
You will need;
RGB leds. I get mine from Hong Kong and if you buy in enough amounts, they are pretty cheap. (MUCH CHEAPER THAN MAPLIN).
Resistors to suit the above leds. A good calculator for finding suitable resistors can be found here. http://led.linear1.org/1led.wiz
attiny45 or attiny85. The original BlinkM used the 45 and the latest version uses the 85, so both should work.
8 pin dip socket. This is not strictly necessary (it makes a higher profile board, but at least you can remove the chip to use in another project if you need).
Header pins. This will make your board removable from your circuit, but you could hard wire them into your circuit if you wish.
Copper clad circuit board. Pretty self explanatory.
A suitable programmer. Personally, I use my Arduino board along with the Arduinoisp sketch and a little shield that I knocked together in half an hour.
You will need;
Some sort of PCB production program. I use Eagle, but use what you know. http://www.cadsoftusa.com/download-eagle/
Something to calibrate your Attiny. When you get your factory fresh chips, they are clocked at 1Mhz. They need to be 8Mhz. I use my trusty Arduino as an ISP. You'll therefore need the arduino software. http://arduino.cc/hu/Main/Software
You will also need to get your Arduino talking to your Attiny, so head here http://hlt.media.mit.edu/?p=1695 and have a bit of a read and download the required files.
Something to program your Attiny. As above, I use my Arduino as an ISP, but you can't upload the firmware with the Arduino software, so We're going to use Winavr. http://sourceforge.net/projects/winavr/files/
Firmware for your Attiny. This is in the form of some clever guys who made an open source firmware for the BlinkM. http://code.google.com/p/codalyze/wiki/CyzRgb This will need to be put in a specific folder in your computer (on my laptop it goes into C:\Users\Flip.) The easiest way to find where it goes, is to open a command prompt ( Open your start menu and type cmd then enter) and see what it says just before the cursor. That is where it needs to be.
Something to test your new toys out with. ThingM have Arduino sketches for testing and playing about with. There is also Communicator software available for controlling and uploading code to the lights. You will find these on the right hand pane of the page. http://thingm.com/products/blinkm
BlinkM datasheet. http://thingm.com/fileadmin/thingm/downloads/BlinkM_datasheet.pdf
Attiny85 Datasheet. http://www.atmel.com/Images/doc2586.pdf
Step 2: Get a Cup of Coffee on the Go and Your Thinking Cap On.
It doesn't need to be coffee, but that's my drug of choice!
As a side note, I love Hot Lava Java brewed in the fantastic Aeropress. I haven't found a better way of brewing coffee. If you have no idea what I'm talking about, then check these links out...
Now you have your beverage of choice, get all your software installed and come back when you're done.
First of all, we need to get your Attiny85 clocked to 8Mhz.
Open up your Arduino software and upload the ArduinoISP sketch to your board (I like to run my sketches at 9600 Baud, so I tend to change this in the setup). Disconnect the board from your computer and attach the Attiny as per the instructions here. http://hlt.media.mit.edu/?p=1695
Plug your Arduino board in again and choose these settings.
Tools - Board - Attiny85 @ 8Mhz (internal oscillator; BOD disabled)
Tools - Programmer - Arduino as ISP
Tools - Serial Port - COMx (x being the com port that your arduino is connected.)
Then you need to choose
Tools - Burn Bootloader.
Please note... You are not burning a bootloader here. You are resetting the fuses in the Attiny to clock it at 8Mhz.
Next, we're going to get the firmware onto your chip.
Step 3: Get That Firmware on That Chip!
To get the firmware onto your chip, we are going to need a programmer. Hopefully you still have the ArduinoISP sketch loaded on your Arduino.
Make sure your Attiny is still attached to your Arduino as in the last step and open a command prompt. (In your start menu type cmd).
Make sure your firmware is in the right place (You will see where, when you open a command prompt) and type:
This will bring up a list of options explaining what everything does. It can be pretty daunting, but I'll cover what commands I use.
This is what I type in cmd.
avrdude -c avrisp -p t85 -P com5 -b 9600 -U flash:w:cyz_rgb_slave_attiny85.hex:i
So. What does all that mean?
Avrdude... That is what starts the party off...
-c avrisp... This tells avrdude what programmer you are using. In this case, an Arduino shows up as avrisp
-p t85... This is the avrdude code for Attiny85.
-P com5... This is the com port your programmer is attached to. (Change the number to suit your programmer.)
-b 9600... This is the baud rate (As I mentioned earlier, I like to use 9600. You can use what is specified in the sketch loaded onto your Arduino.) .
-U flash:w:cyz_rgb_slave_attiny85.hex:i This tells avrdude you want to write (w) the firmware (cyz_rgb_slave_attiny85.hex) to flash memory (flash). The 'i' is at the end to tell avrdude what format it is writing in (I think).
Avrdude should now read your chip, write to your chip, then read your chip.
If all goes well, you should get avrdude done. Thank you.
That should be your chip programmed and ready to rock!
If you get a fail, try again. I found sometimes it didn't work first time, but went through ok the second try.
A good place for a little tutorial on using avrdude can be found here. http://www.ladyada.net/learn/avr/avrdude.html
Step 4: Time to Get Creative.
Open the datasheet for the BlinkM and find the schematic on page 45. Design your circuit in the schematic editor (Don't make the mistake I made and make sure red goes to pin 2 and green to pin 3).
Open your board and start populating and routing.
I have added a few pics of the design I used, which you are free to use, but if you can improve, then feel free and share with the rest of us in the comments.
Once you have everything as you like it, you can start etching your boards. I won't go into this part too deep. Here's a few places to look for information on etching your own boards.
Step 5: Ladies and Gentlemen, Start Your Irons!
Now comes the fun part! (Although by the time you have drilled and soldered 9 boards in an afternoon, you might not think so.)
Break out your hole making tool of choice and get ripping into that fibreglass.
Before you get chewing up boards with a hammer drill and a quarter inch spade bit, I'll let you into a little secret.
You don't need a full on drill press or a cnc router. I use a cheap variable speed Dremel copy and 1mm drill bits. But you do need to be careful!
To stop the drill bit from skidding across the board and messing up my etching, I put the drill bit onto the board and start the drill up SLOWLY until the hole has been started, then I turn the speed up (I think for next time, I'll sort out some kind of variable speed foot pedal). There's nothing worse than ripping a trace up and having to start etching a replacement board.
Now the board looks like it has woodworm, you can heat up the soldering iron.
Start off with the resistors (Lowest profile part first). They don't need to be in any particular orientation, but make sure the right value resistors go in the right places.
Next comes the socket for the chip. This needs to go with the notch towards the led. This gives a visual indication of which way round the Attiny goes when you're finished.
After that is nicely soldered down, you can add the led. On my boards, I lay the leds flat against the board, but depending on how you are going to use them, you might want to stand them up.
Finally, you can solder the header pins in place.
It wasn't intentional, but it turns out there is just enough space between the pins and the chip to fit the board onto a breadboard. Lucky, eh?
Step 6: Get Testy!
Time to check if all has gone well.
Take your still warm board and slip your freshly burned chip into the socket.
Connect your Arduino and upload the BlinkM communicator sketch, then disconnect your Arduino from the computer.
***BlinkMs do not take kindly to being hot swapped!***
Attach your Board to analog pins 2,3,4,5 on the Arduino. (See page 12 on the BlinkM datasheet)
***Also note that the way the pins are on this design, the board will hang the other way from the analog Pins.***
(I never said they were perfect, did I?)
Follow the instructions on the BlinkM quick start guide and have fun. http://thingm.com/products/blinkm/quick-start-guide.html
Step 7: Time for Show and Tell...
Finally, I saved a shed load of money. I needed at least 10 BlinkMs for a project that's coming up. That would have cost me more than £100. I managed to knock these together for about £2.50 - £3.00 each.
Comments and creative criticism are welcome and I will answer any questions to the best of my ability, just don't ask anything too technical.