Tag Archive | "ammeter"

Review – Texas Instruments TLC5940 16-channel LED driver IC

Hello readers

Today we are going to examine the Texas Instruments TLC5940 16-channel LED driver IC. My reason for doing this is to demonstrate another, easier way of driving many LEDs as well as LED display modules that are common-anode. If you have a common-cathode display module, you should have a look at the Maxim MAX7219. Moving along, here is the IC:

tlc5940sss

Another nice big DIP IC. Also available in HTSSOP and QFN packaging. What can this IC do for us? It can control 16 LEDs per IC, and also be cascaded to control more and more, with the display data arriving via a serial line in the same manner as a 74HC595 shift register. Furthermore, another benefit of this IC is that you don’t need matching current-limiting resistors for your LEDs, as this IC is a current sink, in that the current flows from the 5V rail, through the LED, then into the IC. However, it can control the brightness of the LEDs using pulse-width modulation over 4096 steps via software, or using a single resistor.

What is pulse-width modulation? Normally an LED might be on, or off. But if you switch it on and off very quickly, it does not look as bright (as it is not on 100% of the time). If you alter the period of time between on and off, you can alter the perceived brightness of the LED. Here is an example, compare the brightness of the LED bars against the display of the CRO – as the brightness increases, the voltage (amplitude [vertical thickness]) spreads across the entire time period (horizontal axis); as the brightness decreases, the voltage spread across time retreats:

Using the IC is very easy on the hardware front. Here is the data sheet: TLC5940.pdf. The pinout diagram is quite self-explanatory:

Pins OUT0~OUT15 are the current-sink pins for each LED. When one is selected they allow current to flow into the IC from the 5V rail, with the LED in between – turning it on. However it is easier to understand with a practical example, such as this:

tlc5940demo1schematic

If you are using an Arduino Mega-style board, the wiring is a little different, please see here for the instructions.

Here we have our Arduino board or compatible sending serial data to the TLC5940 to control sixteen LEDs. The 2k ohm resistor is required to set the maximum current available to flow through the LEDs, thereby adjusting their brightness. Using software you can adjust the brightness with PWM for each LED by itself. Very important: this circuit will need external power into the Arduino or a separate 5V power supply. The circuitry on the breadboard draws up to ~318 mA by itself – running the Arduino from USB only made it somewhat flaky in operation. Here is the circuit in action with an ammeter between the breadboard and 5V out on the Arduino:

Anyhow, let’s get moving once more – here is the assembled demonstration circuit:

tlc5940demo1bbs

For our example, we will be using the Arduino way of doing things. Thankfully (once more) there is a library to make controlling the IC exponentially easier. The library page and download files are available from here.  If you need guidance on installing a library, please visit here. However the commands to control the IC are quite simple with the Arduino library.

First of all, include the TLC5940 library, as such:

Then in void setup(); you create the object using the function:

You can insert a number between 0 and 4095 to set the starting PWM (LED brightness) value, however this is optional. Setting an output for display requires two functions, first Tlc.set(l, p); where l is the output (0~15) and p is the PWM brightness level – then execute Tlc.update(); which sends the command to the IC to be executed. The sketch below is easy to follow and understand the process involved.

Moving forward with the demonstration, here is the sketch  – TLC5940demo.pdf, and the video clip of operation:

When the LEDs are glowing from dim to bright and return, we are altering the PWM value of the LEDs to adjust their brightness. This also occurs during the last operation where the LEDs are operating like the bonnet of KITT.

Below is an example of TLC5940 use by JM – he has made an awesome RGB LED cube:

Well once again that’s enough blinkiness for now, again this is another useful IC that helps simplify things and be creative. As always, avoid the risk of counterfeit ICs  – so please avoid disappointment, support your local teams and buy from a reputable distributor. Living in Australia, mine came from element-14 (part number 1226306). So have fun! High resolution photos are available from flickr.

Remember, if you have any questions at all please leave a comment (below). We also have a Google Group dedicated to the projects and related items on the website – please sign up, it’s free and we can all learn something.

Posted in arduino, lesson, part review, tlc5940, tutorialComments (28)

bbboost chapter five – the power supply module

[3 July 2010 – this project has been retired, but the posts left for reference]

Greeting again to followers of the bbboost journey. It has been a month since the last instalment, however the 20V DC plug pack took a long time to arrive from the land of China. Nevertheless, the project is moving forward. For my new readers, the bbboost is a power supply that can be assembled by a beginner, and can offer a smooth variable DC output voltage of between ~1.8 and ~20 volts – perfect for experimenting, breadboard, and generally saving money by not buying batteries. You can just make a PCB version, or mount it in an enclosure like a professional desktop unit. No mains voltage wiring is required, so it will fine for the younger enthusiasts. Follow the project from here.

This time I have breadboarded the power supply module, using the circuit described in chapter two.  Let’s have a bit of a look:

power-layout

power-layout2

These trimpots were ok, but it would be preferable to use the fully enclosed dustproof versions. Will order some and try ’em out.

trimpots

One trimpot (the blue and white one) is 5k ohm, – to adjust between the full range, so this is the ‘coarse’ adjuster; the other trimpot is only 500 ohms and changes the voltage selected by the coarse pot by around +/- 1.2 volts. The purpose of having two controls is to make it very easy to select your required voltage down to one-hundredth of a volt. The following video clip is a rough example of this type of adjustment in action:

This power supply will also be designed for installation into a nice enclosure, so in that case one would use normal-sized potentiometers for the coarse and fine voltage adjustment.

Posted in bbboost, projects, test equipmentComments (0)

bbboost chapter four – the digital ammeter

[3 July 2010 – this project has been retired, but the posts left for reference]

Greeting again to followers of the bbboost journey. Finally the required parts arrived today so now the project can move forward. (Living in a country of 22 million people, you would think 5W resistors would be easy to come by. Think again). If this is your first brush with the bbboost project, please visit here to see what it is all about!

So today we are going to modify the voltmeter module to convert it to an ammeter (current meter) and therefore a very useful thing to have on a desktop power supply. By having an ammeter, once  your project or prototype is running you can use the current readout to determine the power supply or battery requirements for your project, or dance dangerously close to the limits of the circuitry. Careful!

However converting the voltmeter is a simple process. Using Ohm’s law, we know that current = voltage over resistance. So our problem requires us to determine the current. If we measure the voltage potential across something of a known resistance (say, a resistor), and divide the voltage by the resistance, we have the current flowing through the resistor.

I = current in Amps; V = Volts; R = resistance in Ohms.

So for example, if we have the current of our supply circuit running through a 1 ohm (5 watt – as the wattage will increase at full load) resistor, and the voltage potential across the resistor is 0.0084 volts (8.4 millivolts), the current will be 8.4 milliamps (or 0.0084 A).

Now that we already have a voltmeter, a simple removal of the 1M ohm resistor from the terminals and replacing it with a 10k ohm resistor allows the meter to measure much smaller voltages. Therefore the maximum is will measure is 999.9 mV (which we will note as mA when being used in ammeter mode). Here is the circuit diagram for the ammeter. Note the only change from the voltmeter is below the 10 nF capacitor at the bottom-left of IC1. The supply current will be running through the 1 ohm 5 watt resistor. In the next chapters we will discuss a switching solution to flip between voltmeter and ammeter without any rewiring by the end user.

ammeter

Also note the change of wiring on our breadboard, it is much neater and easier to follow. The solid wires are much more reliable than the looser ones used previously. Although they can be more difficult to route around a breadboard, they will be more reliable – especially if you move the board around a lot.

ammeter_small

There we have it! A simple conversion has made our voltmeter an ammeter with a range of 0~999.9 milliamps (basically 1 amp). Which matches nicely with the original specification of the bbboost power supply of 1 Amp. But now for the action test: measure some current! Our test subject is an LED in series with a 10k variable resistor and a 6v battery. In the video clip (no audio) we will measure the current through the circuit at three different rates, changing the resistance to alter the current three times, then comparing the readout on the bbboost and a multimeter set to mA scale. The test current values are: 0.8 mA; 12.4~5 mA (third time lucky) and 118.5 mA (bbboost) vs. 114.8 mA (multimeter). That’s a difference of 3.7 mA – for the purpose of this project, quite negligible. There is always Fluke!

The extra parts required for this section are a 10k ohm 0.25 W resistor and a 1 ohm 5W resistor.

Well that was nicely successful – except for that pesky decimal point – we didn’t do anything about it in the change from a voltmeter to an ammeter. That, my friends, is for the next instalments.

Posted in bbboost, projectsComments (0)


Subscribe via email

Receive notifications of new posts by email.

The Arduino Book

Arduino Workshop

Für unsere deutschen Freunde

Dla naszych polskich przyjaciół ...

Australian Electronics!

Buy and support Silicon Chip - Australia's only Electronics Magazine.

Use of our content…

%d bloggers like this: