Wednesday, June 20, 2018

6x6x6 LED cube

At some point in every hacker's life, one should make an LED cube.  And, yes, I mean it should be bigger than 1x1x1 or 2x2x2.

There are so many videos and tutorials about how to make these.  I figured I'd write about mine, more as a reminder of what to do when I make another one, and techniques I found for making things easier.

LED cube dimensions

Well, it should be a cube, right?  So it should be n x n x n in size.  I chose to make mine 6x6x6, mainly because that would give me enough lights to make interesting patterns, and getting much larger (8x8x8) would mean having over double the amount of soldering I'd have to do.

A 6x6x6 cube has 216 lights.  8x8x8 would mean having 512.

Some day... some day I'll do a 7x7x7 or an 8x8x8.  Once you get to that level, you can start playing off of old fonts and drawing letters of the same resolution as an Apple II.

Material selection


Which LEDs?  Well, there are several basic factors here:
1.  Size.  The first cube I made was with 5mm LEDs.  The second one used 3mm ones.  The 5mm cube will be larger, of course, and that means it gives you more room to work.  There is a price difference, though.  From what I've been seeing lately, the 5mm ones are about twice as expensive as the 3mm ones.
2.  Color.  This is kind of up to you, but I've seen some cool ones in blue, so that's what I went with the second time.  The first cube I made used white, and it didn't seem interesting enough.
3.  Light style.  There are lots of choices these days -- cubey ones, short domed ones, "regular" tall domed ones.  Price is a factor, again.  The regular ones are less expensive.  Also, you probably should consider viewing angle.  Things like surface-mounted LEDs don't typically have a lot of diffusion or range of visibility.
4.  Diffusion.  From what I've seen online, you want diffuse LEDs.  If you get clear ones, you don't get the same visual effect.
5.  Forward voltage drop.  Different LEDs have different voltage drop characteristics.  Depending on your resources (i.e., how many of what kind of resistors you have), you may choose one style over another.  Realistcally, though, you should buy resistors of the right type that matches your voltage and current needs.

In my latest build, I used a big bag of 3mm, blue, diffuse LEDs.  They have a stated voltage drop of 3.0-3.4V, though I measured it more in the range of 2.8 to 3.1.  The short leg of each LED is 17mm, and the long leg is 19mm.  The ratings suggest you should only have a sustained current of 20mA through them.

(Unfortunately, most LED specs shown on eBay do not include details about lead lengths.)

I just ordered another set of LEDs that are still the 3mm type, blue, diffuse, and they came in with leg lengths around 28mm, much longer than the first blue ones I got.  The new ones are eBay, "1000 Pcs Diffused Led 3Mm Color Blue Light Super Bright".  With those, I could perhaps get 0.8" to 1.0" separation between LEDs on each ledkebab (see below) and use up much more board real estate.

What kind of wire?

For the kind of cube I make, I use bare, tinned copper wire, and I try to get a kind whose gauge is roughly the same as that of the LED legs, so 24 AWG or 22 AWG.  If you get much thicker, there's a greater disparity in heat absorbtion between the wires and the LEDs, making it harder to solder properly.

PCB

For my purposes, I am cutting my own printed circuit boards at the local HackerLab.  I do isolation engraving there, so we're cutting away copper from a surface material, leaving isolated traces behind.  That means I have to use FR-1 type boards -- FR-4 / fiberglass, while more prevalent, is not allowed for health reasons.  I use a single-sided, 6" x 6" board for the base of the cube.  The only place I've found to source that is inventables.com.

There are other sources for FR-1 boards, but most are 6"x4" at their largest size.

Tools

Something for making an accurate jig (I used the laser cutter; you could use a drill press.)
Something for helping bend column guide wire circles (I use a narrow screwdriver)
Something for making accurate spacers (again, I could use the laser cutter.  For sake of ease, I used a miter saw with some scrap 0.2" ply.)
A mechanism for cutting your PCBs (I use the CNC 3040 at the HackerLab and do isolation engraving using Target 3001! software.)
A soldering iron, and related consumables.
A solder sucker and/or desoldering wick in case of mistakes.
A solder filter fan and/or a filtration mask for safety.
Eye protection

Steps

1. Measure your materials.

Start off by measuring your LEDs, both the outer diameter of the bulb, and the length of the leads.

Using the short lead's length, figure out how far apart you want your LEDs, keeping in mind that the short leg of one will bend flat and touch the other.  You won't want to land the tip of the bent leg of LED #1 to land right at the flat bottom of LED #2.  That can lead to having too much soldering heat where you have the plastic casing, thus melting LED #2.

What I got for mine was about 17mm for the short leg length.  The LED outer diameter was 3mm, and the lead starts half way down, so I placed the LEDs 14mm apart, leaving me 1.5mm of overlap of the LED #1's lead past LED #2's lead.

In retrospect, I may have done better using a multiple of 0.1" so that my overall layout could work on a typical perf board that has that spacing.  Using mm as the unit for the physical cube spacing, yet using 0.1" spacing for through-hole components (headers) made it painful to do the PCB layout.

2.  Build a jig

My jig was simply a piece of plywood that was larger than 5x14mm+3mm in each direction.  That's five separation distances between the 6 LEDs, plus 3mm for the LED outer diameter.



The jig ends up being a 6x6 plane of LED holes.  Each should be set up to receive an upside-down LED, so the head of the LED drops into the hole, and then you bend the wires as needed.

Try to keep the border narrow.  You want at least one row of the holes to be close to the edge.  That way, if you move a set of LEDs, you can do that without having interference. 

For one of the holes, I also drilled an extra hole to receive the narrow screwdriver.  I used that as a peg so I could loop the long LED lead around it, forming a wire loop.  Having this hole nearby made for consistent spacing of all 6x6 wire loops.  Each wire loop was coplanar with each plane of LEDs.

3.  Bend up some LEDs in batches

In the end, I needed to make 216 functional LEDs that had bent wires.

Pop an LED into a jig hole, so the head is in the hole, and the legs are sticking up.  The short leg should be to your left, and the long leg to your right.  The short leg is the cathode (or "-" side).

Push the cathode straight away from you, and push the anode (long leg) to the right, thus forming an ell shape.  Make as many of these as you want.


4.  Make an LED kebab

Line up six of the LEDs in the jig such that each cathode (the short leg that was pointing away from you after bending) is touching the next LED's cathode.  Start with the LED that's farthest away from you, still pointing the cathode away from you.  Then, lay down the next LED one row closer to you, and have its cathode tip overlapping the prior LED's cathode.


Here's the topmost pair prior to soldering.

Solder the topmost pair.  This will give you some stability.  I used a magnet and weight to stabilize things.

When you do this soldering, you really don't want to keep the soldering iron on the leg too long.  If you do, you can melt the housing of the LED and thereby kill it.  So clean your tip, tin the tip with a bit of solder, and then as briefly as you can, solder the wires together.  It's ok if you end up with a bit of a blob here.  You can clean that up later.

Move on to the next LED until you end up with a column of LEDs.  When done, you should have six LEDs with connected cathodes, and a bunch of anode wires sticking out to the right.


Hint: You might find as I did that LED legs can be attracted with magnetism.  So, you can have a weak magnetic field (e.g., using the magnetized tip of a small screwdriver) hold one LED to another while you're soldering.

Hint: Joining the first two LEDs of each shishkabob is usually the hardest part, because the first LED is likely to rotate around as you're trying to stabilize things for solering.  You might find ways to stabilize the first LED with tape or other mechanisms.  Once you have the first two joined, they stay in the jig, and that prevents further rotational problems.

Hint: A little "overbending" of the cathode might help.  Normally you start by bending the cathode flat against the jig, without touching the prior LED, and then position the leg to touch the prior LED.  If you go beyond flat by a little bit, it helps secure things for soldering.

Hint: The very first LED can have its cathode bent toward you instead of away from you.  The second LED will then bend its cathode away.  As such LEDs 1 and 2 will have a lot of wire overlap, making for better alignment and soldering.  More importantly, it means that you won't have to clip off any excess wire at LED #1's end.

When you're done, you might want to clean up those solder blobs.  I do that by pressing lightly down with a small, flathead screwdriver tip on top of an LED bulb's area, and then briefly wiping the soldering iron tip across the sides of the connection.  Done right, this helps wick solder into the gap between the wires.  The screwdriver helps act as a heat sink, trying to prevent damage to the bulb.

Repeat.  You'll need six of these LED kebabs to form a single LED layer, and you'll be building six layers.

5.  Bend the loops

This step could be done after bending each LED, if you want.
Place each LED (individually before soldering, or each one of the LED kebab) in the hole that has the peg jig (the one where I used a thin screwdriver shaft for the peg).  The anode lead should rest below the peg (i.e., closer to you).  Bend the anode, wrapping it once around the peg to make a complete circle, so the lead goes around the peg and then ends up pointing out to the right again.


Flatten the bent circle by pushing downward on the circle's wire formation (down = towards the plane of the jig).  This helps with overall consistency.


Finish all remaining loops of the kebab.


Clip off the excess wire past each loop.


6.  Straighten some wire.

Unspool a length of the tinned copper wire, but do not remove it from the spool.  Bend the top into a little loop hook, and tighten that into the chuck of a portable drill.  (Since you've made a loop, there will be two parts sticking out -- the bent tip, and the part still connected to the length of wire that leads to the spool.)  Try to make sure the wire that connects to the spool is centered in the drill chuck.

Clamp or step on the spool so it doesn't move.

Spin the drill for about 10 seconds at high speed.  Here, it helps to pinch a section of the wire near the drill chuck tip to reduce overall vibration.  As you spin the wire, you'll see it start to straighten.

The wire may break off near the drill chuck tip due to metal fatigue, and if it doesn't, clip it off at that end.  Then clip off the end near the spool.  You should now have a length of straightened wire.

7.  Build the outer square of the plane

Put two LED kebabs back into the jig.  One should be on one edge of the jig, and the other should be at the opposite edge.  Make sure the wire loops are all facing the same way.

Cut two lengths of your straightened wire.  The piece you cut should be around 6 x 14mm in length (or in general, n x separation distance).  This will provide some overlap that you can clip off later.  Having that overlap makes it easier to place the wire and keep it stable.

Lay each length of the straightened wire to form the other two edges of the square.  The wire can be anywhere you want, but you'll want one of them to stretch from between LED kebab 1's LED #1 and #2 to the same place as kebab 2, and similarly from between kebab 1 LEDs 5 and 6 to the same on kebab 2.

Try to square those up to look good, and solder.  It helps to have markings on the jig to keep things square.



Building this outer square of the plane serves two purposes.  The first is that it establishes some structure.  The wires also act as a common grounding point across all LED kebabs in a plane, and having two provides for some redundancy.

(It would also be doable to have a single grounding wire across all planes, if you want.  It just makes things really wobbly when you do later steps.)

8.  Fill in the rest of the plane

Remove the outer square that you just formed.
Lay down the inner four kebabs in the same orientation as the others had been.

Put the outer square back down atop the four inner kebabs

Solder the grounding wires to the inner shishkabobs.  You should end up with 2x(n-2) more solder points.


Hint: as with an individual kebab, gaps between the ground wire and a kebab can be resolved by a second soldering pass.
- Tin the tip of the soldering iron
- Melt an initial blob connecting the grounding wire to the kebab LED cathode.
- Do the other solder points
- Go back to over the solder points one by one.  Use another heat-conductive device (e.g., a screwdriver) to press the ground wire down atop the LED wire, in case there was some gap there during initial soldering.  Re-melt the solder point while gently pressing down, and then keep the joint stable as the solder cools.
- Avoid hitting the same solder point repeatedly.  That can cause excess heat and melt or kill an LED.  If you have to hit the same place several times, let it cool each time before you try again.

9.  TEST the plane

Set up a power supply.  The ground line should connect to any of the ground wire points -- either to a cathode or to one of the grounding wires.  Make sure you have an inline resistor between the power line and the test probe point, or else you'll fry out LEDs as you test.  (In my set-up, I have a current limiting/clamping bench power supply, so I  keep the voltage to around 3 VDC, and gradually bump the amperage up to a point where it leaks current through.)

10.  Repeat, building the other five planes.


11. Set up the corner columns

This step is a little difficult to get things squared up properly.
The idea here is that you want four columnar wires to stick up from the main board in such a way that they're square -- i.e., orthogonal to the main board.
In order to affix each wire to the main board, you will need to solder each corner wire to the main board, and so at some point you'll need to have the main board inverted (or on its side) to do the soldering.

Here's what i'm thinking for this step:
11a.  Add some felt drawer bumper pads to each corner of the main board (on the copper side, i.e., the "down" side).  This will allow you to poke columnar wires through the main board, and have a consistent amount of wire on the under side.

11b.  Straighten and cut 36 columnar wires of a consistent length.
For me, I had 14mm separations between LEDs.  If we have all six planes at a height of 14mm apart, and we start the first at 14mm, then I'll need at least 84mm of height.  And then I'll need a little more to get through the FR-1 board and out the bottom side for soldering.  However, I'll want it to be a bit longer than that, because I'll need soldering space between the upper layers.  So, I chose to add a few inches to the length.
84mm = about 3.3 inches
I cut mine to 5.5 inches.
I also used 22 gauge wire for these wires.  The holes for the main board were cut at 0.8mm, and 22 gauge wire is about 0.65mm, so the 22 gauge wires should slide through easily.

11c.  Set the board on a flat surface, felt bumpers (copper) side down.

11d.  Insert the four wires that are at the four corners of the cube.  Each should slide through easily and rest its bottom tip on the flat surface below the FR-1 board.  But, because of the slop in drill hole, they will not stand up straight.

11e.  Slide all six LED planes onto the four corner columnar wires.  All the planes should be oriented the same way.  I choose to make all the loops point toward the back, so they're all on the same side as the control headers.  Try to adjust the planes to ensure the topmost plane is level.  (Individual planes might have some warpage to them as a result of soldering.)
In the image above, I have the bottommost layer (layer #1) laid down near the board, and the five upper layers supported by a bridge made of test breadboards and my wooden 14mm spacers.  This is before I realized that having alligator clips would be a better approach.  Instead of the breadboard and spacers, I could have attached four clips, one per corner columnar wire, below layer #2.

11f.  Attach four alligator clips, one for each columnar wire, above the topmost plane.  All we're doing at this point is giving the columnar wires some structure.  Align the columns to try to make sure everything is squared up.

11g. Using care to keep the FR-1 board from slipping off the four columnar wires, invert the whole cube, allowing it to rest upside-down on  your flat surface, held up only by the four columnar wires.

11h.  If possible, use some kind of square object (e.g., books) to keep the whole contraption square.  Bump these up against the sides of the six LED planes.

11i. Apply a bit of solder flux to the holes where the columnar wires are sticking through.  Solder two opposite corners' columnar wires to the FR-1 board.  Don't do the other two yet.

11j.  Check for square.  If either of the wires isn't sticking straight down, orthogonal to the FR-1 plane, then gently melt the solder at that point while adjusting the whole assembly for square.

11k.  Solder down the remaining two corners.

12. Lift the planes
Re-right the assembly (so the copper side is down again).
Undo the alligator clips, and re-attach them at the top of each columnar wire.
Lift all six layers nearly to the top of the columnar wires, so the topmost layer is touching the alligator clips.
Add four more alligator clips just below the raised, bottom-most LED plane.
At the end of this, you should have all six planes elevated above the FR-1 non-copper surface.

13. Lower the first plane
Place 14mm spacers on the FR-1 board perpendicular to the grounding wires (i.e., parallel to each kebab).

Undo the four lower alligator clips.

Lower the first plane, but keep the remaining planes held high, supporting LED plane 2 at each corner.

The first plane should rest its ground wires upon the spacers.

14. Thread remaining columnar wires
At each of the remaining columnar wire points (n x n - 4) slide the wire through its set of LED loop holes, threading from top (layer #6) to bottom (layer #1).  Double-check to make sure you didn't miss any.  Slide the wire down through its proper hole in the FR-1 board.  A set of needlenose pliers can help move the wires through, and it helps if you thread the innermost wires (the ones at the center) first.  Each wire's bottom tip should touch the flat surface under the FR-1 board.



Steps 13 and 14 could be done in reverse order, if you wish.

15.  With layers #2 through #6 raised, solder layer #1 to all columnar wires.

Moving from the centermost columnar wires out, do your soldering, but use the spacers.  Remember that each kebab isn't perfectly formed, and may have some warpage.

Place the spacer below the ground wires at the center, ensure firm contact between the grounding wire and the spacers, and then do the soldering.

Note: the LED loops that were bent earlier allow for some slop in movement.  You might find some are tight, and some are loose, and that's ok.

16.  Test all the LEDs in the layer

This is the point where you should make sure you didn't kill anything while attaching the layer to the columnar wires.  Make sure your power supply is at a safe voltage, and is current-limited (either via power supply settings, or using a resistor that's appropriate, e.g., 220 ohms).  Attach a grounding wire to either ground wire of the plane.  Then, briefly touch the (current-limited) power line to each columnar wire's top end.  One light should light up with each touch.

Repeat the test if you want, to make sure you're not burning out LEDs as you're testing.


17.  Check below the board

With layer #6 secured from above (clips on corner columnar wires above layer #6), invert the entire cube.  The bottom of the board should look something like this, only having the four corner columnar wires affixed at this point:
If you got all the other columnar wires threaded through properly and soldered to the first layer, they should not fall out at this point, and they should be poking through the board as shown.  If any wire falls out, you didn't solder it properly layer #1, so go re-thread it all the way through the board, and try again.

If a wire is affixed to layer 1, but is not poked through the board, you have to fix that, too.  You'll need to de-solder the problematic wire where it joins to layer #1, slide the wire through the board, and re-solder at layer #1.  If the wire is aligned well with the board hole, you may be able to just warm the solder at the joint, slide the columnar wire down and through, and then finish the re-soldering in one motion.

I recommend against soldering all columnar wires to the board at this point.  Later, after the whole cube is soldered up, you may need to adjust things to be level, and it may be that the best way to do that is to de-solder a corner columnar wire and re-solder it.  Doing that with all columnar wires attached to the bottom board (safely) is very, very difficult.  So leave them loose for now, but check at this step to make sure everything looks ok.

This is also a good point to try to adjust your four columnar solder points to avoid shear and torque of the cube.  Do so by finding some other squaring devices to keep the planes aligned to each other, de-solder each corner point from the board, and twist move the board to get the overall cube shape as you want it.

17.  Solder and test each plane in turn

Lower layer #2 down.  That means: release the clips that are holding layer #2 in place, let layer #2 slide down the four corner wires, and then re-clip to keep layers #3 through #6 up high.

Separate layers #1 and #2 using a spacer.  Just as you had used the spacers to keep layer 1 from touching the board, use the same spacers to keep layers #1 and #2 apart.  (Note: in an ideal world, I could use four or eight laser-cut "ladder" spacers, which would have grooves for holding each layer at a known height.  Re-using spacers as I'm saying here runs a slight risk of magnifying error in the spacer heights, making one end of the cube increasingly higher than the other.)

With layer #2 safely in place, solder all columnar wires to the layer loops.

Once all solder points are done, test the entire layer.

If you find a dead LED while testing, it probably means you sat on a loop-column joint too long, and burned the LED out (melted the wire out of its protective covering).  There aren't great options at this point.  If it's on the outside, you stand a chance of replacing and re-attaching an individual LED.  That is doable and takes some patience and dexterity.  If, on the other hand, the burnt LED is somewhere inside the cube, you may have to de-solder everything on that layer, and remove it and all layers above.  Then, you get in the game of re-threading each layer from above.  That, too, is a game of patience

In any case, you don't want to end up with all layers in place, and only then find out that there's a dead LED somewhere below.  It's much easier to fix it before layers higher up are soldered. So be diligent, and test every light for each layer as you build up the cube.

This is a picture of layers #1..#3 in place, with layers #4..#6 still waiting their turns.
(If anyone's wondering, yes, I got some LED strip lights and put them onto my solder filter fan so I could have better lighting while I was soldering more safely.  Nothing too fancy.  It's powered by the same power supply I use for testing my LED cube, so I have to be careful to wind down the voltage every time I'm done using it.)

This is the LED cube after all six layers have been added.  Remember when we measured the columnar wires and allowed for a few extra inches on each one?  While that might seem wasteful, the purpose was to be able to keep layer #6 raised up while layer #5 was being soldered, giving you room to work.  Now with everything attached, there are lots of wires sticking up pretty high above layer #6.

18.  Trim the top, level the board

This is kind of your last good chance to test all LEDs on all layers, so do that.

When you are satisfied that everything is working, you can trim the excess wire off the top of each columnar wire.

Now, you should have a relatively flat top ot the cube.  There will some variance here or there, but it should be pretty flat.

However, it may be that your overall cube is not level with respect to the board.

There are several things that could be happening.
Roll.  If you look at the cube from the side, and the overall layout of the lights looks cube-ish, but it's not level to the board, it's rolling or pitching one way or another.  You'll be able to fix that by inverting the cube, resting it gently on the layer #6 LEDs, and then you can adjust the solder points at the four columnar corners.  Be extremely careful here not to let the board slip upward, and get unhooked from the cube.

Shear.  If you look at your If you have a bit of a parallelogram shape going on, it's really hard to fix.  You have to avoid that at an earlier stage.

Torque.  If you look at the cube from above, and it seems to have a bit of a twist going on, you may be able to bend things gently back into shape, physically twisting the cube into position.  But generally speaking, you should have tried to avoid this at an earlier stage.

Here's my cube with the top trimmed.


19.  Solder to the board

You should now be able to invert the board, and solder all columnar wires to the board copper.  Use a dab of solder flux at each point to get a good connection between the copper plane and the wire.

Clean up any rosin flux at this point.

20.  Attach the grounding wires

There are six wires that you need to connect between the board and the grounding line of each layer.

Set the cube right side up.  It should still be elevated off of your work surface by the felt pads.

You'll do each grounding wire in turn, starting with the innermost board hole connecting to the lowest layer.  Move out one board hole and up one layer as you proceed with doing subsequent layers.

Straighten some wire and cut off chunks that will reach from below the board to the grounding wire.  There are different artistic ways of setting this up.  A simple approach is just to poke the wire through the board hole, having it touch the desk surface beneath.  Then bend it at the point where it meets the board, and lean it over so that it touches the appropriate ground wire.  Solder the wire to the layer's ground wire, and trim any excess.

Another approach is to make an ell shape in the wire.  This takes more careful measurement, but can yield a pleasant appearance.

When all six layers have had their ground wires set up, invert the cube, and solder the ground wires to the board, using rosin flux at each point.

Clean up any rosin flux.

21.  (Optional) Test using board connections


At this point, you should have a nearly functional cube.  You should be able to use normal power supply probes (with proper current limitation), touching ground to a grounding wire solder point on the board, and touching (current-limited) power to each hole where the headers will connect.  Each light should light up in turn.  It's helpful to place the cube (gently) on its side for doing this test, and it also helps to have a mirror so you can see the lights light up.

22.  Solder all headers

For each header row, get the appropriate header pin set, and push it through the proper set of holes.  For this step, I buy 40-row female 0.1"-pitch headers, and I use a saw to cut them to the sizes I need.
 
I also have designed my board so that all power pins are in the same row, but there are some gaps along the way -- places where there's a pin in the header, but no corresponding hole -- so I trim some pins before inserting the component into the holes.


I recommend using solder flux around all the pins before soldering.

Roughly solder one end of the header to the board.  Then, applying light pressure from above, melt that solder point, make sure the header is flush to the board, and then let the solder point solidify.  If you're satisfied with how it looks, solder the opposite end, check for flush, and then solder remaining points.

Similarly solder the grounding wires' header pins.

Clean up any rosin flux.

This is what it looks like with the power headers in place, the ground wires attached, but no ground headers attached yet.  (Steps 20..22 can vary in order.)


23.  Trim excess

You may have excess wire at various points here, particularly at the end of each kebab, and at all poitns below the board.  The ones below the board are safe to trim.  The ones at the end of each kebab may be trimmed, but carefully.  If you built each kebab with the topmost LED cathode pointing away from you, it will have a very weak connection to the next LED's leg.  So before you trim those, double-check that the solder is good, and if you do trim it, try orienting your wire cutters so that they cut "sideways", i.e., the cut goes across both legs at once.

This is the view beneath the board prior to flux cleaning.


24.  You're done!

At this point, you're done with construction.  You may opt to do one more round of testing to make sure all the headers are talking to the board properly.

From this point, it's all about the controlling hardware (e.g., Arduino) and software.