In our last post we described the display board which consisted of the six DIL LED bar graph displays and their associated current limiting resistors. The input to the LED Driver Board is a 10 pin header and +12V (which will come from AVA's power distribution board powered by two 12V SLA batteries in parallel). The purpose of the driver board is to take in an audio input signal, feed it to a LM3915 Dot/Bar Display driver chip, which then sinks the current from the display board LEDs via transistors, when they need to turn on. It does this using the 10 pin header which connects the two boards.
2. Header Connections
The 10 pin header is labelled A to J. On the display board, pins A, B and C connect to the first 3 LEDs on the middle bar graphs. Note that the lower bar graph connections are the mirror image to the top bar graphs. Pin D connects to the first LED of the outer bar graphs and LED 4 of the inner ones. Pin E then connects to the 2nd LED of the outer bar graphs and LED 5 of the inner ones. This pattern continues for the rest of the pins. The last 3 LED's on each of the outer bar graphs remain unconnected. By connecting the LED's in this fashion we get a display which simulates a mouth moving based on the audio level of the sound.
On the driver board, pin A of the header is driven by the LED 1 input on the LM3915. B is controlled by LED 2 and so on. The LM3915 senses analogue voltage levels and drives the ten LED inputs to produce a logarithmic 3 dB/step display. Consequently (from the data sheet), the LEDs will turn on at the following approximate audio power levels:
A - 0.2W
B - 0.4W
C - 0.8W
D - 1.6W
E - 3W
F - 6W
G - 13W
H - 25W
I - 50W
J - 100W
3. LM3915 Display Driver Setup
Using the LM3915 is fairly straight forward. Pin 1 and pins 10 to 18 are the LED driver inputs (see schematic above). Pin 2 goes to ground. Pin 3 (V+) goes to the 12V supply (max 25V). Pin 4 goes to ground if that is your bottom voltage range (which it is for us).
Pin 5 is the signal input. We want a maximum of 1.2V, so we use a voltage divider to step this input down. The input at pin 5 can withstand voltages of +/- 35V and an input current of +/- 3mA without damage. The audio output from the Arduino will be at most 5V (but less than this in practise as we are using PWM to drive the piezo). The formula for a voltage divider is:
Vout = Vin (R2 / (R1 + R2)
= 5V x (10k / (18k + 10k)
Note that full scale has been set to 1.25V (see below), so we are overdriving this a tad theoretically but in practise that turns out not to be the case. We are nowhere near levels which would damage the chip.
Pin 9 selects the mode of the display driver. Leave it floating for dot mode, connect it to the supply voltage (pin 3) for bar mode. We added a switch so that you can select the mode.
Pin 6 is the full scale voltage level. We have connected this to pin 7 which is the LM3915 internal voltage reference which delivers a nominal 1.25V between pin 7 (REF OUT) and pin 8 (REF ADJ). To calculate the current which will be sunk at each LED input pin, we refer to the data sheet formulas:
Vref = 1.25V (1 + R2/R1) + R2 x 80uA
= 1.25V (1 + 0) + 0
ILED = 12.5V/R1 + Vref/2.2k
= 12.5/1000 + 1.25/2200
= 13 mA
This would be fine if we were connecting an LED directly to the LM3915, but we can't do that because we need to drive up to 6 LEDs per input (have a look at pin D on the display board). We want the current through our LEDs to be 10 to 15 mA, so we need to be able to sink up to 90 mA. Note that from the data sheet, the max LED current is 13 mA (from the electrical characteristics table). This explains why we need the transistors.
Capacitor C1 (2.2uF tantalum) is required if leads to the LED supply are 15 cm (6 inches) or longer.
4. Transistor Switches
In order to sink sufficient current for up to 6 LEDs we will use transistors to switch them on and off. We have selected the BC 557 which is a general purpose PNP transistor. This transistor can handle a max current (Ic) of 100 mA and a max voltage (Vce) of 65V. It has a DC current gain between 125 and 800.
We use a PNP transistor rather than the more common NPN variety because we need the current to flow out of the base and into the LM3915 LED input to turn the transistor on. In a NPN transistor the current flows into the base.
PNP Transistors can be thought of as being normally OFF but a small output current and negative voltage at its Base ( B ) relative to its Emitter ( E ) will turn it ON allowing a much large Emitter-Collector current to flow. PNP transistors conduct when Ve is much greater than Vc.
To cause the Base current to flow in a PNP transistor the Base needs to be more negative than the Emitter (current must leave the base) by approximately 0.7 volts for a silicon device.
The voltage drop across the current limiting resistor on the display board is the supply voltage (12V) minus the LED forward drop (2V from the data sheet), which gives us 10V. Thus,
ILED = 10V/180 = 55.5mA
However, this current is distributed among 7 LED's, and so typically will be more like 8 mA per LED.
The LM3915 LED inputs are at V+ (i.e. 12V) when off and close to ground when on.
We know that:
Ie = Ib + Ic; and
DC Current Gain (Hfe or Beta) = Ic/Ib (= 125 to 800 for a BC 557)
Consequently, when the LM3915 input is ON, the corresponding transistor is also turned hard on (saturated) and the LEDs associated with that pin are also turned on. The voltage at the base when turned on is 10V - 0.6V = 9.4V. Based on this voltage across the 1k base resistor we can calculate the base current:
Ib = 9.4V/1000 = 9.4 mA
Based on a typical gain of over 300 this may suggest an Ic above the maximum 100mA but this wont happen because the transistor is saturated and at most will draw the ILED of 55.5 mA calculated above. It is not a bad idea to overdrive the base current (within the limitations of the transistor) as this makes the design conservative and beta drops off with high speed switching (MHz so not really a consideration for audio frequencies).
When turned the LM3915 inputs are OFF, the transistor is also OFF, there is no base current and hence no collector current and the LEDs are OFF.
5. Main Driver PCB
The image below shows the final main driver printed circuit board. When connecting to the display board, note that the order of the header (A-J) is reversed.