This is only a preview of the March 2021 issue of Silicon Chip. You can view 0 of the 112 pages in the full issue. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "High-Current Four Battery/Cell Balancer":
Items relevant to "Displaying digits using single RGB LEDs":
Articles in this series:
Items relevant to "Mini Isolated Serial Link":
Items relevant to "Battery Multi Logger - Part 2":
Items relevant to "Electronic Wind Chimes - Part 2":
Purchase a printed copy of this issue for $7.00. |
Displaying digits using single RGB LEDs
With embedded systems these days,
engineers must often deal with very
small PCB footprints, so suitable displays (especially for debugging) can be
difficult. My idea is to display multidigit numbers using just a few RGB
LEDs, where the digital value of 0-9 is
shown using standard resistor colour
codes (black, brown, red, …, white).
The circuit shown in Fig.1 is minimalistic, using just one high-brightness RGB LED controlled by a tiny
PIC10F200 (the world’s smallest 6-pin
microcontroller). It uses three simultaneous PWM pulse trains, each with
an independently controllable duty
cycle. By varying the duty cycles, the
intensity of the red, green and blue
elements within the RGB LED create
different colour mixes.
While seven of the required colours
are easy to obtain: red, green, blue, yellow (red+green), purple (red+blue),
white (red+green+blue) and black (led
off), achieving the three remaining colours required some experimentation
and fine-tuning of a look-up table (see
the table at right).
The current-limiting resistors have
also been individually adjusted to obtain the same brightness precisely, using a lux meter. The RGB led should be
used with a white diffuser to mask the
individual red, green, blue elements
(even with SMD RGB LEDs, these elements are distinctly visible).
Pin 6 in the circuit shown monitors
the status of pushbutton S1, which allows you to cycle through the available digits values/colours (Fig.1). This
pin has an internal pull-up enabled
for that micro pin so that it can detect
button presses.
As shown in Fig.3, this circuit can
be used in cascade, with discrete logic OR gates, creating a multi-digit
display. Alternatively, a single 8-pin
microcontroller can drive a four-digit
LED display, as shown in Fig.2.
The source code (1dgtRGB.ASM
and PWMLEDS.INC) is available for
download from siliconchip.com.
au/Shop/6/5781 This suits the 6-pin
PIC10F200 and would need to be
modified for the PIC12F617 or other
micros. Its size is optimised, and it
uses macros to ease understanding. It
occupies just 116 program words and
nine data bytes.
The code is fully commented, to
make it easy to adapt to other microcontrollers.
Benabadji Mohammed Salim,
Oran, Algeria. ($100)
Fig.1
Fig.2
Fig.3
siliconchip.com.au
Australia’s electronics magazine
March 2021 41
|