Saturday 18 May 2013

6. Building and Testing the Matrix of LEDs

We are now about to start assembling the matrix of LEDs.  To do this we are going to:

  • Insert the LEDs into the wooden jig
  • Bend the cathodes (negative wires)
  • Solder them together
  • Bend the anodes
  • Solder them together
  • Test each assembled 'plane' of 64 LEDs
  • Insert each plane into the PCB and test it again

Before we start, it's very important to mention something about heat and LEDs...

SOLDERING LEDs - IMPORTANT!

LEDs don't like getting too hot - if they do they lose their intensity - so try to be very quick when doing your soldering.  Here is the plan I recommend:
  • Get your LED legs lined up as best you can.
  • Get into a comfortable position so that your hands will be resting on something as you do the soldering (hard for later bits of the cube)
  • Hold the solder wire about 2 inches from the end
  • Have the soldering iron set on about 320°C (this is only my best guess but it worked ok for us)
  • Get 'lined up and ready to go'
  • In one smooth and quick action, do the following:
    • clean the tip of the soldering iron on your damp sponge
    • put a tiny bit of solder on the tip to wet it
    • heat the join point with the side of the tip of the iron to heat the wires
    • apply the solder (it will run between the wires)
    • take the heat away as quickly as possible
    • blow on the joint to cool it.
The actual soldering of each joint must be done as quickly as possible.  If you have the heat on for more than about 3 seconds, pull away, let it all cool down and try again.  The solder has flux in it and if it all burns/boils off then the joint will oxidise and you'll have a problem.  Speed and precision are the key!!

Bending and Soldering the Cathodes
This is pretty easy.  Try to get the bend close the LED itself otherwise the wire may be touched by the anode wires (as you will see in the next step).  Solder them in lines of eight on the wooden jig, remembering to keep them from getting too hot.

Bending and Soldering the Anodes
The instructions say that you should use a 5mm thick ruler to use as a bending thickness guide.  However, a wide thing like a ruler stops you from forming a good bend so I would recommend a 5mm bar like the one we are using here (a bit of old brass hex rod I had in my metal store):


My 12-year old daughter soldered every one of the LEDs - over 1,000 connections!


Testing

It's a good idea to test the LEDs before installing them on the PCB.  If you don't know about LEDs read the 'Slightly Technical Bit' below.  If you're comfortable with electronics then it's enough to say that 5 mA is quite enough to test the LEDs so, assuming you have a 5 volt supply then you just need a 1000 ohm series resistor.

Slightly Technical Bit
LEDs are not like little light bulbs - you can't just put the leads across the terminals of a battery to test them.  If you do that you'll destroy them because LEDs have an extremely low resistance and simply connecting them to a battery will allow too much current to flow causing their internals to be destroyed.  You must have a 'series resistor' to limit the current.  (There are no series resistors on the PCB because the ICs that drive the LEDs are special current-limiting gadgets that don't need external resistors).
 
The set-up you will need will look something like this:

Just replace the 9 volt battery shown above with your 5 volt power supply and use a 1000 ohm resistor.  (Because volts/current = resistance then you can work out that if you have 5 volts and a current of 5mA (my guess as a good value to use) then you can see we get 1000 ohms as the value of the resistor.)  The precise value of the resistor is not critical but since I don't know the maximum current allowed by the supplied LEDs I'd advise caution and use 1000 ohms or higher.

Installing the LED Planes on the PCB and Testing
Undoubtedly a very exciting bit of the whole construction process is the part where you insert your tested LED 'planes' into the PCB and see what happens.  Getting each plane into the PCB is a bit of a fiddle but it will go in in the end.  Make sure you insert the planes as shown below with the anode sticky-out-bit above the row of anode connectors on the PCB.

You'll need some sort of test lead to hook up the anode wire on the plane to the anode on the PCB.  If you have several you can do what we did and test lots of them in one go.

Make sure nothing is touching anything it shouldn't, plug in your 5 volt supply and see what happens!


If you see lots of pretty patterns you know you're heading in the right direction.

Make sure that all the LEDs are (at some point) lighting up with the pre-programmed sequence.

At this point my daughter and I looked at each other and said "Only seven more planes to go!"...

Spacing Jig
We made the second plane and fitted it to the PCB so that we could test it and solder its rearward pointing LED legs to the first.  However, we realised that it was going to be quite difficult to make sure all the planes were the correct distance apart.  We therefore made a jig using a piece of 1/2" square balsa, cut at the same intervals as the matrix.  We used a junior hacksaw to make the cuts, to the same depth as the junior hacksaw blade (an easy way to get them all the same).


The photo above shows the jig being slotted downwards onto the wires but we found it was actually easier to bring it up from under the wires because then you could see the wire and guide them into the slots when necessary.

It occurred to us that the left-hand side of the cube (i.e. the one with the joined common anodes) would probably be relatively strong but there would be nothing to secure the rest of the cube.  We therefore decided to add a piece of 24 SWG tinned copper wire along the top right edge, using our spacing jig to get the distances right, to make the other side stronger.  This technique will not guarantee that every LED is exactly in the right place but the distances should average out so it will be about right with no nasty cumulative errors.

Once all the planes were installed and the common anode LED legs were wired together we tested them to make sure they were working by powering the board with 5 volts, clipping one end of a test lead to one of the anode connectors on the PCB and connecting the other end of the test lead each horizontal anode.

Anode Wires
Having installed all the planes and soldered all 8 of them into the cube shape we then created the 8 leads that connect the anode connectors on the board to successive layers on the cube.

To do this, we got some fine, 10/0.1 (10 strands of 0.1mm wire) with black insulation (to make it as unobtrusive as possible), cut them into suitable lengths and soldered a short piece (14mm) of 24 SWG tinned copper wire to one end.  We then inserted this bit of tinned copper wire into the gold connector, measured the length up to the appropriate level on the cube, cut it to length, stripped the end and soldered it to the common anode as shown below.



By powering up the cube with 'Module B' (the one without a jumper on the two header pins) we were able to test all the LEDs at once.  In fact we found one on our cube that wasn't working.  Luckily this was next to where we had soldered one of the vertical anode wires and it was easy to reach.  I imagine we must have overheated it although we took great care not to do this.  Anyway, that was the only LED that didn't work out of all 512 of them.

<UPDATE:  Another one of the LEDs has started to play up.  I'm not sure why.  Sometimes it works fine, sometimes it doesn't work at all.  Luckily it's (again) one of the ones on the outside so it will be easy to replace.>

So, we now have a cube that works - now to have fun with it!

Friday 17 May 2013

5. Planning the Build of the LED Matrix

Having gone through the translated instructions I drew up the following plan of action (pictures taken from the instructions):

1.  Bend over the LEDs' cathodes (the short legs) and solder them in rows on the wooden jig leaving the last leg in each row sticking out (these are the legs which will go into the PCB).


2.  Insert a 5mm thick ruler (or other similar object) and bend the anodes over (so that they aren't touching any cathode wires) and solder them together to form a plane of 64 LEDs.  Leave the last one in each row standing vertical (these will actually be horizontal in the cube).

 
3.  Repeat so that you have all 8 planes.

4.  Test each plane.  The instructions suggest you do this by powering up the PCB.

5.  Insert each plane into the PCB.


6.  Solder together the legs which you left standing vertical in Step 2.

7.  Using insulated wire, make a connection between the common anode for each horizontal plane and the appropriate anode on the PCB.


8.  Add some further supporting common anode wires to make the cube structure more rigid.  Without these, the vertical plans would only be held apart on one side.

So, that was the plan...see our next instalment to see how we got on...

4. First Power-Up of the PCB

I could find no instructions about testing, etc. so I continued with my guesswork...

There are a series of connectors on the board and as I find out how they work I'll update the following list:
  • USB1 - This is of course a USB interface for a PC.  Before plugging into your PC, install the drivers that come with the rest of the documentation.  On my set the application was called CH341SER.EXE.
  • P1 and P10 - Connectors to allow you to daisy-chain several PCBs together.  Sounds like fun...we should have a convention where everyone gets together with their cubes and tries it out!
  • P2 - This is a TTL level UART serial interface
  • P3 - (Looks like an I2C serial interface)
  • P5 - 5 volt power, centre positive
  • P6 and P7 - These are the two rows of connectors into which the pre-assembled module is inserted
  • P8 - (This says it is connected to an ADC (analogue to digital converter) to it might be a way to connect music to the system - just a guess)
  • P9 - (No idea)
  • ISPI - (I guess this is an SPI serial interface)
WARNING!
Before connecting your board to power I advise you to check the board carefully to make sure there are no mistakes and ALSO make sure that there are no loose pieces of wire lying around that could short the board out.

Test 1
I decided to power up the board and see what happens when you don't have the LED cube attached (because we haven't built it yet).

Two modules come with the kit - one with a jumper on the two-pin header (I will call this Module A or 'Automatic' module) and one without a jumper (Module B or Serial Module).  I inserted Module A for this test.  I connected the power connector to a 5-volt power supply.  On my power supply I can specify the maximum current which I set at 200mA.

On power-up it the LEDs on the PCB are illuminated and the board consumes between 130/140 mA.  After a few seconds this rises to 170/180 mA.

I am fortunate enough to have an oscilloscope so I then looked at the signals I was getting on the 8 x 8 array of connectors which the cube will plug into.  Looking at the effects I was seeing on the screen of the oscilloscope it was obvious that I was seeing a waveform that represented the various patterns that one would expect to see if the cube was running.  I therefore assumed (correctly as it turned out) that 'Module A' is pre-programmed with a sequence of effects.

The fact that the cube electronics were running gave me the opportunity to go round and test all 64 of the pins in the 8 x 8 matrix to check that they well all working.  The waveform I was seeing on each pin continually varied depending on the pattern the microcontroller was trying to display but a typical display looked like this:


I went around and tested them all and - shock! - one of them wasn't working :-(  Pin 11 on U2 wasn't giving me any signal!  So I used my multimeter to check the continuity between the gold connector and the pin of the chip.  Sure enough, there was no connection.  Closer inspection showed I had a dry joint on the chips - oh well, not bad to have just one - so I got the soldering out again, turned the temperature back down to 310 degrees, applied some flux and re-soldered it.  A quick check afterwards showed it was now working okay! :-)

I appreciate that if you don't have an oscilloscope that this test is not going to be possible but it takes such a short time that if there's any way you can ask a techie friend to help you test the board I'd encourage you to do so - you don't want to assemble the whole cube and then find out there's a problem!

Test 2

The next test I did was to connect the board to my PC via the USB connector.  I first installed the drivers (as mentioned above) and the connected it up.  The USB connector supplies power to the board so you don't need to plug power in as well.

Plugging it in, the LEDs flash on briefly, then go off for a few seconds, and then come on.  That was it.  Not very exciting.

I then tried running the program called 3D8S_alpha.exe program.  The display looked like this...


 ...and you should be able to see that in the 'Communication' section the application appears to be set up to communicate via COM17.  I checked in the PC's 'Device Manager' and it said that this was called 'USB-SERIAL CH340'.  So it seems that the device driver I installed is working.  I then pressed 'Connect' and the LEDs went off for a couple of seconds and then on again so I assume something is working!  We just need to build the LED cube now and start to play with it.

(By the way, if you press 'Play' the display shows an animation of what each plane of the LED cube will be doing when it is running through a sequence - fascinating to watch!)

My conclusions were that Module A is for an 'Automated' pre-programmed display and Module B is for use with external control devices like a PC.

Let's now see how we get on with the construction of the cube...

Thursday 16 May 2013

3. Assembling the Printed Circuit Board

On first inspection there appear to be two minor problems with the assembly of the PCB:

1.  The first is the size of the components which, as I have already mentioned, are 'Surface Mount Devices' (SMDs).  I have a little experience with these so I wasn't too worried about ordering the kit BUT beginners beware!  They are a) very small (e.g. one of the resistors is just 2mm long) and b) unlike through-the-hole components SMDs are soldered directly to the board.

That's a millimetre scale!


Anyway, with a little care these are usually easy enough to solder and test so long as you have the right tools.  In my case this means:
  • Fine solder wire
  • Flux dispensing pen (we used the 'No Clean Flux Dispensing Pen' available from Maplin Electronics).
  • 1mm de-soldering wire/solder wick
  • Fine tipped, long tweezers
  • Magnifying lamp (ours has a little area on the lens which is extra-powerful - very useful!)
  • Jewellers eye glass
  • Maplin ZD-916 soldering station (with iron set to between 300-320 degrees C)
  • Damp sponge (or similar) for cleaning the tip of the soldering iron
Incidentally, I found that for building and testing the kit it was also useful to have:
  • A 5-volt power supply of some description fitted with a connector capable of plugging into the power socket on the PCB (mine has a diameter of 3.45mm), centre positive.
  • A multimeter or other means of measuring voltage, resistance and capacitance
  • 1000 ohm resistor
  • Oscilloscope - this is not essential but it is useful for testing
  • Test leads (Maplin code FE23A are just about ideal)
  • 24 SWG tinned copper wire
  • Some dichloromethane solvent (we used 'EMA Plastic Weld') to assemble the plastic box
  • Small (No. 2) paint brush to apply the solvent
2.  The second problem is that the components are so small that several of them don't have any markings on at all, or the markings that are there aren't immediately identifiable.  With the documentation there are two images which give you some clues.  This is a layout picture...

Here is a picture of the schematic for the board...



..and here is the schematic for the connectors which is very helpful:


So I decided to do a little detective work and use a process of elimination.  Here is my list of components and their associated markings (in the order that I soldered them onto the board):
  • 10K (3 x chips each containing four 10k ohm resistors) -> 103
  • APM4953 HT1238M -> 4953
  • 470 ohm resistors -> 471
  • C1 (shown as 106) -> Unmarked single capacitor measured as 8uF
  • C2,3,4 (shown as 104) -> Unmarked tape of 3 capacitors measured as 93nF
  • R1,5 (shown as 1k ohm) -> 102
  • R2 (330 ohms) -> 33 on the schematic
  • R6 (100 ohms) -> 10 on the schematic
  • Q1,2,3 (transistors) -> unmarked 3-pin devices
  • U5 (74HC138D) -> 74HC138
  • U1,2,3,4 (TM1818) -> TM1818
Now turn up the heat on the iron by about 20 degrees
  • D1,2 (SS14) -> IN5819
  • USB Connector
  • Power connector
  • 0.1" and 2mm connectors - all fairly straightforward
  • Large and small LEDs (the long positive leads go through the SQUARE hole)  The large LEDs are actually sort of illuminated legs that the PCB will stand on when it's sitting the right way up on a flat surface.  I guess that the small LEDs are simply decorative - we will find out!
The reason the multimeter is handy is because if you're not sure of the identity of a passive component it is reasonably safe to measure the resistance/capacitance of the device as a check.

The soldering looks worse because of the flux residue - honest!

So, anyway we soldered this lot up (as per the picture above) and then installed all the little stand-offs (there were two left over in the pack).

TIPS
Here are some tips from my experience with the assembly:
  1. Be EXTREMELY careful to get the ICs round the right way.  Removing them and turning them around would be very difficult without the right equipment - and even then it's not easy!
  2. The legs of the ICs are very close together and there's a good chance you might accidentally solder two together.  DON'T PANIC.  It's very easy to fix this.  Get some 1mm 'Desoldering Wire' - basically a wick made of copper designed to 'suck up' molten solder.  Put some flux on the braid, remove any excess solder from to soldering iron, place the braid against the legs which have been joined by solder and heat for 2 or 3 seconds with the iron.  The excess solder will melt and get absorbed by the copper.  Magic!
  3. Be careful about the order in which you solder components to the board.  Generally you should start with the smaller ones and work your way up but there may be exceptions.  For example, the connector USB1 has some hard-to-get-at legs to the rear so you might want to solder diode D1 afterwards.

Having completed the assembly the only remaining problem is the amount of sticky flux left on the board.  I tried to clean this off with Maplin Flux-cleaning Spray but all it seemed to do was spread it around.  Really, I think it need to be placed in a bath of solvent and given a good go over with a toothbrush.

Okay, the board is now assembled - it's now time to plug it in and see if the whole thing goes up in a plume of smoke...

Tuesday 14 May 2013

2. Arrival of Kit

Well, the kit arrived and consists of the following components:
 
About a million LEDs (well, okay 512*)

Two pre-assembled modules and a bag of components

A USB to Mini-USB Cable

The Printed Circuit Board

A Jig for Assembling the LED Panels

A Pre-Cut Transparent Case Kit
 
 
What was immediately obvious was that there were no instructions and no software.  However, the helpful eBay seller was very responsive and after a certain amount of messing around with websites and file formats I was able to download a ZIP file containing:
  • 'Instructions' both in PDF and HTML format
  • Software
  • Demo files
  • A USB Driver
  • Other stuff I haven't had a chance to look at yet
 
Unfortunately the 'instructions' provided are an automated translation from a Chinese web page and contain very little information.  I know I'm going to have to make quite a few educated guesses about how this gadget works!
 
<UPDATE:  I have just found this article about how the cube works on the Internet - it's in Chinese but may be of some use>
 
So, I think the first job will be to look at the PCB and assemble that.  As previously mentioned it will require some surface mount soldering.  If you don't know what that's like then take a look at this excellent video by CuriousInventor.com:
 
 
More to come later...
 
 
*Actually, having made the kit we now know that they gave us around 20 extra LEDs just in case we damaged any - and in fact we did break one and bend two the wrong way so the extras were appreciated.


1. Getting Started - Ordering the Kit

My daughter and I wanted to have a go at building an LED light cube.  Never seen one?  Well take a look at this video to see the sort of thing I'm talking about:


I've had a little experience with electronics and so I wasn't worried about building one so we looked on eBay and I found this kit for sale:




This is a kit made by a company called Shengyuan Electronics and which is described on the http://www.syyyd.com forum website.  If like me you can't read Chinese then just search for it on Google and click 'Translate this Page' to see an automated English translation.  Better still, if you have Google Chrome it can be made to translate the pages automatically.

Note!  Before you rush off and buy this, please be aware that this kit involves soldering surface mount devices - if you are inexperienced with this sort of thing I would think twice about buying this particular kit.

There are several kits available, so why an 8x8x8 and not a 4x4x4 or a 16x16x16?  My reason was simply that cubes of 8 are easier to explain in terms of individual bytes.  Each column of 8 LEDs represents one byte of data, i.e. 8 bits, so I figured that it will be much easier for my children (and me!) to understand.  My intention was to run the cube from a PICAXE microcontroller programmed in BASIC.  The blurb for this particular kit said that you could either run it from its own controller or from your PC via supplied software.  A glance at the screenshot told me that it would work with a standard serial port so I felt that we should be able to have some fun with it - both building it and learning how to program our own microcontroller with our own patterns.

So, we placed the order and waited for the kit to arrive...