RGB LED Binary Clock (TLC5940, multiplexing)

Im starting to plan and figure out how to accomplish my next project, which will partly consist of a RGB LED binary clock, with the ability to PWM each LED individually using an Arduino.

I have common anode LEDs and I plan on using a TLC5940 to control the PWM of each LED using the TLC multiplexing library used in this project

http://www.thebox.myzen.co.uk/Hardware/Mini_Monome.html

This will be my first time dealing with multiplexing, but my plan is to have 6 columns of RGB LEDs (HHMMSS format) and 4 rows (treating it like a matrix). Each column will have each of the red pins connected, green connected, and blue connected and inputted into the TLC. Each row will have the anodes connected together and connected to the drain of a p-channel FET. Each of the 4 gates (of the 4 FET for each row) will be connected to pins on the Arduino which will be multiplexed using the TLC library mentioned above. It will basically look like this schematic, however without the switches for each LED, a FQP5P20 FET instead of the TPC6108, and 2 extra columns with, rather unfortunately, an extra TLC.

http://www.thebox.myzen.co.uk/Hardware/Mini_Monome_files/4%20X%204%20RGB%20LED%20Matrix.pdf

My questions are:

  1. Since I want to have the clock in a HHMMSS format, I need to control 6x3=18 LEDs. Since the TLC can only control 16, I need an extra one for the last 2. I'm guessing theres no way around this, but I would just like to make sure this is the only way.

  2. Are the p-channel FETs I plan to use (FQP5P20) ok? The ones in the schematic are unavailable where I'm getting all my parts and this one seems to be okay, however I'm not too experienced with transistors in general.

  3. What would be the pull-up resistor value for the FETs? In the schematic it shows 4K7, what does that mean? The source will be connected to +5V like in the schematic.

  4. Another part of this project will be 2 8x8 RG LED matrix's (LED Matrix - Dual Color - Medium - COM-00682 - SparkFun Electronics) that will show the normal time. My plan for this was to use 4 MAX7219 since the matrix is common cathode and therefore incompatible with the TLC. Can anyone forsee problems I might encounter using the multiplexing library for 2 TLCs and the LEDcontrol library for the daisy-chained MAXs?

Can anybody offer any advice on this project? I havent spent a lot of time studying the TLC multiplexing library I plan to use, have anyone else used it?

Thanks!!

I'm guessing theres no way around this,

Well you could drive them with PWM pins directly.

Are the p-channel FETs I plan to use (FQP5P20) ok?

No you need a logic level FET that will turn on with 5V, not a gate threshold of 5V.

the schematic it shows 4K7, what does that mean?

four point seven k ohms

Can anyone forsee problems I might encounter using the multiplexing library for 2 TLCs and the LEDcontrol library for the daisy-chained MAXs?

It might utlise the same pins as the TLC5940 for SPI communications, if it does you will just have to bit bang SPI signals on other pins.

Grumpy_Mike:

I'm guessing theres no way around this,

Well you could drive them with PWM pins directly.

PWM pins of Arduino have to be used to drive TLC5940.

From Arduino Playground - HomePage

What? Why are you taking away PWMs?

The GSCLK and BLANK signals need to be stable and accurate or the outputs of the TLC5940 will be erratic. By using the hardware timers we can make those be solid no matter what is going on in the sketch. Besides, it costs you 3 to 4 8 bit PWMs and gets you 16 to 640 12 bit PWMs. It's a fair trade.

PWM pins of Arduino have to be used to drive TLC5940.

He is not going to use that library so there not :stuck_out_tongue:

Grumpy_Mike:

I'm guessing theres no way around this,

Well you could drive them with PWM pins directly.

Are the p-channel FETs I plan to use (FQP5P20) ok?

No you need a logic level FET that will turn on with 5V, not a gate threshold of 5V.

the schematic it shows 4K7, what does that mean?

four point seven k ohms

Can anyone forsee problems I might encounter using the multiplexing library for 2 TLCs and the LEDcontrol library for the daisy-chained MAXs?

It might utlise the same pins as the TLC5940 for SPI communications, if it does you will just have to bit bang SPI signals on other pins.

How would I accomplish this with using the 6 PWM pins on the Arduino? How would that work with the multiplexing library for the TLC?

Also, I dont get the FET. Your saying I need a FET that turns on with 5V, but aren't the p-channel FETs in the schematic on when its 0? And what do I look for on a datasheet to make sure I get the correct FET?

And Im thinking that I might want to add a second Arduino to the mix. Since theyre perfboard Arduinos, theyre only ~$5 each, and this way I can have 1 deal with the TLCs for the binary clock, and the other deal with the MAXs, so I can add a motion sensor, temp sensor, and possibly alarm clock functions as well. What do you think? Would it make it much simpler? The MAXs and TLCs conflict with pins, so its an added level of complexity along with everything else I would like to avoid :slight_smile:

but aren't the p-channel FETs in the schematic on when its 0?

Yes but then the voltage between the gate and the source is -5V and you need to make sure the FET is fully on with that voltage.

what do I look for on a datasheet to make sure I get the correct FET?

The terms 'logic level' or a specified on resistance (Ron) at 5V as well probably as 10V. If it just tells you it at 10V then it is probably no good. You will also see the gate threshold at about 3V.

How would I accomplish this with using the 6 PWM pins on the Arduino

Connect the anode to +5 and each of the cathodes through a resistor to a separate PWM pin. Then a low value turns it on and a high turns it off. If you want to specify a brightness as a number in a variable called var that goes from 0 (off) to 255 (on) then use
analogWrite(pin, 255 - var);

You can use two arduinos if you want but it is much simpler bit banging the SPI interface to the MAX chip.

Grumpy_Mike:

but aren't the p-channel FETs in the schematic on when its 0?

Yes but then the voltage between the gate and the source is -5V and you need to make sure the FET is fully on with that voltage.

what do I look for on a datasheet to make sure I get the correct FET?

The terms 'logic level' or a specified on resistance (Ron) at 5V as well probably as 10V. If it just tells you it at 10V then it is probably no good. You will also see the gate threshold at about 3V.

How would I accomplish this with using the 6 PWM pins on the Arduino

Connect the anode to +5 and each of the cathodes through a resistor to a separate PWM pin. Then a low value turns it on and a high turns it off. If you want to specify a brightness as a number in a variable called var that goes from 0 (off) to 255 (on) then use
analogWrite(pin, 255 - var);

You can use two arduinos if you want but it is much simpler bit banging the SPI interface to the MAX chip.

I've used PWM before, but Im still trying to figure out this whole multiplexing thing because its quite confusing at the moment. Hopefully when I order the parts I'll be able to actually test things and hopefully understand it a little better.

Also, for the bit banging...I never heard about that before. What exactly does that mean? One of the other reasons I'm considering 2 arduinos is because I would like this to be part of a larger project, including a RTC, alram, IR capabilities, motion sensor, and temp sensor (possibly more :D). I'm worried with all the multiplexing going on with 1 arduino I wont have the processing power to handle everything I want to do. A little ambitious but I figure once its done it's going to be awesome!!

Bit banging is the technique of just changing bits with single write statements rather than letting some internal hardware do it. With SPI you can use the shift out function to generate the serial data stream needed rather than the SPI hardware scoff register.