Drive 16 LEDs with one I/O line
Zoran Mijanovic and Nedjeljko Lekic, University of Montenegro, Podgorica, Montenegro; Edited by Martin Rowe and Fran Granville - June 9, 2011
Over the last few years, several
Design Ideas have described how
to use just a few microcontroller I/O pins
to drive many LEDs (references 1
through 7). The circuit in Figure 1 can
drive 16 LEDs with just one pin and two
shift registers. You can use the circuit to
drive long-dot-bar or two seven-segment-digit displays. Adding multiplexing
to the same circuit enables it to drive
eight seven-segment LED digits.

| Read More Design Ideas |
To write a logic zero to the shift register,
the microcontroller holds a low
level for approximately 2 μsec, which is
longer than the time delay. It then sets
the signal to a logic one, or high, level.
To write a logic one, the microcontroller
holds the high level for longer than the
time delay. The microcontroller then
makes negative pulses of approximately
0.25 μsec, or two CPU cycles, which is
shorter than the time delay and which
doesn’t change the logic level at the
data inputs.Figure 3 shows the clock signal in Channel 1 (yellow) and the data signal in Channel 2 (blue). The oscilloscope is a Tektronix DPO4034 with TPP0850 high-voltage probes. These probes have 40-MΩ input resistance and only 1.5-pF input capacitance, minimizing distortion.
A rising edge on the clock signal
clocks the shift registers. This edge corresponds
to the data signal’s local minimum.
Figure 3 also shows that the minimum
data-signal voltages for logic zero
and logic one are 1.3 and 3.1V, respectively.
The shift register’s logical threshold
is 2.5V. These voltages guarantee
sufficient voltage margins. If your design
requires higher margins, vary the signal
timing and use a higher resistance for R
in Figure 1. This circuit stores 16 bits in
shift registers in approximately 35 μsec.You can view a short video of the
circuit in operation here and download a
code listing, in C here. The software turns on the LEDs one by one every 500 msec
until all LEDs are on. It then turns off
all the LEDs and repeats the cycle.
| References |
|
Teardown: Cell-phone charger: nice idea done right
Some thoughts on DC/DC converters, part five
Why bypass caps make a difference - Part 4: Op amp macromodels: A cautionary tale
Proper Lithium-Ion battery charging and safety
Managing inrush and system protection for electrical systems
Has Thomas Edison ultimately won the DC vs AC power transmission controversy against Tesla?
Testing a power supply – Stability (Part three)
Connect a 4×3 matrix keyboard to a microcontroller using two I/O pins
Datasheets.com Parts Search
185 million searchable parts
(please enter a part number or hit search to begin)
KNOWLEDGE CENTER
