Wednesday, July 29, 2015

Voice Driver Board - Kitt Display

1. Overview


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)
         = 1.8V

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
        = 1.25V

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.



Wednesday, July 22, 2015

Voice Display Board - Based on Kitt from Knight Rider

1. Overview


While waiting for the mobility platform parts to arrive from the US, I decided to start a side project. I liked the idea of having some sort of visual indication for when AVA was communicating and coincidently came across a voice display board advertised by Think Geek (which says it all really). This display is a simulation of that used by Kitt the robot car in the TV show Knight Rider.


Following a quick internet search it became apparent that there were two main approaches to developing a display like this, analogue or digital. Given that the rest of AVA was largely digital I thought I would go old school and try the analogue path.

The Kitt display is basically a VU (Audio Power) meter reflected horizontally. To make things simple, Texas Instruments produce a chip called the LM3915 Dot/Bar Display Driver which does most of the hard work and is designed for exactly this application. The LM3915 senses analogue voltage levels and drives ten LEDs to produce a logarithmic 3 dB/step display. The LM3915 even provides a regulated LED current supply, eliminating the need for current limiting resistors.


The logarithmic output is suited to signal inputs with wide dynamic range (like audio levels, power, light intensity and vibration). There is also a linear version of the chip which could be used for things like battery level and I may incorporate one of these in a later project.

2. Prototype Design


To ensure that this design works as advertised and to identify any design issues, I built a quick prototype and hooked it up to AVA's logging Arduino (which is the only thing which makes a noise currently). Eventually the robot will have a voice synthesizer, but one step at a time.

Based on the audio power meter design from the LM3915 Data Sheet, I built a version on a breadboard. Note that the LED bar graph doesn't have it's polarity marked (that I could see), a quick check with a multimeter indicated that the anode is the side with the writing.


This works ok, but highlighted a few issues:
  1. The PWM digital output on the Arduino which drives the piezo to make the robot sounding beeps, has sufficient residual voltage when making no noise to light a couple of the LEDs.
  2. The voltage output from the Arduino is low enough that it doesn't need the voltage divider formed by R1 (18k) and R2 (10k). Consequently the audio signal can plug straight into pin 5 of the LM3915. This pin can handle +/- 35V without damage so we are pretty save with our 5V Arduino.
  3. The LM3915 can only sink a maximum of 13mA of LED current (see data sheet electrical characteristics table). To produce the Kitt display we will need 6 of the LED bar graph displays, so in the worst case we need to be able to provide enough current to drive 6 LEDs. Checking out the data sheet for the LED bar graph display, we find that each LED typically draws 20mA (forward current). In practise, as little as 1 mA will light the LEDs, but they are fairly dim. 
  4. As can be seen from the breadboard photo, even one 10 LED bar graph needs a heap of interconnecting wire. Six times this would be a mess, which suggests that a Veroboard solution is not the go. We will need to layout a PCB or two.

3.0 Final Design


Addressing the issues raised by the prototype, I created a design which utilises two PCB's on top of each other (display on top). The display board schematic looks like this:


The associated double sided PCB layout is below. I used Fritzing to do the schematic and PCB layout. It is FREE and I highly recommend it for simple to medium level designs. They have an associated PCB fabrication service (in Berlin) which is fairly expensive, but for a double sided board like this with a number of via's, it was a good option.


We will cover the display driver board in the next article. Finally, a quick video of the prototype connected to AVA.