This is only a preview of the September 2009 issue of Silicon Chip. You can view 33 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. Items relevant to "High-Quality Stereo Digital-To-Analog Converter, Pt.1":
Items relevant to "Using A Wideband O₂ Sensor In Your Car, Pt.1":
Items relevant to "Autodim Add-On For The 6-Digit GPS Clock":
Items relevant to "3-Channel UHF Rolling-Code Remote Control, Pt.2":
Purchase a printed copy of this issue for $10.00. |
Autodim add-on for
the 6-Digit GPS Clock
By JIM ROWE
Here’s a low-cost add-on for the Digital GPS Time Display published
in the May & June 2009 issues of SILICON CHIP. It senses the ambient
light level, so that a modified program running in the display unit’s
PIC controller can adjust the LED brightness to a comfortable level
– ranging from full brightness when the ambient light level is high
down to dim when the ambient light is very low.
S
OON AFTER THE basic 6-Digit
GPS Time Display was published
in the May 2009 issue, we received
emails from readers who were disappointed that we hadn’t provided the
design with an “autodim” facility. And
they wanted to know if such a feature
could be added in.
Unfortunately, trying to incorporate
dimming on the existing clock PC
board is quite difficult. The conventional way of doing it would be to use
a transistor and LDR circuit to control
the emitters of all six common-cathode
siliconchip.com.au
driver transistors, Q15-Q20. We have
used this scheme on quite a few past
projects which had a PIC micro and
7-segment LED displays but a quick
look at the PC board pattern shows that
it would be quite impractical.
This presented a real dilemma un
til we came up with an alternative
scheme: use an LDR and transistor
circuit to allow the PIC micro to directly monitor the ambient light level
and then change the duty cycle of the
multiplexed drive to the 7-segment
displays.
So we set out to develop the “Auto
dim Display Sensor” described here.
The hardware was the easy bit, of
course – the firmware mods took a
bit longer.
How it works
The new hardware consists of just
a few parts on a small PC board. This
mounts on 10mm spacers in front of
the display unit’s main PC board, in
place of the DB-9 connector (CON1)
which was originally used to feed in
the NMEA-0183 data stream from the
September 2009 75
lower than the 2.2kΩ emitter/collector resistor. This makes it suitable for
driving one of the analog-to-digital
converter (ADC) inputs of the display’s
PIC18F877A microcontroller (IC1). In
this case, the sensor voltage is fed to
the micro’s AN5 ADC input.
And that’s really all there is to the
hardware side of the add-on, apart
from the 100nF capacitor across the
150kΩ resistor. This capacitor is used
to filter the LDR’s output voltage, to
remove any modulation from the indoor ambient lighting level.
+5V ON MAIN BOARD
10k
LDR1
(RP-3480)
B
B
C
Q1
BC548
E
Q2
BC558
C
PIN 8 (AN5) OF IC1
(0V FOR VERY LOW AMBIENT,
+4.5V FOR BRIGHT SUN)
E
100nF
150k
2.2k
GND ON MAIN BOARD
BC548, BC558
SC
2009
AUTODIM DISPLAY SENSOR
Modified firmware
B
E
The modified firmware for the PIC
regularly monitors the voltage applied
to the AN5 input (pin 8). It does this
by directing the ADC module inside
the PIC to measure this voltage. It then
tests the measured voltage level and
varies the on-off ratio of the display
digit switching signals to vary the
apparent display brightness, over six
levels.
As a result, the apparent display
brightness varies between virtually
full brightness at high ambient light
levels down to about 17% of full
brightness at very low ambient levels.
C
Fig.1: the circuit uses an LDR to sense the ambient light level. The resulting
DC voltage across the 150kΩ resistor is then buffered by complementary
emitter follower stage Q1 & Q2 and fed to pin 8 of the microcontroller on the
display board.
TO PIN 8 OF
IC1 (PIC)
TO +5V
LINE
TO GND
1 9 0 8 0BC548
240
LDR1
2.2k
150k
ERJ
Q1
100nF
+5V AN5 GND
BC558 Q2
10k
Building it
Fig.2: install the parts on the PC board
as shown here. Take care not to get the
two transistors mixed up.
GPS Frequency Reference.
This DB-9 connector is no longer
needed if you’re using the GPS receiver module described in the June
2009 issue.
Fig.1 shows the circuit details. The
ambient light level is sensed by LDR1,
a small light-dependent resistor (LDR)
which varies its resistance between
about 2MΩ in the “dark” and a couple of
hundred ohms in bright sunlight. This
LDR is connected in series with a
150kΩ resistor across the +5V supply. As a result, resistance changes
in the LDR result in corresponding
DC voltage changes across the 150kΩ
As mentioned earlier, the additional
components are all mounted on a small
PC board. This is coded 04208091 and
measures just 36 x 19mm.
Fig.2 shows the parts layout on the
PC board. The only polarised parts
are transistors Q1 and Q2, so make
sure you fit these with the orientation
shown. Also be careful not to swap the
two: Q1 must be an NPN BC548, while
Q2 is a PNP BC558.
The LDR is not polarised and can
be fitted either way around. Leave its
leads about 15mm long so that they can
be bent outwards from the PC board
after it is fitted to the board. This allows the sensitive “front face” of the
LDR to be turned away from the main
LED displays when the add-on board
is mounted in position.
Note: if the LDR is able to pick
resistor, the level varying from close
to 0V when the ambient light level is
very low up to about +4.5V in bright
sunlight.
Unity-gain buffer
The other components in the circuit, based on transistors Q1 & Q2,
make up a near-unity gain impedance
step-down buffer. This ensures that
the light-dependent output voltage
is made available at a much lower
impedance level than 150kΩ.
In greater detail, transistors Q1 and
Q2 form a complementary emitter follower, with a source resistance much
Table 1: Resistor Colour Codes
o
o
o
o
No.
1
1
1
76 Silicon Chip
Value
150kΩ
10kΩ
2.2kΩ
4-Band Code (1%)
brown green yellow brown
brown black orange brown
red red red brown
5-Band Code (1%)
brown green black orange brown
brown black black red brown
red red black brown brown
siliconchip.com.au
IC1 PIC 16F877A
(8)
REG1
78L05
1
+
+
4004
CON2
MAIN DISPLAY
BOARD
+5V AN5 GND
AUTODIM
ADD-ON
BOARD
19080240
ERJ
NOTE: FOR CLARITY,
WIRES ARE SHOWN
ABOVE MAIN BOARD.
IN REALITY, THEY LOOP
AROUND TO UNDERSIDE
OF THIS BOARD
Fig.3: only three leads are required to connect the autodim board. Note that
the connections are actually run to the underside of the display board.
up too much light from the displays
themselves, the auto-dimming feature
won’t work. Instead, the displays will
run at full brightness, regardless of the
ambient light level.
Only three wires are required to
connect the auto-dimming board to
the main display board. Fig.3 shows
the details.
The first step is to solder three 80mm
lengths of light-duty hookup wire to
the three external wiring points (ie,
+5V, AN5 & GND). That done, attach
two M3 x 10mm tapped spacers to the
underside of the add-on board, using
two M3 x 6mm machine screws.
The completed add-on assembly can
now be mounted in the lower lefthand
corner on the main display board. You
will have to remove the display board
from its case in order to do this. The
add-on board is secured in place using
two further M3 x 6mm screws which
pass up through the upper pair of 3mm
holes that were originally provided to
secure the DB-9 connector (CON1) –
see photos.
The three leads from the add-on
board can now be fed to the rear of
the main board and connected to the
Parts List
1 PC board, code 04208091, 36
x 19mm
2 M3 x 10mm tapped spacers
4 M3 x 6mm machine screws
1 light dependant resistor (LDR1)
3 80mm lengths of light-duty
hookup wire
Semiconductors
1 BC548 NPN transistor (Q1)
1 BC558 PNP transistor (Q2)
Capacitors
1 100nF MKT metallised polyester
Resistors (0.25W 1%)
1 150kΩ
1 2.2kΩ
1 10kΩ
appropriate points underneath. As
shown in Fig.3, the +5V lead goes to
the +5V supply rail near the output
pin of REG1, while the ground wire
goes to the earth copper at what was
originally pin 5 of CON1.
The third centre wire (AN5) goes
The autodim board is mounted on two
M3 x 10mm tapped spacers. These are
attached to the main board using the
holes originally provided to secure the
DB-9 connector.
to pin 8 of the display’s PIC16F877A
micro (IC1). This pin was not used in
the original “non-dimming” version.
Once these three connections have
been made, you can slip the finished
board assembly back into the enclosure and fasten it in place. All that
now remains is to download the new
version of the GPS Time Display firmware (0410509B.hex) from the SILICON
CHIP website and reprogram the PIC
micro so that it knows how to monitor
the LDR voltage and vary the display
brightness accordingly.
Note that the add-on board by itself won’t give you the autodimming
function unless you use the revised
firmware in your PIC.
The updated firmware now replaces
the original program whether or not
you have the add-on board. However,
if you don’t have the add-on board,
you must now connect pin 8 of IC1
to the adjacent +5V supply rail via a
2.2kΩ resistor.
This is necessary to give the PIC’s
AN5 input a de-facto “bright sun”
input voltage level in the absence of
the LDR sensor board.
That’s it! With the add-on LDR sensor board and the modified firmware
running inside the PIC, your GPS Time
Display will now be able to adjust its
brightness according to the ambient
SC
light level.
Issues Getting Dog-Eared?
Keep your copies safe with these handy binders.
REAL
VALUE
AT
$14.95
PLUS P
&
P
Available Aust, only. Price: $A14.95 plus $10.00 p&p per order (includes GST). Just
fill in and mail the handy order form in this issue; or fax (02) 9939 2648; or call (02)
9939 3295 and quote your credit card number.
siliconchip.com.au
September 2009 77
|