Login Join Maker Pro

# Transistor Mosfet pairs to drive LED cube layers

#### KrisBlueNZ

##### Sadly passed away in 2015
Nov 28, 2011
8,393
Speed testing - the code that I have executes in 1,360uS, I can definitely cut some out of this (currently colours held in 16 bit but the chip only requires 12 bits per colour for example) but will have to add some more code to deal with the three colours separately. Also some code to change layer's but this will be small compared with the 60 leds x 3 colours x 12 bits for the main updates to the chips.
So.... the fact that exists is that current code is 1, 360us per update

1 update of a layer = 1,360uS, need 8 updates for the whole cube. Therefore the whole cube is turned on in total time of 8 x 1360uS = 10,880uS.

10,880us = 10.9mS = 0.00109S

10,880 us = 10.9 ms = 0.0109 seconds (not 0.00109 seconds)

BTW the letter that indicates seconds is always a lower case 's'. A capital S indicates Siemens, the unit of conductivity.

If working frame rate is 100hz = 0.01S then the 0.00109S should be very adequate... Is my logic correct
It would be if you had calculated the update time (in seconds) correctly. As it is, it looks like you are using up all your CPU power, plus a little bit, in the update ISR.

You can reduce your multiplex rate to 80 Hz (12.5 ms) and get another 1.6 ms of execution time (in which to perform your calculations for the new colour values). At 80 Hz your ISR would be using 10.9 ms of every 12.5 ms, leaving 12.8% of your CPU power available for all other tasks.

One other point that I did want to check on the ICs. I had thought that I should keep the highs to each of the inputs at the same voltage. For example (for inputs 1 and 2) if I would have a high of +3.3V on input 1 and if I then needed a high on input 2 then I should also use+ 3.3V. Now, the way that this is set up then I will have a 5V high on pin 2 and then a high of 3.3V on pin 1. Reading through the datasheets (which don't mention anything other than a range of Vs )and your comments this seems to be ok and will work. Just curious that's all.?? (i.e if the high's are at different voltages then the logic will still work)

Yes, that's fine.

why take away the input decouple caps?

Because they'll slow down changes on the inputs. That's the purpose of decoupling capacitors (capacitors connected between a supply rail and the common rail (aka 0V)). They keep the voltage difference between the rail and 0V steady. That's great if you have a supply rail that you want to stay at a constant stable voltage, but it's not appropriate for signals which need to be able to change quickly.

Bye the way - the suggestion with the voltmeter measuring the average current. That is an excellent trick - does it really work?. My volt meter, while digital and quite accurate (and very budget basement!!) seems to take a little while to update to changes in voltage/resistance, I think this would hamper any average testing like suggested.

It works fine, as long as the frequency of the signal being measured is a lot faster than the voltage averaging circuitry inside the multimeter. A frequency of 100 Hz, or faster, will be smoothed out by the multimeter, which will indicate the average voltage.

Last edited:

#### rjamjb

Jan 19, 2013
50
Update and a couple of questions

Well, I've been away from this thread for a while but have been busy in the meantime. I've included a couple of pictures to show progress to date.

I've managed to work my way through 512 leds and soldered each of the 3 cathode's and 1 anode on each - very long approach - you can see the current cube in the attached picture.

I've managed to put the switch circuit together, also pic attached. I'm using the circuit in post number 54 but with two of the 4467 chips to create 8 layer switches and have dropped the input coupling caps.

The picture of the switch circuit may make you laugh as the soldering is not pretty at all (those mosfets sure are tiny). However I am confident that all the connections are made and have tested it successfully with my chipkit (i.e that the correct high/low combination input gives rise to a correct high/low output) - I should have done this after the cube itself as all those solders has made me a bit of a whizz in that respect.

Oh - after testing the layers I had 3 LEDs fail - all for the blue colour - not sure whether this was my soldering or just the LEDs - anyway to replace an LED on a layer sure is a pain. 3 out of 512 is not that bad however I guess.

Lastly there are two pictures of the TLC chips - one is my test circuit and the second is a starting point for the the main circuit with the tLC chips- given the mess of wires on the switch circuit I need to sit down and think hard about the way I put the final TLC circuit together to avoid a spaghetti nightmare.

Oh - and I've managed to cut some time out of my interrupt loop in my programming- specifically the reset on the chip program flowchart (which is on the TLC website) requires a refresh at 4096 update cyclest, which is the maximum the chips can deal with - I don't need that many for my cube layer update and so realized I can reset the update cycle earlier than 4096 cycles. This works and I'll check what the time for a layer update is with my scope in due course.

Finally I checked some refresh rates with an 8-1 duty cycle that the cube layers will operate at. Visually for me 50 hz had some visible trembling. 100hz looked rock solid as did 80hz as recommended on a previous post. I'll be asking a couple of people to see what the minimum refresh rates are to provide PoV that would be acceptable for all.

Questions.

At the moment there are no capacitors on the switch circuit (TC4467s plus p mosfets) - on the datasheet for this chip there are no examples suggesting any capacitor across the chip (5V to grnd) and I haven't got one at the moment - should I have one or will the circuit be ok by itself (If it is recommended to have one then what value to use).??

Jan 19, 2013
50
Files

#### Attachments

• Test circuit.jpg
150.6 KB · Views: 241
• TLc circuit 1.jpg
145.4 KB · Views: 246
• A layer.jpg
147.9 KB · Views: 219

Jan 19, 2013
50
files

#### Attachments

• DSC_0226.jpg
150.5 KB · Views: 208
• TLc circuit 1.jpg
145.4 KB · Views: 176

Jan 19, 2013
50
Files

#### Attachments

• Switch bottom.jpg
134.2 KB · Views: 185
• Switch 1top jpeg.jpg
155.1 KB · Views: 195

#### rjamjb

Jan 19, 2013
50
Finally - the cube as a whole and the 'gubbins box' that it will rest on.

#### Attachments

• DSC_0224.jpg
150.9 KB · Views: 208
• DSC_0235.jpg
144.5 KB · Views: 178

#### rjamjb

Jan 19, 2013
50
Oh - the reason that the mosfets are at a slight angle on the circuit is that by angling them that way I could put the contacts on three separate copper contacts and not need to cut anything - a bit jaunty I think !!!

#### KrisBlueNZ

##### Sadly passed away in 2015
Nov 28, 2011
8,393
Re the LEDs failing, it was probably static damage. Blue and white LEDs are sensitive to static electricity and can be easily damaged. You should use anti-static handling procedures (wrist strap) with them.

Re decoupling capacitors on the TC4467, see section 4.1 of the data sheet.

It's looking pretty good - apart from the MOSFETs as you mentioned! You should have used IC sockets though. All of those ICs are static-sensitive and could be easily damaged during soldering. It's best to install them at the very end of assembly.

Nice work! I'm looking forward to seeing a video

#### rjamjb

Jan 19, 2013
50
Thanks

Thanks for the pointer on the caps - I'd seen two caps used (for the TC4467) on one of their timing circuits but got the impression they were their for that particular timing circuit. From the reference you point out, this is clearly recommended. Will see what I've got or order some.

Interesting point on the static - most of my work has been on a wooden floor but I've recently de-camped my work to a carpeted room - I'd thought that this may make for a higher risk of static. Given I'm going to move to the main circuit with all those chips I think I'll take your advice and get some IC sockets to place first and then work with some grounding straps when I move to mount the ICs at the end of the process.

Any good sites for IC sockets you know about (the TLC chips are 2 x 14)?.

I know that I have a couple of questions on the main circuit - (primarily surrounding what power rating my resistors should have). Anyway my first objective will be to draw a full schematic of that circuit before I construct, just to see how it might all fit together - I'm sure I'll have another question or two at that point also.

Thanks for your encouragement.

Kind regards

Russell

#### KrisBlueNZ

##### Sadly passed away in 2015
Nov 28, 2011
8,393
You should be able to get IC sockets from Digikey, otherwise Mouser, or maybe at your local electronic components shop.

You can have static problems with any kind of floor (except a wet concrete floor, probably...) so it's always a good idea to wear a wrist strap and keep your circuit earthed when working with static-sensitive components.

#### rjamjb

Jan 19, 2013
50
Final LED Driver Circuit

Well I drafted the circuit for the TLC5940 chips to see how the drivers may fit together practically.

I'm showing the actual layout of the chips in three banks of four - one for each colour. Each bank therefore gives 16x4 = 64 constant current sink outputs to be connected to each of the 64 cube columns.

Based on this I think that I'll put the three banks on three separate solder boards which will make the whole process a bit less tangled.

A couple of points I've labelled if you are of interest.

A These are connectors for some 16strand parallel ribbon cable I've got and will plug a socket in here once I've got the other end of the cable attached to each of the cathode columns.

B I'm feeding each colour separately into each bank of four from the chipkit. By doing this I will save some cycling in my software (according to my thought processes at the moment - I haven't actually written this bit of code yet)

C This is a pull up 10k resistor - this connects all the 'Blank' pins to the chipkit and the 3.3V rail - This pin is important as the blank pin re-sets the counters inside the chips to zero. Note all the chipkit pins (except for the power rails and the colours) connect to each bank of chips so that an update for some pin on one bank is simultaneously updated on all the other banks.

D These are 1500k resistors - I have chosen a slightly lower value than the 1800k I'd been working using until now. This will allow (per the datasheet formula) about 26mA sink through each channel. I have decided to use dot-correction via the software to lower the overall current going through each channel and having a higher starting point (i.e. 26mA is about 25-30% more current than the 1800k resistors) will give me a bit more flexibility if I find I need to brighten the LEDs somewhat after construction.

E - The "SINOUT" pin is used to cascade data from one chip to the next. As I'm going to update each colour simultaneously I don't need to use the last pin in the cascade to link to anything.

The only thing that I don't like about this is the way that the power rails go around the outside - I think I'll make this a bit tidier when I finally construct.

Cheers - next steps construction.

#### Attachments

• TLC5940 Circuit.pdf
38.4 KB · Views: 265

#### rjamjb

Jan 19, 2013
50
Extra item

Oh - and I'm not using the XERR pin - i.e. no error checking - I'll be able to see if an LED fails!!!

#### KrisBlueNZ

##### Sadly passed away in 2015
Nov 28, 2011
8,393
I think it's good that you're using a separate TLC5940 string for each colour. You'll probably find that you need to run the red, blue and green elements at different currents to get a neutral white.

#### rjamjb

Jan 19, 2013
50
At last

Well, I did it - if I'd known how long this would take then I may have thought twice. Still I think that I would have gone for it anyway given the satisfaction it has given. There are still a couple of loose ends in the software that I need to resolve. First my colors don't seem to work in the way I want - I'll give them a bit more troubleshooting time but probably move onto the programming forum for help.

My software is probably not that elegant but it works so I'm keeping it with some tweaks needed for colors (as above) and some new animations. Will work on some more sophisticated animations next - eg sine waves and bouncing balls etc.

Probably difficult to see from the videos but there is absolutely no flicker, no ghosting, no hardware glitches in the final display - the hardware works perfectly - any faults you see in the example videos (and there are a couple if you look hard), is purely down to my code - which at this stage is just a couple of concept animations.

To pick up from where I left off...

I knew that I was bound to fail if I tried to wire up all those connections for the main TLC (x12) board by hand so I taught myself how to construct a pcb. There is a fantastic bit of software out there called Kicad which is remarkable - once you've learned how to use it, it then just produces all the files for the pcb company. They do a great deal for your first 3 pcbs @£10 each but for some reason sent me 5. If I did this project again I would definitely put the whole electronics scheme on a single board. Even with the main electronics on a board my eventual wiring looked like a spaghetti pie!!

As it is I could re-do the boards twice as good next time but they work for now so that is good for me.

I should write a blog or similar on this as it has been a fantastic learning curve in so many ways, from the original concept to the purpose of this thread - the switching circuit - through to the construction and then programming.

I have to say a massive thanks to KrisBlue for keeping me on the right track, particularly with the mosfets and the driver switch ICs and general advice over the whole project.

Russell

#### rjamjb

Jan 19, 2013
50
A Few Pics

The TLC5940 main circuit pcb

Pictures of the spaghetti pie before I bundled it all into the gubbins box

Still of the cube doing its first animation

#### Attachments

• DSC_0377.jpg
114.8 KB · Views: 233
• DSC_0387.jpg
147.9 KB · Views: 215
• DSC_0382.jpg
146.1 KB · Views: 201
• DSC_0381.jpg
152.9 KB · Views: 218

#### KrisBlueNZ

##### Sadly passed away in 2015
Nov 28, 2011
8,393
Cool! Great work Russell

BTW they sent you five boards because PCB manufacturers usually run extra in case of failures of various types, and with this run, they discovered there were five good boards from the run.

Do you have a link to the video?

Edit:
Pictures of the spaghetti pie before I bundled it all into the gubbins box
Hey, take it easy with the technical jargon

Thanks for reporting back. It's very rewarding to know that our advice has been useful.

Last edited:

#### rjamjb

Jan 19, 2013
50
Will post a couple of videos on youtube shortly and post the link here - also future links as I get to write more animations.

The technical jargon is nothing to the technical solution I came up with to hold all the various boards in place in the 'gubbins box'. If I did it again I'd fix all the boards in place and then wire them up and know that they wouldn't move around. I didn't want to rewire anything when I'd got everything up and running and there are a ton of potential short connections to be made in and around the wiring so I scrunched up a whole Sunday newspaper pushed it in and around everything in the gubbins box and then stapled a lid on it to hold it all in place. Works perfectly!!!!.

#### rjamjb

Jan 19, 2013
50

The first one is the cube hanging upside down while i debugged the hardware/software to check it works.

Russell

ps - a way to go to get to some of the animations that can be done but I'll get there.

#### rjamjb

Jan 19, 2013
50
Wow - nearly two years since i finished this project and put my last post on here. I realized that I didn't update with my final animated cube - which look really good, even if I do say so myself. I shall post an update on here with a full run through of my finished animated cube in the next couple of days. One of the problems I've had is to keep the cube safe from knocks (its had one already which twisted one corner - my I was mad (with myself!!!).

I've completed another couple of projects in the meantime - using the same chipset - had to go from c++ to machine code to create an led set surrounding my tv to reflect video on my computer.

Am here to look at circuitry to complete an induction coil heater - specifically the safety aspects - will go to another forum to post and take it from there.

Russell

#### Martaine2005

May 12, 2015
4,776
Wow - nearly two years since i finished this project and put my last post on here.
Hi rjamjb,
Just a 'heads up', the kind gentleman who was helping you with this project sadly passed away earlier this year.
Just so you know!
I personally didn't know him, but many here did and miss him dearly.
Sorry for the bad news.

Martin

Replies
1
Views
498
Replies
2
Views
3K
Replies
6
Views
1K
Replies
11
Views
1K
Replies
2
Views
2K