This is only a preview of the September 2010 issue of Silicon Chip. You can view 28 of the 104 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "Ultrasonic Anti-Fouling Unit For Boats, Pt.1":
Items relevant to "High-Performance Microphone Preamplifier":
Items relevant to "Build A Hearing Loop Receiver":
Items relevant to "Electrolytic Capacitor Reformer & Tester, Pt.2":
Purchase a printed copy of this issue for $10.00. |
+5V
Q1
BC556
f
g
e
6
D3
D4
IC1
ATTINY
2313
d
DISP2 NFD-8021BS
a
b
c
f
e
g
d
dp
a
b
f
g
e
c
dp
d
D1
D2
g f e d c b a dp
1 2 3 4 5 6 7 8 9 10
DISP3 NFD-5621BS
a
b
c
f
e
d
dp
a
b
g
c
dp
What it is & how it works
PD2
g f e d c b a dp
1 2 3 4 5 6 7 8 9 10
f
e
g
d
a
b
f
g
e
c
d
dp
c dp e d g
b
c
dp
f
b a
1 2 3 4 5 6 7 8 9 10
PB3 15
14
PB2
13
“Charlieplexing”
is a multiplexing technique for driving displays
PB1
12
PB0
and is particularly
suited for use with microcontrollers. It
11
PD6
reduces the
number
of outputs required to drive a given display
16
PB4
but implementing
it can be a little tricky. Here is an in-depth
PB5 17
18
8explanation
PB6 of how it works.
19
PD4
PB7
2
PD0
By NICHOLAS VINEN
T
PA2/RST
1
+5V
RLY1
K
HE REMOTE-CONTROLLED Digi- all six digits using just nine tracks in place of the specialised IC. This
tal Up/Down Timer described in and no external components (apart D2also allowed us to optimise the track
August 2010 features six920mm-high from the microcontroller). The method
connections, dramatically simplifying
PD5
LED digits in three dual displays. we used is known as “Charlieplex- the board layout.
A
These are great because they
3 are bright ing”. It was originally developed by
PD1
and easy to read from a distance but Christopher Malinowski in 1979 but Multiplexing
unlike a Liquid Crystal Display (LCD),
was popularised by Charlie Allen at
Before describing how the technique
they do not have an on-board control- Maxim, with the development of the works, let’s first look at how a 7-seg4
ler IC. This means that driving
them MAX6950 and MAX6951 ICs. These ment LED display is normally driven.
XTAL2
D5 normally involves
+
using external can drive five or eight
7-segment dis- This method is not restricted to this
components and quite a few tracks on plays from a 16-pin ICPIEZO
package.
type of display – it can be used with
the7PC board.
We used a similarBUZZER
scheme for our vacuum fluorescent displays, incanX1
8MHz
PD3 we found a way to drive timer project, with a microcontroller descent displays, Nixie tubes etc. The
However,
5
–
XTAL1
D6
GND
10
D6: 1N4148
A
a
D2
D1
Charlieplexing
DISP1 NFD-8021BS
20
Vdd
D1
D2
470Ω
CON4
K
33pF
10k
C
B
33pF
Q2
BC546
C
C
CON2
E
D1, D2: 1N4004
A
LLED DIGITAL TIMER
LED
K
B
K
A
7805
BC546, BC556
E
IN
C
GND
OUT
Fig.1: the conventional multiplexing scheme for driving common anode LED displays. Each digit is individually
switched on in sequence and the appropriate cathode control lines drive the wanted segments via transistors Q5-Q8.
siliconchip.com.au
CON1
September 2010 67
Fig.2: this shows how the same four LED displays are driven using Charlieplexing. In this case, the
anodes and cathodes are driven using complementary transistor pairs. This is convenient when
using a microcontroller, as their digital outputs are typically configured in this manner.
main differences are the drive voltage
and current.
Fig.1 shows the conventional multiplexing arrangement, although we
have simplified it by showing just
four LEDs in each display and only
four displays. However, this method
can handle any number of segments
or displays by adding more transistors
and control lines.
Of course, as the number increases,
routing the tracks becomes more difficult.
It works as follows: the anode control lines are active-low and only one
of them is active at any given time.
Typically, transistors Q1-Q4 are turned
on in sequence with a 25% duty cycle.
Conversely, the cathode control lines
are active-high and any combination
may be turned on at any given time.
Let’s say we want to light LEDs 2,
4, 5 & 9. First, anode control line 1 is
brought low and Q1 is turned on. At
68 Silicon Chip
the same time, cathode control lines
2 & 4 are switched high. As a result,
LEDs 1-4 are driven at the anode but
only LEDs 2 & 4 are driven at their
cathodes, so only these two LEDs light.
Before Q1 is turned off again, all the
cathode control lines are brought low
(off). Q2 then switches on and cathode
control line 1 is switched high. In this
case, LED5-8 are driven at their anodes
but only LED5 is driven at its cathode
and so only LED5 lights.
Finally, LED9 is switched on by
turning Q3 on (after Q2 is turned off)
and taking cathode control line 1 high.
All the cathode control lines (and
thus the cathode drivers) then remain
off while Q4 is turned on, so that no
further LEDs light.
Duty cycle
In this circuit, any LED can only be
on 25% of the time because the driver
transistors are switched in sequence.
So in reality, when multiplexed LEDs
are alight, they are actually flashing. However, by making them flash
rapidly enough, they appear to be lit
continuously due to persistence of vision (ie, our eyes cannot react rapidly
enough to detect the flashing). As a
result, we just see the lit segments.
It also follows that the LEDs are 25%
as bright as they would be if switched
on permanently, assuming equal currents. In practice, this is compensated
for by using brighter LEDs or by driving
them at higher peak currents. Most
LEDs can handle much higher currents
for brief periods than they can on a
continuous basis (ie, at DC), as the ultimate limit is their dissipation rating.
If they are only switched on a portion
of the time, the average dissipation is
a fraction of the instantaneous dissipation (in this case, 25%).
This multiplexing scheme is widely
used and it works well but it has dissiliconchip.com.au
advantages. The main problem is the
number of control lines necessary. It
is the sum of the number of segments
and the number of digits.
For last month’s Digital Timer with
six 7-segment digits (which have eight
LEDs each, including the decimal
point), this would mean 6 + 8 = 14
control lines. It would also require 14
transistors and 22 resistors.
This could be reduced by driving the
cathodes directly from the microcontroller outputs but if this is done, it’s
difficult to make the segment brightness consistent between digits due to
internal resistances in the microcontroller’s power supply.
By using Charlieplexing, we managed to drive the displays using nine
pins and no additional components.
Charlieplexing
Now take a look at the “Charlieplexing” arrangement shown in Fig.2. This
shows the same LED displays as before
but with the new driving arrangement.
There are actually more transistors,
five PNP and five NPN, but they are arranged as complementary pairs. This is
handy because microcontroller digital
outputs have a similar configuration.
If the transistors in a complementary
pair are individually controlled, as
they are in a micro, we have what is
known as a “Tri-state” output (a term
coined by National Semiconductor). If
one transistor is on and the other is off,
then the output is either active high or
active low (ie, pull-up or pull-down). If
both transistors are off, then the output
is “high-impedance”, ie, not driven.
Switching both transistors on creates
a short circuit between the supply rails
so this condition is prevented.
Transistor pairs 1-4 drive one common anode and between one and four
cathodes. It doesn’t matter which
cathodes are driven by which pair.
However, the common anode of each
display is driven by a different pair
than for its cathodes.
As before, one anode is brought high
at any given time. Transistor Q1 drives
the first display’s common anode, Q3
the second, and so on. When Q1 is
switched on, the first display’s four
cathodes are controlled by Q4, Q6, Q8
& Q10. Similarly, when Q3 is switched
on, the second display’s four cathodes
are controlled by Q6, Q8, Q10 & Q2.
Now, say we want to turn on the
same LEDs as in our last example (ie,
LEDs 2, 4, 5 & 9). We set pair 1 to acsiliconchip.com.au
tive high, pairs 2 and 4 to active low
and pair 3 to high impedance. That
means that transistors Q1, Q4 and
Q8 will be switched on while the rest
will remain off. As a result, LED2 and
LED4 will both be forward biased so
they will light up.
Now consider LED8 in this state. It
is also being driven at both ends – its
anode by Q4 and its cathode by Q1.
However because its anode is pulled
low and its cathode high, it is reverse
biased. Since LEDs act as diodes, no
current will flow and so LED8 will
remain off. This is the trick which
allows Charlieplexing to control the
same number of display segments with
less control lines.
As before, to light the other segments, the microcontroller cycles
through the anodes and turns on the
appropriate cathodes.
In the case of the MAX6590/1 ICs,
not only are the transistor pairs internal to the IC but the cathode transistors
have an adjustable current limit, so no
additional parts are required. You just
need the IC, the four digits and five
tracks. Since the order of the anodes
and cathodes are not important, they
can be re-mapped in the software – we
can route those five tracks whichever
way is most convenient.
As demonstrated in last month’s
timer project, similar results can be
obtained with a microcontroller. The
catch is that driving the display requires a fair bit of processing power
as it is necessary to cycle through the
segments one at a time and light them
(or not) individually. This is because
we must rely on the internal resistance
in their output transistors to limit the
current without additional resistors.
It is possible to add one resistor per
cathode set to the circuit to solve this
problem although brightness matching between digits can then become
an issue, depending on the current at
which the segments are being driven.
However, either technique is valid and
can provide simpler circuitry than the
traditional multiplexing method.
Because Charlieplexing is software
intensive, it is best suited to applications where the microcontroller does
not have a lot of work to do besides
driving the display. This is the case
with our Digital Up/Down Timer and
there are many other applications
which can take advantage of “Charlieplexing” to simplify circuit design
SC
and PC board layout.
Helping to put you in Control
Control Equipment
Freetronics
TwentyTen
Based on the Arduino Duemilanove but with
improvements and
updates It's 100%
Arduino compatible. Also included in
the package are a USB cable, and our
Getting Started guide sheet.
$36.30+GST
Thermostat Simple
to use thermostat with
an internal NTC thermistor sensor and
relay ON/OFF output
Will control over
5~50°C. $19.95 +GST
Light Sensor Switch
Easy to use light sensor. Can be used to
switch on lighting when
it becomes dark. Wallmount with a cable
gland for weather-proof
wiring. Adjustable time delay.
$12.95 +GST
400W Brushless
AC Servo Motor
Ideal for cost sensitive applications.
Comes with a
standard 2500-line encoder with differential encoder signals and Hall
Sensors $295 +GST
USB Brushed DC
Motor Controller has
four interface modes:
USB, logic-level serial,
analog voltage, and
hobby radio control (RC). Supports
open-loop and closed-loop speed or
position control. 6-16VDC 12A operation. $119.95+GST
Inductive Proximity
Sensor switch. Features a 4 wire NPN transistor output with both
NO+NC Outputs, LED
indication, IP67 and
wide power supply of 10-30VDC. PNP
Output available. Commonly used to
measure shaft speed. $27.50+GST
Ph: 03 9782 5882
New, Easier to Use Website
www.oceancontrols.com.au
September 2010 69
|