Since my last blog Christmas and New Year have been and gone. Wishing a happy and prosperous 2014 to everyone. I got lucky and my LEDs arrived a few days before the holidays started which allowed me to crack on with the building of the cube shown below.
Photo of LED cube with two sides of the mirrored glass casing in position
I first of all ensured that the LEDs were diffused enough for what I needed. If too much light was being emitted from the top of the LED then I was considering the route of sanding each of the LEDs. Thankfully the LEDs were actually very well diffused in the end so I used them as is. I ordered two sets of 600 LEDs from different suppliers on eBay thinking that if there was a hold up with one then I might get the other sooner. Anyway it turns out they both arrived on the same day at the same time and look to have come from the same source in China so you live and learn. I have a plan in mind already for the spare 680 or so LEDs I have left so watch this space for the next crazy project.
I played around with the legs on the LEDs to try and work out what sort of dimensions I could get away with on the cube and then based on these measurements I created a jig using my trusty 3D printer and the SketchUp software. The CAD files for the jig are included in the attachment at the end of the blog.
For anyone who wants to replicate the project but without access to a 3D printer they can use the build method documented here. I recommend you read through this anyway as it covers the build process better then I ever could.
The first step for assembly was to take all 512 LEDs and bend them correctly. To do this I drilled a 5mm hole in a piece of wood and checked that a LED fit snugly and flush to the wood but could also be removed easily. Once I had my hole correct I draw some guide lines to help with the bending. The lines I drew were one vertical running through the centre of the hole, one horizontal line running through the centre of the hole and one horizontal line running through the very edge of the hole. A metal ruler came in very handy during the bend stage. The pictures below show the jig to bend the LED as well as the steps to follow when bending the LED's legs.
LED Bending Jig
Insert the LED into the jig ensuring you have got the LED in the correct orientation. The pins should all be sat on the first horizontal line and the cathode pin should be the second pin from the left.
First Bend - Bend the cathode pin upwards and the anode pins downwards. Ensure they are fairly flat to the board and the bottom of the LED.
Second Bend - Using the metal ruler bend the cathode pin to the right.
I did this part of the build in stages alternating between bending legs and assembling panels to break up the monotony a bit. I found bending legs could be done while half watching TV and assembling panels was useful for getting me out of the way when the in laws came over for a visit. The LEDs were soldered together by inserting each LED one at a time into the jig before soldering the anodes together on the current column and the cathodes together on the current row as shown below. Take your time and ensure that every solder joint you make is nice and strong, spending a bit more time here will potentially save a huge amount of time later on when it comes to getting the thing up and running.
LED Assembly Jig
Complete Panel on jig
As each complete panel was finished I made sure to give it a full test while it was still in the jig to ensure that every LED lit correctly and that there were no breaks or shorts in the panel. To do this I connected long lengths of wire to my 5V power supply. At the end of one of the pieces of wire I soldered the larger of my two resistor values used on the driver board from Port 1 and this allowed me to drive all of the LEDs without any risk of damage. Using my trusty metal ruler pressed against the unconnected common leads shown above on the left I was able to temporarily short all the common pins together to ground meaning I only have to test each column pin once rather then having to test each and every LED individually. To get the panel of LEDs out of the jig I just gently pushed on the top of each top LED in turn and repeated until the entire panel popped loose.
After all the LED legs were bent and all the LEDs were assembled into panels it was time to start joining the panels together. I laid the first panel flat on a desk and soldered two lengths of straight wire to each the cathode wires one at either side of the panel to provide a good level of support and a bit of redundancy just in case one of the solder connections on one of the wires were to fail. To obtain the straight wire I used the technique of holding both ends with a pair of pliers and pulling hard. I had to experiment with a few different types of wire before I found one that would be happy with the current from 64 x 3 LEDs and would also straighten nicely without too much effort on my part. The wire I ended up using was enamelled so rather then sanding it off I simply put the pieces of wire into my wood burning stove for 10 mins while the enamel burned away. After each cathode wire were connected and checked for straightness I used a few small cigarette filter boxes to space the next panel away from the first. Taking my time to ensure everything was as lined up as possible I repeated this process until all of the panels were together and then gave the LEDs another full test to ensure I hadn't missed anything. 9V batteries are also meant to be good for using as spacers so long as you tape off the terminals so you can't blow any of the LEDs with the excess voltage.
The cube once fully assembled is fairly strong but all it would take would be a bit of weight applied in a wrong place and all that work would be ruined. I used the same piece of MDF board that I used to create my jigs and drilled 5mm holes into this at the correct pitch for the legs of the bottom row of LEDs to go through the MDF. To work out the pitch I took measurements from outer left LED to outer right LED on both sides of the cube and then averaged the spacing, then repeated for front to back. I then drilled a further 8 x 3mm holes along one edge for the cathode wires to come through to the cube. I also routed a 6mm groove for my glass cover to fit into and spray painted the wood as this would be near impossible after the LEDs are mounted. Finally I used some of the mirrored tint detailed later on to provide a mirrored effect to the top surface of the painted MDF and poked holes in where the holes had been drilled. I thought about routing a nice shape onto the edge of the base but by then it was getting dark outside and I was eager to move onto the next stage.
I had thought getting the legs of the LEDs through the holes in the base would be easy, I was wrong...
The only way I could do it was to use a small object like a TV remote control to wedge up one side of the cube leaving me free to tease the legs on the other side of the cube into the holes a panel at a time using my trusty tweasers. Once an entire panel was in I moved the remote a bit, applied a small amount of pressure to the top of the cube and then moved on to the next panel. After doubling back a few times I had most of the wires in the holes and after a bit more checking and teasing I managed to get the entire cube in and flush with the base board. Phew. This is very frustrating so I would advise getting into the right frame of mind before starting this part of the build and then to take your time as much as possible to avoid any unnecessary stress and damage to your solder joints. A joint failing near the center of the cube might mean you have to take it back off it's mounting base and unsolder some of the panels so anything you can do to avoid this is worth doing. Saying this I was not all that patient with mine and it happily took a fair deal of abuse with no real negative consequences. Thinking about it if you have access to a stepped drill bit or similar then it would be possible to cone the holes slightly and maybe make it easier to get the legs into place. Either way you'll get them in there eventually and can have yourself a well deserved rest.
The next job is to add the cathode wires. These are again straightened bits of wire that can cope ok with the current from an entire row of LEDs. Each piece of wire has a small 90 degree bend and is first pushed through the hole before soldering the bent end to the cathode for the row before cutting off the excess. Start at the bottom row and work your way up ensuring that enough of the wire goes through the hole to allow you to easily connect the other end once the cube is turned upside down.
Picture showing cathode wires viewed from the top of the cube.
With all of the LEDs mounted onto the base piece and the cathode wires in place I assembled the pieces of glass to protect the cube. The glass is also handy as it allows you to flip the whole thing upside down allowing you to work on the wiring underneath without putting any weight or stress onto the LEDs. The glass I used is off the shelf tempered 6mm glass shelves from the kitchens section of B&Q. I did think about using glass from photo frames as I would be cheap and possible to cut this to size easily but I also wanted it to be strong so the tempered glass seemed like the best option. The glass shelves I got were not perfectly square but you really can't tell from looking at the finished cube. On each sheet of glass I applied a mirrored car window film to the inside edge to provide the mirrored effect. The mirrored tint is a bit fiddly to work with and I strongly advise wearing gloves when dealing with the glass just so it doesn't end up covered in finger prints. The top of the glass was held together by adding a ring of electrical tape to the outside of the glass at the top and then adding some optional 3D printed clips just to ensure the tape stays in place. The top section of glass to complete the box requires more clips to hold it in place which means I need to buy another roll of car window tint so for now I have left it off.
Picture showing cube resting upside down on the glass box
With the cube carefully shifted upside down and rested on the glass (ask a friend for help just in case the glass is a bit loose) I started work on the wirings to connect my circuit boards from Part 1 to the LEDs. Each LED leg was bent at a 90 degree angle to secure the LED in place against the board. With each LED I bent one leg to the left, one upwards and the other to the right. I then sanity checked that all the LEDs were bent the same way so I could be sure of the colour assigned to each pin.
Picture showing most of the LED pins bent into place and at the back you can see the free ends of the cathode wires.
I then took the 8 x 24 way ribbon cables connected to the driver boards from Part 1 and carefully split the cables into sections of 3 before splitting up the ends into singular cables and stripping around 3mm of insulation from the ends. As long as you are consistent and wire RGB or BGR for every single cable then the wiring will work fine with the Flowcode component. If you mix and match the wiring then you will have problems. Remember that we used a slightly larger series resistor to drive the Red channel so this can be used as a guide to double check your wiring the right way. Once the anode wiring was done, the cathode wires were cut down to a reasonable length and bent out the way. I connected some lengths of fairly thick cable to each of the cathode wires and the covered the remaining bare wire with electrical tape.
Try and keep the ribbon cables between the drivers and the LEDs and between each driver board as short as possible without making them too short otherwise you will start having problems with the buffer drive chain where some values may get updated out of sequence on the chain due to cross talk. If you do start having these problems then try and separate the individual cables as much as possible using tie bands. If there are still problems then maybe look into applying some kind of grounded shielding to the cables using foil or metal mesh, if you do then this be careful to try and eliminate any potential for shorts so your power supply doesn't go up in smoke. My cube with neatened up wiring works well and only seems to have a cross talk related glitch about once every 100 refreshes or so which is fine for me. Before I started with the neatening and reducing of the ribbon cables I was experiencing monumental glitches on every single update.
Picture showing cables after a bit of shortening and tidying up using cable ties
In the BOM I have listed the common drivers as FETs however I didn't have any FETs to hand so I instead used TIP122 transistors. A FET would essentially allow the LEDs to run at a much higher efficiency because there is practically no voltage drop across the rails of the FET and so the voltage is nicely shared between the series resistor and the LED. A transistor on the other hand normally has around a 0.7V drop between the collector and emitter which means at high current you are wasting a lot of energy as heat. The TIP122 transistor I am using are pretty bad due to their high current nature having a voltage drop of around 1V. I thought I would try the transistor approach first just because I had them to hand and couldn't wait, the LEDs are plenty bright and the transistors barely get warm so it's not all doom and gloom. If I had planned for this I could have dropped my resistor values a bit to compensate for the voltage drop and maintain the 20mA current to the LEDs. Again you live and learn. I'll get some of the FETs ordered up as I would quite like to have higher brightness and obviously long term this is a more efficient solution. Also because I did the common driver as a separate piece of veroboard it is very easy for me to go in later and replace/upgrade any of the inner workings without having to disassemble everything. Checking each LED was still working ok using the test routine below I then covered the exposed pins of each LED with some electrical tape just to avoid any potential shorts if things start to move around inside the compartment. The schematics I used to connect everything up are attached in the document at the end of the blog.
I used some pieces of veroboard to allow me to connect an ECIO directly to my 5V power supply and to create the common drivers. A 5V power supply must be used to allow the large current to flow without generating any additional heat. A standard low dropout regulator would likely become far too hot to go near and would likely burn out depending on the input voltage and drive current. For the final version I intend to use something with a bit more beef so maybe an AVR, an ARM or a dsPIC from the new EP range. The Flowcode LED Cube component is flexible so will work with pretty much any microcontroller family apart from 8-bit PICs as these cannot have arrays greater then 256 bytes in size. I made sure that I socketed my microcontroller to allow me to switch devices easily without having to re-make another host board.
Picture of controller circuitry and common drivers
I used some chunky bits of wood with 45 degree cuts to create a frame that I screwed onto the underside of the LED base and then carefully placed the electronics into the frame and padding appropriately with some bubble wrap so things didn't rattle around. Using some thinner pieces of wood I created a bottom to keep the electronics in place when lifting the cube, this then got screwed in place. Remember to add a hole to allow your power supply to be connected. Some of the popular switch mode power supplies come in small metal cases so this could also be included inside the box to neaten things up a bit. You may also want to leave the USB cable connected to the ECIO to allow you to A) reprogram without having to re-open the casing and B) for communications via USB should you want to go down this route using the Flowcode USB components.
In the video below is a quick demonstration of my cube running a very simple test routine driven from an ECIO40P.
Picture showing some of the reflections generated from the mirrored glass tint
In Part 3 we will look into creating some animations to display on the cube using the Flowcode component and look into scripting techniques to allow us to control this via the Flowcode 6 simulation using USB communications or via a file located on an SD card.
All the up to date files for the project can be found in the attachment below.