Introduction: Mini RGB Light Cube!

This is basically a knockoff of the Hypnocube, instead of being 64 LEDs, thus costing at least $150 to make, I made a smaller version of 8 LEDs for under $30.

The result is a 2x2x2 cube where each light is independently controllable. I'm not absolutely sure how many colors you can get from each light, but I could do 64 nicely without any "vibrations" in the color.

http://www.hypnocube.com

Step 1: Materials

Yes, you actually have to build with stuff. Since its so new to you, I've outlined everything you might need.

*Hardware
*Soldering Iron (Fine tip is needed)
*Solder
*Wire Cutters/Strippers
*Legos (The Technic kind that have the holes along the side)
*AVR Programmer (See Below)
*Continuity tester

*Parts
*8 RGB LEDs
*1 Atiny2313
*Resistors
*Wire
*Stiff Wire (Plastic twist-ties)
*Way to provide 5v (Wall wort, batteries, regulator, etc)

*Optional
*Protoboard/PCB
*Breadboard
*White Translucent Paint

*Programmer
*Parallel Port (Male, 20 Pin)
*20-Pin DIP Socket
*Protoboard or 20 Pin DIP Breakout Board

Yes, you DO need the Legos. They are the perfect jig for this project. If you cannot procure them, you will have to make a jig out of a 2x4.

I made an AVR programmer very similar to the one mentioned in the Ghetto Programming instructable, except I left out the header pins and soldered the wires directly to the pin's traces. Visit his instructable to figure it out, and get it working with your computer.

In some of my pictures you may see a Basic Stamp board, but I am just using it for it's 5v power supply, and its breadboard.

I bought all my parts at SparkFun Electronics, and I was very pleased.

Step 2: Planning

Since I've already done this for you, you don't actually have to do this step! These are just some preliminary thoughts that went into it.


Since my RGB LEDs were not frosted, and the colors were "separate", I decided to paint them with an acrylic paint that is used normally for a matte finish. I thinned it down with another paint that was transparent when dry, and had a small gloss to it. The result was quite pleasing, as you can see with the first few pictures.

Before embarking on building this, I made a prototype of it using regular LEDs that I had lying around. As you can see in the second "group" of photos. The first is 4 LEDs in my Lego Jig. Basically, you need it to be six studs long, and 3 bricks and 2 plates high, and its incredibly close to being square. (Its 0.07 studs off, for you number freaks)

I bent the anodes (the shorter ones) over and then soldered them to the next bent-over anode. You cannot touch the cathode! If you try soldering this and think its hard, its just getting started! Once thats done, repeat with the next set of LEDs.

Then, bend the ends of the cathode pins inward slightly, as in picture #6. Solder these to the bottom set of cathodes, without touching the anode "ring".

Finally, get 2 pieces of stiff wire, and solder connections from each anode ring to the bottom, for a total of 6 connections from the bottom.

The LEDs are now multiplexed. Select the tier and column to light up an LED. It worked, and I was ready to move on to the real thing.



Excuse my Marco-mode-less-camera. I'll try to explain the unseen detail using Photonotes. (They should be 3.1 megapixel images, so if you do decide to make it, maybe you can zoom it on it)

Step 3: The Good

In keeping with the Hypnocube's instructions, I've made 3 sections with the same name: The Good, the Bad, and of course, The Ugly.

You may think that these are fun little monikers, but seriously. While it will take you a minute to read The Ugly, it took me 2 hours to do for the first time.

You can start off by seeing how you're going to bend the LEDs. Mine went RCBG, yours may be different, so check!

Next, place all 4 LEDs into your jig. such that the leads are pointing diagonally inwards, red in the closest, the cathode. When you bend the red's, they should just touch, if not go a bit over the last red. Then fold the blues in the opposite direction, then the greens in the same way as the red. The blues should almost reach, maybe like 1mm off, but the greens will be over 1cm too short.

At this point, I bent the cathode slightly away from the reds, to give me some soldering room, then soldered all the reds together. After you get that red ring done, you should test for continuity across the ring. If you got close to the cathode, do a test for continuity to make sure you didn't solder to it. If you did... well try to get it out.

That was the easiest step! YAY!

Step 4: The Bad

So, now that you've soldered red, its time to move onto green and blue.

Carefully position the blue lead as close as you can get it to the next one. It will probably have a 1mm gap. Luckily, solder is good at that.

(Warning! If you have the iron too hot, you may bridge the gap, let go, and the lead will spring back, throwing hot solder all over you!)

On red, you wanted to use as little solder as possible. Here, I used a larger glob. Don't use too much, or you will solder to another wire.
(If you do, check out step 5.)
Repeat 4 times, and now you've got a blue ring! Yay! Make sure to check for continuity ;-)

The Bad wasn't really that bad, was it?

Step 5: The Bad -- Part 2

Finally, you will have to do the green.

For this, you will need a burnt LED or an old resistor that you don't like. (We need the wire) I only needed about 8mm per lead, 1 spare yellow LED did the trick.

Solder the donor part to the end of a green lead, then cut it off, using 1/2 of the donor lead. The green should be plently long enough to reach the next point, something that we can use to our advantage. Repeat for the other four.

We could just bend it straight, but it's much easier if we curve it around. Using some form of pliers, grip the wire right near the base, and turn it inwards 20 degrees (Making a 160 degree angle). Then repeat near the end.

This should just reach over to the next wire if you did it correctly. Go back and tweak it if it doesn't. Then repeat 4 more times.

(If the donor lead snaps off, due to a cold solder joint or something, you will have to solder it back on.)

Step 6: The Ugly

Haha! Now, "The Ugly"!

Now its soldering time! Solder the green onto the next green. The reason why this deserves its own step is simple -- Its incredibly hard. Here are some tips:

*Do not touch the blue lead. Its better to solder from the "outside rim" that straight downward.
*Do not let your iron get too hot, or leave it on for too long. Otherwise it may cause the donor lead to come off.
*Do not use a lot of solder. 5mm is plenty.
*If the lead is "floating" above the solder point, and you can't push it down, put a tool handle on it or something to keep it down, rather than using your soldering iron.

Its really tricky. If you do end up soldering to the blue, here is how I got rid of it.
(I do not own solder wick, and my other desoldering tools did not help)

*Try to thin it out along the leads. Make the connection between them as thin as possible
*Then, you may be able to get in there with wire cutters and cut the bridge.
OR
*Try moving the solder up some spare wire, for instance another dead LED.

Once you completed the green ring, check for continuity. However, don't celebrate yet!

Go back and do steps 3-6 again, skipping this part. You need 2 sets of 4 LEDs, one for each tier ;-)

Step 7: The Ugly -- Part 2

Now its time to solder the two tiers together!

The photo really shows it all.
On the top tier, bend 7-9mm of the common tips outward, then angle the entire lead inward.
I placed these in the jig while I held the top in place and soldered to it.
The trick, for those of you without 3 hands, is to solder 2 points, then it should be able to stand on its own, and you can get the other 2.
Check for continuity, and move on.

For the next part, you'll need some stiff wire. If you don't have any follow this tidbit:


Those twist-tie things have a core of wire that we can use.
(Warning: The ones coted in paper will be impossible to solder to, as there is a glue on them.)

I found some plastic coted ones that worked well. (One even had copper in it!)
To extract, I just grabbed onto both ends and pulled, as you can see in the picture.


Now we need to add lengths of it extending from each color down to the breadboard. Start with the upper tier, and choose an LED. On the right, solder in red, then green. (In that order!) Those go in easy. Make sure the soldering iron isn't too hot, or it could unsolder a joint.
Then, on the left side, solder in the blue. This is hard in such a confined area.

Repeat for the lower tier, but choose a different LED.

Test for continuity across the entire thing and fix anything that isn't continuous. You're done with the hard part!
(If you are going to paint the LEDs, nows the time to do so ;-) )

Step 8: Phew! Programming!

Heres a more lax step: programming.

I've been using mine on a breadboard, because I don't have an extra DIP socket to constantly replace the microcontroller.

I used Amtel's Atiny 2313. You could use anything with at least 10 I/O pins.
Connect the pins according to the picture. ('v' means lower tier, '' means upper tier. 'D5' and such are the names of the I/O's)


Programming this is actually very easy! I've written out a framework so that its easy for anyone to do!

Heres the file:

#include <avr/interrupt.h>   #define F_CPU 100000UL	      // Sets up the default speed for delay.h#include <util/delay.h>//First letter is Top or Bottom//Second letter is color (R/G/B)//Third letter is On/Off//TRN = Top Red On #define TRN PORTD = _BV(PD0);#define TRF PORTD &= ~_BV(PD0);#define TGN PORTD = _BV(PD2);#define TGF PORTD &= ~_BV(PD2);#define TBN PORTD = _BV(PD4);#define TBF PORTD &= ~_BV(PD4);#define BRN PORTD = _BV(PD1);#define BRF PORTD &= ~_BV(PD1);#define BGN PORTD = _BV(PD3);#define BGF PORTD &= ~_BV(PD3);#define BBN PORTD = _BV(PD5);#define BBF PORTD &= ~_BV(PD5);//First letter is column letter (A/B/C/D)//Second letter is On/Off//AN means Column A On#define AN PORTB &= ~_BV(PB7);#define BN PORTB &= ~_BV(PB6);#define CN PORTB &= ~_BV(PB5);#define DN PORTB &= ~_BV(PB4);#define AF PORTB = _BV(PB7);#define BF PORTB = _BV(PB6);#define CF PORTB = _BV(PB5);#define DF PORTB = _BV(PB4);//Use "WO" to wait for a small amount of time to modulate color//Adjust to keep LED color from "vibrating"#define WO _delay_ms(15);//Use "WL" to wait for 1 second#define WL _delay_ms(1000);int main(){  //Setup I/O ports: DO NOT EDIT  DDRD = _BV(PD4);    DDRD = _BV(PD2);    DDRD = _BV(PD3);    DDRD = _BV(PD0);    DDRD = _BV(PD1);    DDRD = _BV(PD5);  DDRB = _BV(PB7);  DDRB = _BV(PB6);  DDRB = _BV(PB5);  DDRB = _BV(PB4);  //Default state for the columns are on  AF;BF;CF;DF;  //END DEFINES	while(1){	//Everything in here will loop forever        //Insert your code here			}  return(0);}

I've commented it for you, and reading them should explain it.
Basically, you can use the first "set" of defines to select the color and height. Then you use the second "set" to pick the column. If you put the following in the code, after "//Insert your code here", it will light up the top 4 LEDs blue.

BGN;AN;WO;AF;BN;WO;BF;CN;WO;CF;DN;WO;DF;BGF;

The first line turns on Green to the bottom tier, while the other lines cycle through the columns.

However, this code will make an LED light up white-ish:
AN;TBO;WO;TBF;TGO;WO;TGF;TRO;WO;TRF;AF;

By cycling through the colors so fast, they blend together. If you've never blended light before, it basically works like this:
*R+G = Yellow
*R+B = Magenta (Pinky-purple)
*B+G = Cyan (A light blue)
If you want other colors, you can experiment with various ratios of on-time for each color.

As a rule: never have more than 1 color of 1 LED on at a time, otherwise they might not light up.
If you want to light up all 8 at once, try to keep the color simple.

Hopefully, you can create some interesting designs and animations on your own mini-hypnocube. This project is defiantly not a learn-to-solder project, as you could see, and I wish I had more experience before attempting this.

Comments

author
vishalapr (author)2011-07-23

This is an awesome instructable! I will be making my own cube soon!

author
akatsuki666 (author)2009-02-25

you guys are smart. can i hook up a rgb led in parralel with the different colors suck as: green to red , red to blue . and blue to green pls respond ty.

author

 im pretty sure that would work but you wont be able to control each color individually. 

author
jamwaffles (author)2008-09-12

great instructable. what did you paint your LEDs with and i like your pic commenting style lol!

author
junits15 (author)jamwaffles2009-02-18

it looks like whiteout

author
neardood (author)2008-06-08

it wiuld b nice if you had a video of sorts 2 see you're project in action. B4 i think of making one, i want 2 c someone's else work first!

author
zachninme (author)neardood2008-06-08

It would have been. Its been destroyed now -- and I even then I don't have a video camera.

author
The Real Elliot (author)2007-09-21

Cool. I like the 2x2x2 for cheapness/simplicity. I'm working on a monochrome (yellow) version myself, but at 4x4x4. We'll see if I have the nerve to do it up in color.

I like the paint-as-diffuser tip. I've tried sanding the LEDs and it worked only so-so. Thinking of snagging some white out from work and trying it out this weekend.

Finally, I'm confused by the DDRD = _BV(*) lines in the init. Using "|=" would and-equal them together, setting all of the ports to on. Using only "=" enables each one in turn, but then disables it in the next line.

I'd go with either DDRD = (_BV() | _BV() | ... ) myself, but the DDRD |= _BV(*) over a bunch of lines is fine too.

I find either of those options more readable than the old-school practice of figuring out the hex (or worse, decimal!) number that they "or" up to and using that. DDRD = 0x61 just doesn't speak to me.

Again nice cube and a good solution for the diffuser.

author

Thanks for the commnet.

Yeah, the RGB is extremely expensive, in bulk.

With the DDRX = _BV(*), thanks for the catch. I knew this was an old version of the code, and I didn't catch it.

author
dan (author)2007-07-01

argh! the blurriness! if you dont have macro, just figure out how far away you can still focus properly (probably 2 feet or so), and take the photo from there and crop it - it will come out much move visible that way. and yes, a video would be great.

author
zachninme (author)dan2007-07-01

Thats what I did for the intro image, but the camera's only 3.1 Megapixels, so the end result is a much smaller. Next time, I might try using that lens trick.

author
dan (author)2007-07-01

i have gotten good result by sandblasting leds (or rough sandpaper for just a few of them)

author
LasVegas (author)2007-06-30

A video demonstrating it in operation would be nice.

About This Instructable

28,606views

35favorites

License:

Bio: I decided a long time ago to change this text. Now, it still says this.
More by zachninme:Rate Comments on Instructables -- Greasemonkey ScriptRetrieving all the images from a Slideshow to save for laterBlock K'nex Instructables/Forum Topics/Groups! Now with Allsteps! Version 1.0.0.1
Add instructable to: