Showing posts with label word clock. Show all posts
Showing posts with label word clock. Show all posts

Thursday, December 1, 2011

Testing multi-plexed LEDs for word clock

Having ditched the impossible-to-debug charlie-plexing idea, we've made up a board which simply places LEDs in columns and rows.

We're going to drive the "rows" through a shift-register (to allow more than 20mA current to be sourced) and sink them through a number of ULN2803A darlington arrays (since sinking directly to the microcontroller pin would only allow up to 20mA per row which could make a full row of lit-up LEDs appear quite dim).

Before we get clever with the sinking and sourcing, we needed to make sure that our array of LEDs worked - and to test it we simply connected the +ve and -ve terminals of a 3V coin-cell battery to the different lines on the PCB.


By touching the exposed wire ends to the positive and negative terminals of a 3V battery, we were able to confirm that every LED in the array worked individually of the others.

Tuesday, November 29, 2011

Multi-plexing LEDs for word clock

Having failed miserably at debugging our charlie-plexed LED array we've decided to stick to the simpler approach of using multi-plexing.

There's a subtle difference, but since we're already getting down and dirty with multi-plexing for inputs on a board game it made sense to use this same approach for outputs/LEDs. The main difference is that we'll be using a pin for each row and a pin for each column (10 rows x 9 columns = 10+9 = 19 pins).
If we move away from the 16F628A (with 18 pins) and go far a larger chip, with more i/o pins, then multi-plexing gives us a simpler, easier-to-debug solution.

With this in mind, we set about creating a new PCB to use multi-plexing.
So far we've just put a load of LEDs into a grid formation - the actual controller board will be a separate PCB mounted onto the back:

Uln2803a Driven LED array

Here's a photo of the completed board, populated with LEDs, ready for testing.



Unlike last time, testing LEDs is quite straight-forward; and already we've found some potential problems; a lot of the LEDs are re-used from the old board and by connecting a 3v coin-cell battery straight across the anode and cathode of each LED, we've found about half-a-dozen that refuse to light up.

Whether these were damaged during removal, or never actually worked on the original board, we'll never know. But at least we've an explanation as to why the charlie-plexed board didn't work. Sort of.

Anyway, we're going to pop out those duds and test each individual LED on this board before even considering wiring it up to the rest of the project!

Sunday, November 20, 2011

Debugging charlie-plexed LED array

All of the online tutorials that mention charlie-plexing and LED array over using shift registers list pros and cons. The pro is always few components, simpler layout etc. and the cons always include "difficult to debug".

They're not wrong!
Since getting our 90-LED charlie-plexed array soldered up nearly a week ago, there's still little improvement on getting it to work properly! We did track down a few broken traces (the black toner in the printer was a bit faint in places so a few traces over-etched and had breaks in them). But even after fixing those, and spending hours and hours with the continuity tester/multimeter, there are still six different scenarios that cause the matrix to fail.

Although we feel we're close to solving it (having identified which pins cause it to fail) the last bit - understanding our findings - is still as elusive as ever! Here's the array working as it should:

The sheet in the background is a drawing of our findings - the six scenarios that cause the matrix to fail and the LED pattern created, instead of a single LED lighting up


Every now and again, however, we get something like this result

 The LED we expected to be lit up is in the centre of the "cross" shape - and remains stubbornly unlit

Even more peculiarly, we did some measuring with the voltmeter. When an LED is lit properly (from a 5v source running through 200 ohms) the voltage across the cathode and anode pins is around 2.9V. The voltage across all the other LEDs in the same row/columns is about 0.6V which is the typical voltage drop across a diode, but not enough to cause it to light up.


When we measured the voltage across the pins of an LED that wouldn't light up (the one we expected to light up but is in the middle of the cross - and remains unlit) we got almost a full 5v across the two pins. All the other LEDs that were faintly lit measured about 2.8-2.9V. So in this case, with the dim LED in the centre of the cross, we're measuring 5V across the pins, but it does not light up.


Here's a diagram of the pins combinations which don't work, and the LED "patterns" that are lit up.
If anyone can spot a pattern or - better still - come up with an explanation, please leave a comment below (and anyone else in future having similar problems might have some idea where to begin debugging!)



Tuesday, November 15, 2011

Testing our 90-led charlie-plexed LED array

There's something not quite right with our LED array.
In the main, it works fine. By simply applying 5V across different terminals we can see individual LEDs light up. Here's an example of lighting a single LED by applying 5v across two of the 10 available terminals:

(yes, that is Jason's traffic light LED project - I just nicked the 9v battery and 5v regulated output for the sake of testing this new board!)

But every now and again - and it is just every now and again, not very often - we get a peculiar result. Instead of single, bright, LED lighting up, an entire row (and sometimes part of the column) lights up too. We're putting this down to either a dodgy LED somewhere, or an LED being soldered in the wrong way around.


At the minute there's no real pattern to which combination of terminals gives the bad response.
There's one way to get to the bottom of this - to build an LED tester:
The idea is to create something that we can control which pin takes 5v and which takes ground, and record the result in a truth table (similar to the table created at design stage). Hopefully by cross-referencing these results to our schematic, we should be able to identify which LED(s) are common to all the problem terminals.

Monday, November 14, 2011

Charlie-plexing 90 LED array for word clock

Despite somehow printing the PCB for our word clock project at about 90% (so the 0.1" pitch connector won't fit properly!) we decided that we'd put too much work into the first version just to scrap it - drilling over 200 holes by hand was over an hour's work on it's own!. We do now have a "proper" sized board, but we figured that we could use this messed up one as a proof-of-concept prototype.

So we got 100 white 3mm LEDs off eBay and set to work.


We started out with the top row of 10 LEDs - soldering the legs but NOT cutting them to length. Then after the second row of ten LEDs had been soldered in, we could bend the legs on the top row across to solder to the LEDs on the second row. This is how we're making our connections between each horizontal "row" on the PCB.


Care should be taken to make sure that all "ground" legs (i.e. the shorter, cathode leg) are clipped short enough so that the legs being bent DON'T make contact with them (effectively shorting one or more LEDs to ground).

Here's the top side of the board after the first two rows of LEDs were installed


After installing a couple of rows of LEDs, getting the snips in between all the flying legs was a bit of a problem, so we cut the cathodes of all the LEDs to length before putting them onto the board.


This made installing the LEDs much easier - less than 30 minutes later and we had a fully populated board:


The reverse side showing how the LED legs were bent in different directions, to create connections across the horizontal rails on the PCB



(note the connector is still in place but the final job will be to remove this and solder the ends of the wires from a 10-way multi-core cable straight onto the board)

The final LED matrix with current limiting resistors in place on each "column" of the matrix.



Now we're ready to hook it up to a microcontroller and start flashing those lights! Sadly, it's a little late to be starting such a thing now, so it'll have to wait until the morning......

Thursday, November 10, 2011

Word clock

Carrying on our Word Clock project, we managed to get a PCB made for it tonight.
The final PCB was drawn out in our old favourite ExpressPCB (because the free version of DipTrace has a limit on the number of pins you can use in one circuit). It took a while getting used to the rather basic interface again, but it didn't take long before it all came flooding back!

Here's the PCB design we came up with.
Charlie Plex 90 Pcb - Black



It's not really 100% complete, because we've only really run the traces in the horizontal direction. When the LEDs are in place on the board, we'll have to bend some legs over and solder an LED leg to another LED leg -  because otherwise we'd either end up with a really complex PCB layout or crossed traces somewhere:


note that the horizontal LEDs are connected where necessary (e.g. D51-D55, to D45-D50 are all connected) but the vertical LEDs (D5, D15, D25, D35 etc) need to be connected using the component legs

To connect the LED legs in the vertical directions, we'll just solder the legs together, similar to the way shown in this diagram -


Anyway, here's the board after etching and cleaning - getting ready to drill the LED holes.


Almost an hour later, after drilling over 200 holes with a hand drill, it started to look like an array of components might actually live on this board:


With the board drilled (and while we waited for the 150 LEDs we'd ordered off eBay to arrive) we lined up the plastic inserts, that we cut last week, against our PCB. Each LED should sit snugly into each "cell" in the insert -


Bugger. We're out by quite a bit. Having measured the spacing for 3mm LEDs and set the spacing in the insert grid to 8mm (that's 3mm for the LED plus 2.5mm top and bottom for the PCB traces) we're still not sure how we got this one so far out.
But the PCB is made and etched (we've another one in the making too) so it makes sense to redesign and cut the grid to better suit the PCB, rather than the other way around. Maybe it's time to fire up the laser cutter again......


Thursday, November 3, 2011

Word clock

As part of the HackLlan show-and-tell session, we're hoping to get a number of projects finally finished (or at least in a presentable form) and so we're furiously cutting and making, every time the laser cutter gets pulled out of the HackCupboard.

Here's the internal guts for a word clock.


Here it is assembled (missing the top and right-edge struts)


The idea is to place this structure over an array of LEDs (90 in total) which are charlie-plexed by a single PIC 18F2455 microcontroller.
Using the formula pins required = n(n-1) we can work out that we're going to need 10 pins to drive an array of 90 LEDs (10 * (10-1) = 10*9 = 90). It may be possible to drive this array from a cheaper, lower-spec PIC, such as the 16F628A and our chosen chip is probably a bit of over-kill for what we need, but it'll be nice to have extra i/o pins if needed, for extra functionality in future.

Here's how we're driving 90 LEDs:



And the truth-table (which pins to activate) to turn on each individual LED



How does a matrix of 90 LEDs become a clock then?
By simply placing our cell-structure over the leds (so we don't get any light-leakage) and fitting an etched piece of glass/perspex like this over the top:


Light up the LEDs depending on the time - so for half past four, we'd light up LEDs numbered 1,2,3,4,5,6,7,33,34,35,36,64,65,66,67. We'll put a watch crystal inside to keep accurate time, then just convert the current hours and minutes into a selection of LEDs to light up - and use the charlie-plexing routines to make the appropriate lights come on at the correct times. Easy huh?