This is only a preview of the January 2009 issue of Silicon Chip. You can view 31 of the 96 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 "USB-Sensing Mains Power Switch":
Items relevant to "Remote Mains Relay Mk.2":
Items relevant to "Multi-Purpose Car Scrolling Display, Pt.2":
Items relevant to "433MHz UHF Remote Switch":
Purchase a printed copy of this issue for $10.00. |
Pt.2: By MAURO GRASSI
Multi-Purpose
Car Scrolling Display
Construction & software installation
In this month’s article, we guide you through
the construction of the Car Scrolling Display.
We also show you how to install the software
driver that’s used to communicate with the
display via a USB port on a Windows PC.
A
LL THE PARTS for the Car
Scrolling Display are installed
on two PC boards – a main board
coded 05101091 (134 x 86mm) and a
display board coded 05101092 (124 x
75mm). These two boards are stacked
together with a red Perspex window
and are secured using Nylon spacers,
62 Silicon Chip
washers and screws. Note that there
is no wiring between the two boards.
The display board simply plugs into
the main board via connector CON6.
Note also that the display board is
smaller than the main board. That’s
been done so that when the two
boards are stacked together, the screw
terminal blocks on the main board are
exposed for easy access.
Main board assembly
Fig.6 shows the assembly details for
the main board. Begin by checking the
board for cracks in the tracks or any
shorts between adjacent tracks. This is
easier to do before installing the parts
and can save you trouble later.
Once you are convinced that the
PC board is OK, start the assembly by
soldering in the 10 wire links. You
must do this first, as two of these links
(LK5 & LK6) are underneath the 40-pin
IC socket.
These links should be installed
siliconchip.com.au
3
2
1
2
3
6
1
5
4
2
3
1
1 F
+
33k
4004
10k
10k
4004
33k
Q18
+
ZD1
4004
16V
REG1
LM2940
100nF
LK4
LK2
470 F
D6
100nF
100nF
47 F
D1
10k
10k
10k
1k
1k
D5
1k
Q19
22pF
10nF
1k
10k
10k
1k
10nF
100nF
1 F
LK3
LK8
LK5
LK6
X1
22pF
1
8002/90 GM DRAOB NIAM .PSID RAC
10
11
12
13
14
15
17
LK9 18
19
20
21
22
23
24
25
26
27
1
2
3
4
5
6
7
8
9
D4
100nF
Q16
10 1W
8002 PIHC NOCILIS
19010150
CON5
100nF
LK1
220 F
+
D2
10k
IC1
PIC18F4550
D3
22k
22k
22k
22k
LK10
10k
56k
4004
Q17
2
D7
4148
100nF
+
CON4
4
1 2 3 4 5 6
LK7
1
3
CON3
16
1.5k
10k
CON2
5819
CON1
CON6
+
4
4004
Fig.6: follow this parts
layout diagram to build
the main PC board.
Take care to ensure
that all polarised parts
go in correctly and
don’t install the PIC
microcontroller in its
socket until after the
power supply has been
checked – see text.
This view shows the fully assembled main board. Note
that the five electrolytic capacitors are all mounted with
their bodies parallel to the board surface.
using tinned copper wire. You can
straighten this link wire by first clamping one end in a vise and then pulling
on the other end with pliers to stretch
the wire slightly. After that, it’s simply
a matter of cutting the links to length
and using pliers to bend their leads
down at right angles so that they fit
the PC board.
There are 24 resistors on the main
PC board and they can be soldered
in next. You must make sure that the
siliconchip.com.au
correct value is used at each location. The colour code table shows
how to decipher the values but it is
also prudent to check each one with
a multimeter before it is soldered in
place. Note that the 10Ω resistor must
be rated at 1W.
Once the resistors are in, the diodes
can be installed. There are eight diodes
in total, of four different types.
Begin by installing 16V zener diode
ZD1. Refer to the component overlay
for its location and orientation! Remember that the cathode of a diode is
normally indicated by a stripe.
The signal diode (D7, a 1N4148)
is used for ICSP (In Circuit Serial
Programming) and is installed near
CON6 (the ICSP header). You only
really need it if you intend to program
the microcontroller (IC1) in circuit,
otherwise it can be left out.
Diodes D5 & D6 are next on the list.
Note that these were shown as 1N5819
January 2009 63
Q15
680
Q13
680
680
Q12
Q10
1
680
YALPSID RAC
680
Q8
Q7
TA12-11EWA
LK16
1
680
680
Q5
Q3
29010150
USB TYPE B
TA12-11EWA
LK10
680
680
LK2
+
470 F
LDR
LK17
LK7
TA12-11EWA
1
2
1
3
4
11
12
13
14
15
SOCKET (VERT) 21
22
23
24
25
26
27
1k
680
TO S1
LK14
1k
LK21
1
2 /90
3
8002
4
5 GM
6
7
82k
LED ARRAY 3
LK13
LK8
LK19
680
680
680
680
3.3
680
LED ARRAY 2
LK9
LK15
Q14
Q9
Q6
Q4
Q1
LK4
LK3
LK18
LED ARRAY 1
LK5
LK6
LK1
IC3 ULN2003
LK12
LK11
Q2
IC2 74HC595
100nF
Q11
LK20
16
17
18
19
20
CS
Fig.7: here’s how to install the parts on the
display board.
This is the completed display
board. Make sure that the LED
arrays are correctly oriented.
Schottky types on the circuit diagram
(Fig.3) last month but in practice,
1N4004 diodes will do and that’s what
are now specified in the parts list. Be
sure to install them with the correct
orientation.
By contrast, diode D4 must be a
1N5819 Schottky type (as originally
specified). This can now be installed,
followed by the five remaining diodes
which are all 1N4004s.
The four transistors can now all go
in. These are all BC337 NPN types
and each must be correctly oriented,
as shown in Fig.6.
Now for the capacitors. The ceramic
and the 100nF monolithic capacitors
64 Silicon Chip
are not polarised and can go in either
way around. However, the electrolytic
capacitors are polarised, so be sure
to install them as indicated on the
overlay.
Note particularly that all the electrolytic capacitors must have their
leads bent by 90° so that their bodies
lie horizontally on the PC board – see
photo. Do not mount them vertically;
if you do, they will later interfere with
the bottom of the display board when
the boards are stacked together.
Once you’ve installed the capacitors, you are ready to install the connectors and the IC socket. Install the
40-pin IC socket first, making sure
Above right: the completed display
board with two of the LED arrays
removed to show their 7-pin socket
strips.
that it is oriented correctly with its
notched end as indicated. Note that
the IC is not installed in the socket just
yet. That step comes later, after some
preliminary checks of the supply rail.
Install the right-angled 6-pin ICSP
header (CON5) only if you intend
to program the microcontroller.
Note that you will need to cut
away the plastic locating guide
on this connector if you intend
to use the PicKit2 programmer
from Microchip. In addition, CON5
should be mounted about 2mm above
the PC board in order to fit the PicKit2
programmer.
The rest of the connectors are screw
terminal blocks CON1-CON4. These
consist of 2-terminal and 3-terminal
blocks which are combined by sliding
their dovetailed ends together.
As shown, CON1 & CON4 are each
made by sliding two 2-terminal connectors together, while CON3 consists
of two 3-terminal connectors. CON2 is
a single 3-terminal connector.
Making up CON6
CON6, a 27-way connector, is made
by first cutting a 40-pin IC socket
into two 20-pin sockets. You can use
a small fine-toothed hacksaw to do
this job.
As shown on Fig.6, CON6 is split
into three parts. The first is a 14-pin
connector, the second is a 5-pin connector and the last is a 7-pin connecsiliconchip.com.au
Follow this photo in conjunction with Fig.7 when installing the parts on the
display board. Note that pin 1 of each LED array goes to lower left.
tor (note: pin 15 is not used). You
make these by first cutting one 20pin connector into 14-pin and 5-pin
connectors. The 7-pin connector is
then cut from the remaining 20-pin
connector.
Regulator REG1 can go in next. As
shown, this device is mounted horizontally with its leads bent down by
90°, to go through their matching PC
board holes. In addition, the regulator
must be fitted with a small U-shaped
heatsink and this is sandwiched between the regulator’s tab and the PC
board.
Secure this assembly to the PC
board using an M3 x 10mm screw,
lockwasher and nut before soldering
the regulator’s leads. If you solder the
leads first, the soldered joints may
crack as the mounting screw is tightened down.
Note that we specified an
LM2940CT-5 low drop-out regulator
in the schematic (Fig.3) published last
month. However, you can also use a
common (and much cheaper) 7805
regulator in its place, if you wish.
The only drawback here is that
using the 7805 means that you will
have to power the circuit from a 12V
supply. By contrast, the LM2940CT-5
will work with supply voltages down
to as low as 9V.
The LM2940CT-5 also contains inbuilt reverse polarity protection but
we don’t use it in this circuit. That’s
because reverse polarity protection is
provided by diode D1.
Construction of the main PC board
can now be completed by installing
the 20MHz crystal. It’s non-polarised
and so can go in either way around.
Display board assembly
Fig.7 shows the parts layout on the
display board. Begin the assembly
by installing the 21 wire links (LK1LK21). Some of these links are quite
long and run close together, so it’s
important that they be straight before
they are installed (stretch the link wire
to straighten it).
The resistors can go in next. Note
that the 3.3Ω resistor must be rated
at 0.5W, while the others are all rated
at 0.25W.
Now solder in the two 16-pin IC
sockets. These must be oriented with
their notched ends as shown on Fig.7.
Table 1: Resistor Colour Codes
o
o
o
o
o
o
o
o
o
o
o
siliconchip.com.au
No.
1
1
4
2
10
6
15
2
1
1
Value
82kΩ
56kΩ
22kΩ
33kΩ
10kΩ
1.5kΩ
680Ω
330Ω
10Ω
3.3Ω
4-Band Code (1%)
grey red orange brown
green blue orange brown
red red orange brown
orange orange orange brown
brown black orange brown
brown green red brown
blue grey brown brown
orange orange brown brown
brown black black brown
orange orange gold brown
5-Band Code (1%)
grey red black red brown
green blue black red brown
red red black red brown
orange orange black red brown
brown black black red brown
brown green black brown brown
blue grey black black brown
orange orange black black brown
brown black black gold brown
orange orange black silver brown
January 2009 65
A
113.25
A
HOLES A: 3.0mm DIAMETER
25
23.5
13mm DIAMETER
HOLE FOR PUSH
BUTTON SWITCH
75
Preparing the front panel
64.8
17
13 x 13mm
CUTOUT FOR
USB SOCKET
MATERIAL: 3mm THICK RED
PERSPEX SHEET
21
113.25
A
A
124
Fig.8: follow this drilling and cutting diagram to make the front panel. It’s made
from 3mm-thick red Perspex measuring 124 x 75mm.
Note that although these sockets are
optional, we do recommend them.
They make it much easier to replace
the ICs, if necessary.
The next step is to install six 7-pin
socket strips to accept the dot-matrix
LED arrays. These are made by cutting
three 14-pin IC sockets in half and then
cleaning up the edges using a small
file. That done, the sockets strips can
be soldered in place.
These sockets are used simply to
space the LED arrays off the board,
so that they later sit close to the red
Perspex front panel. They also make
it easier to replace a module in the
unlikely event that it fails.
You can now install the two ICs in
their sockets, making sure they are correctly oriented. Don’t get these two ICs
mixed up – IC2 is the 74HC595 shift
register, while IC3 is the ULN2003
Darlington array.
The three LED modules can also be
installed in their sockets, each with
pin 1 at bottom left. Pin 1 of each
module is indicated by a digit on the
side.
Once this is done, you can solder
in the 15 BC327 transistors. Be sure to
orient them as shown and push them
down onto the board as far as they
will comfortably go before soldering
their leads.
Next, solder the two capacitors in
place. The 100nF monolithic type is
not polarised but the 470μF electrolytic is so take care when installing it.
The three pin connector strips that
make up CON7 can now be installed.
These are made from a 32-way strip
that’s cut into three pieces of 14, 7 &
5 pins. As shown in the photo, these
are installed from the component side
of the PC board.
Now install the USB type B socket.
It sits vertically on the PC board and
only fits one way around. Its two tabs
can be bent flat against the underside
of the board to secure it in position
before soldering. Solder its four pins
and both tabs to the PC board.
M3 x 25mm NYLON SCREWS
M3 NYLON SPACER
12mm LONG
M3 NYLON FLAT WASHERS
(RED PERSPEX FRONT PANEL)
M3 NYLON SPACER
12mm LONG
(DISPLAY BOARD)
M3 NYLON FLAT WASHERS
M3 NYLON SPACER
12mm LONG
(MAIN BOARD)
The last thing to do is to solder in the
LDR. This should be installed about
10mm above the PC board, so that it
later sits just below the front panel.
That completes the assembly of the
two PC boards. The next step is to
make the front panel.
M3 NYLON SPACER
12mm LONG
The front panel is made from a
single piece of red Perspex measuring
124 x 75mm (ie, the same dimensions
as the display board). Fig.8 shows the
cutting and drilling details. There are
four 3mm-diameter holes for securing
it to the display board plus a larger
(13mm) hole for pushbutton switch S1.
In addition, you need to make a
square cut-out to provide access to
the USB socket.
Once you’ve cut and drilled the
panel, fit the pushbutton switch in
place and wire it back to the display
board using two 60mm lengths of
hook-up wire. The front panel is then
fitted with four M3 x 12mm tapped Nylon spacers plus four Nylon washers
which are secured using M3 x 25mm
Nylon screws – see Fig.9.
The display board can now be fitted
in position over the Nylon screws.
Another four Nylon washers are then
fitted, after which another four M3 x
12mm Nylon spacers are wound on.
Preliminary tests
Before attaching the main board,
it’s a good idea to carry out a power
supply check, to confirm that the +5V
supply rail is correct. Note that this
should be done with microcontroller
IC1 out of its socket.
First, connect a 12V battery to the
power input terminals of CON1 (pin
4 is the +12V input, pins 2 & 3 are
ground). Apply power and check the
voltage at pin 1 of CON3. If it’s close
to +5V, then everything is in order.
Note that this voltage can normally
range from 4.9-5.1V. A voltage above
Fig.9: the two PC
boards and the front
panel are secured
together using M3 x
12mm tapped Nylon
spacers, M3 Nylon
washers and M3 Nylon
screws.
M3 x 6mm NYLON SCREWS
66 Silicon Chip
siliconchip.com.au
The display board/front panel assembly plugs into the main board and is secured using four M3 x 6mm Nylon screws.
Take care to ensure that the regulator heatsink clears the underside of the display board.
6V or lower than 4.5V indicates that
there is a problem and you should
disconnect power immediately.
Assuming that the +5V rail measures
OK, you can now disconnect power
and install IC1 in its socket. Note that
this IC must be programmed with the
firmware hex file. If you are building
this project from a kit, it will be supplied preprogrammed.
Final assembly
Having checked that the +5V rail is
OK, it’s time to complete the assembly.
This simply involves plugging the
display board into the main board and
then securing the assembly using four
M3 x 6mm Nylon screws.
Switch on
Once the assembly has been comsiliconchip.com.au
The Software Features In Brief
In next month’s article, we explain the software features in detail. In the meantime, here’s a
quick summary.
First, the software calibration allows you to read almost any sensor with a varying voltage,
resistance, frequency or duty cycle output. Calibration involves entering a few calibration points.
The software then computes a polynomial which passes through these points and that’s stored
in non-volatile memory.
You can therefore use this project as a “speedo corrector”, by calibrating the variable to read
the correct speed (note: car speedos often intentionally read high). You can measure the output of
a resistance-based sensor directly (without a voltage divider). We’ve held the calibration instructions over to next month’s article, as they were too long to include here!
Once calibrated, you can name the variables and enter the units, as well as minimum and
maximum values. You can choose which to display and in what order, as well as the number of
digits after the decimal point. You can select optional averaging on each variable and the speed
of scrolling and the brightness of the display.
Each of the six variables has an accumulator (for running totals) as well as delta values (showing
the difference in the readings). There are also two programmable outputs (for a relay or buzzer)
that can switch on limit conditions.
You can do real-time data logging of the variables via the USB port (with selectable sampling
frequency) and the data can be exported to a spreadsheet to create graphs.
Other features include protection for the battery supplying power (if used in a car) and fine
tuning options for greater accuracy! All will be explained, next month.
January 2009 67
Parts List
Main Board
1 PC board, code 05101091,
134 x 86mm
2 40-pin IC sockets
4 2-way screw terminal blocks,
5mm spacing (Jaycar HM3173, Altronics P-2032A)
3 3-way screw terminal blocks,
5mm spacing (Jaycar HM3172, Altronics P-2033A)
1 TO-220 mini heatsink, 6073B
type (Jaycar HH-8502,
Altronics H-0630)
1 6-way 2.54mm right-angle
locking header (Jaycar HM3426; Altronics P-5516) –
optional for ICSP
1 20MHz crystal (X1)
Semiconductors
1 LM2940CT-5 regulator (REG1)
(or use a 7805 – see text)
1 PIC18F4550/I-P microcontroller
(programmed with 0510109A.
hex (IC1)
4 BC337 NPN transistors (Q16Q19)
5 1N4004 diodes (D1-D3, D5-D6)
1 1N5819 Schottky diode (D4)
1 1N4148 diode (D7) – only
needed for ICSP
1 16V 1W zener diode (ZD1)
Capacitors
1 470μF 25V electrolytic
1 220μF 50V electrolytic
1 47μF 16V electrolytic
2 1μF 16V electrolytic
7 100nF monolithic (code 104 or
100n)
2 10nF MKT (code 103 or 10n)
2 22pF ceramic
Resistors (0.25W, 1%)
1 56kΩ
10 10kΩ
4 22kΩ
6 1.5kΩ
2 33kΩ
1 10Ω 1W
pleted, apply power (ie, via CON1).
You should now see a message scroll
past on the LED display modules.
Among other things, this default wel
come message should show the firm
ware version.
If you see this, then everything is
working correctly and you can proceed
to the next section which explains
how to install the software driver on
68 Silicon Chip
Display Board
1 PC board, code 05101092,
124 x 75mm
3 Kingbright TA12-11EWA dot
matrix LED modules, red
(Tenrod Cat. TA12-11EWA,
Farnell Cat. 1168665)
3 14-pin IC sockets (cut into six
7-pin sockets to mount the
displays)
2 16-pin IC sockets
1 SPST dome pushbutton switch
(Jaycar SP-0657, Altronics
S-1084)
1 32-way IC socket strip (Jaycar
PI-6470, Altronics W-0420)
1 LDR (Jaycar RD-3480,
Altronics Z-1619)
1 vertical USB Type B socket
(Farnell 107-6666)
Semiconductors
1 74HC595 shift register (IC2)
1 ULN2003 line driver (IC3)
15 BC327 PNP transistors
(Q1-Q15)
Capacitors
1 470μF 16V electrolytic
1 100nF monolithic
Resistors (0.25W, 1%)
1 82kΩ
2 330Ω
15 690Ω
1 3.3Ω 0.5W
Miscellaneous
4 M3 x 25mm Nylon screws
(Jaycar HP-0142)
8 M3 x 12mm tapped Nylon
spacers
8 Nylon flat washers (Jaycar
HP-0148)
4 M3 x 6mm Nylon screws
1 1m length of tinned copper
wire for links
1 200mm length medium-duty
hook-up wire
your PC. If not, you should refer to the
troubleshooting panel.
Driver installation
The USB device interface for the
Car Scrolling Display uses the generic
Microchip driver for Windows. Before
communicating with the display using
the PC host program, you will need
to install this driver. This section
explains how to install the driver in
Windows XP, although other versions
of Windows will be similar.
The first step is to download the
Microchip installer (MCHPFSUSB_
Setup_v1.3.exe) from the S ILICON
CHIP website and run it. Note that
you should use version 1.3 as older
or newer versions may not be compatible. The installer program will
typically put the driver in the C:\
MCHPFUSB\Pc\MCHPUSB Driver\
Release folder.
Next, connect the Car Scrolling
Display to your computer using a
USB cable. Windows will recognise
the device as a “Display” and then the
“Found New Hardware” Window will
appear as shown in Fig.10. Select the
“No, not this time” option and click
“Next”.
You will now be presented with a
new dialog window. Select “Install
from a list or specific location” and
click “Next” again to bring up the dialog shown in Fig.11. Select “Search
for the best driver in these locations”
and enable the “Include this location
in the search” box.
Now click the “Browse” button. In
the “Locate File” window that appears,
navigate to where the MCHPUSB
files were installed (normally C:\
MCHPFUSB\Pc\MCHPUSB Driver\
Release) and select “mchpusb.inf”.
Click “Next” and Windows will then
install the driver.
If the driver is installed correctly,
the “Microchip Custom USB Device”
entry should now be visible if you go
into Device Manager (Control Panel
->System -> Hardware tab -> Device
Manager button) – see Fig.12 (provided
the device is connected).
Using the host software
Once the driver has been installed
successfully, you control the Car
Scrolling Display using the PC host
program cardisplay.exe. This program
allows you to change all settings and
to do data logging. It is also used for
calibration.
Once you’ve connected the Car
Scrolling Display’s inputs to the sensors you are interested in monitoring,
you can then use a laptop in your car to
perform the calibration (you only have
to do this once) or change any other
system settings (such as the display
brightness, etc).
You can also use a laptop in your
car to do real time data logging of
siliconchip.com.au
Fig.10: this is the dialog that appears the first time the
Car Scrolling Display is connected to the PC. Select the
option shown and click the “Next” button.
Fig.11: selecting “Install from a list or specific location”
brings up this dialog. Select the options shown and click
the “Next” button. Windows then installs the driver.
Troubleshooting
Fig.12: this entry will appear in
Device Manager if the driver is
installed correctly.
the signals. Of course, you will need
someone else to do the driving while
you do this!
To install the PC host program, you
first have to download the compressed
file “cardisplay.zip” from the SILICON
CHIP website (www.siliconchip.com.
au). You’ll find it the downloads section under January 2009.
Extract the files in the zipped archive to a folder on your hard drive.
There should be at least two files:
(1) cardisplay.exe – this is the executable command line program; and
(2) cardisplay.map – this file is used
siliconchip.com.au
If the unit doesn’t work correctly, the following troubleshooting tips should
help resolve the problem.
Symptom: nothing is shown on the display or some columns or rows are
blanked out.
What To Check: there are a number of possibilities here. One is that CON6
and CON7, which connect the main PC board to the display PC board, are
not making good contact. Try reconnecting the two boards to see if that
clears the fault.
Another possibility is that the Kingbright LED array modules have been
installed with the incorrect orientation. If one column is blanked while the rest
of the display seems to be working, then check its driver transistor – it may
be faulty or it could be the wrong type (they should all be BC327 PNP types).
Symptom: the supply rail is not close to +5V.
What To Check: if the supply rail is 0V instead of +5V, check zener diode ZD1,
reverse polarity protection diode D1 and regulator REG1. Check particularly
that the diodes are all correctly oriented.
If the supply rail is noticeably higher than +5V, there is either a problem
with the regulator or a short between the 12V and 5V rails. Alternatively, a
component connected to one of these rails may have failed (eg, diode D2
or D3).
Symptom: the display seems to be working correctly but does not work when
powered solely from the USB port.
What To Check: either Schottky diode D4 is incorrectly oriented or the USB
port (or hub) is not supplying power.
internally by the host program. It must
be in the same folder as cardisplay.exe
for the program to recognise it.
Note that the map file is produced by
the C compiler of the firmware. It contains memory mapping information for
the firmware produced by the linker.
When and if the firmware is updated,
the map file will also change and this
new file must be copied to the folder
containing cardisplay.exe in order for
it to work correctly.
So installing the PC host program is
easy – just copy the cardisplay.exe and
cardisplay.map files to your chosen
folder. Once that’s done, you simply
go to a command prompt to run the
program using your chosen command
line option. We’ll have more to say
SC
about this next month.
January 2009 69
|