This is only a preview of the August 1998 issue of Silicon Chip. You can view 28 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:
Articles in this series:
Items relevant to "Build A Beat Triggered Strobe":
Articles in this series:
Items relevant to "15W/Channel Class-A Stereo Amplifier":
Purchase a printed copy of this issue for $10.00. |
By MARK ROBERTS
This easy-to-build
I/O card plugs into
the parallel port of
your PC. It features
11 analog inputs for
sampling, plus two
analog outputs and
eight digital outputs.
It’s software
controlled and can
automatically log
sampled data on the
analog input
channels to an Excel
spreadsheet.
Simple I/O card with
automatic data logging
T
HIS SIMPLE I/O CARD can be
used to sample incoming data
on up to 11 channels and/or
used to control other equipment via its
10 output lines. You can either switch
equipment on or off via the digital
output lines, or control equipment
using a variable 0-5V DC signal from
two separate analog outputs.
An on-screen “virtual” instrument
panel is used to drive the card – see
Fig.1. This display is software generated and its functions are easy to follow.
On the righthand side of the panel
are 10 analog input channels (Channels 1-5 and Channels 6-10), with each
channel showing the voltage applied
to it. The 11th analog input channel
is directly below Channels 1-5 and is
labelled “Battery Voltage”. The latter
can typically be used to monitor the
voltage from a real battery or simply
used as an extra input channel.
22 Silicon Chip
At the top left of the panel are eight
buttons labelled D0-D7. These are
used to turn the digital I/O lines on
or off. Only one output from D0-D3
can be on at the same time, while any
combination of buttons from D4-D7
Main Features
• 11
analog input channels (020V)
• 2 analog output channels (0-5V
nominal – see text)
• 8 digital output channels (open
collector)
• Analog inputs can be sampled
and automatically logged to an
Excel spreadsheet
• Logging interval can be set to
10 seconds, 1 minute, 10 minutes
or 60 minutes
can be turned on at once. When an
output is turned on, the indicator
light below its button “lights” up.
Red indicators are used for outputs
D0-D3, while yellow indicators are
used for D4-D7.
Fig.1 shows how the panel appears
with outputs D1, D4, D5 and D7
turned on. It also shows that voltages
of 6.45V, 6.36V and 7.82V have been
applied to input channels 3, 7 and 9
respectively, while a voltage of 6.27V
has been applied to the 11th (Battery
Voltage) input.
Immediately below the digital
output buttons are two large analog
voltmeters. These show the voltage on
each of the two analog outputs. You
can easily vary these outputs over the
range 0-5V DC by dragging the two
slider controls (note: the maximum
output voltage depends on the supply
voltage from the parallel port).
parallel port. The converted digital
data is then clocked out from the
DOUT pin (pin 16) and applied to pin
13 of the port.
The clock signal comes from pin
6 of the parallel port and is applied
to pin 18 of IC4 (I/O-CK). This clock
signal is also applied to the SCLK
(pin 2) inputs of ICs 5 & 6 and to the
SRCLK input of IC2.
ICs 5 & 6 are MAX515 10-bit A/D
converters and these are used to provide the two 0-5V (nominal) analog
outputs. As shown in Fig.3, their data
inputs (DIN) are tied together and the
data clocked in via pin 5 of the parallel
port. Pins 7 and 8 of the parallel port
control the CS (chip select) inputs
(pin 3) of ICs 5 & 6, so that only IC is
active at any given time.
The MAX515 is programmed by
Fig.1: the I/O card is controlled using this virtual instrument panel which is
writing 16 bits of serial data, clocked
generated by the software. It shows the voltages present on the analog inputs
in the following order: four dummy
and lets you control the analog and digital output channels.
bits, 10 data bits and two sub-LSB
zeros. The data is clocked in on the
The only other feature of real note
tors and the sampled signals are then
SCLK rising edge while the CS signal
on the main panel is the “Logging” applied to the A0-A10 inputs of IC4
on pin 3 is low and held in a 16function (in the top lefthand corner).
for A/D conversion.
bit serial register. This data is then
Clicking this function brings up the
The signal on pin 17 (Address) of transferred to the DAC register when
dialog box shown in Fig.5, so that IC4 (applied from pin 3 of the parallel
CS goes high to update the output
you can automatically log sampled port) selects the input voltage to be voltage.
data into an Excel spreadsheet. Of
converted. The EOC (end of converThe maximum output from each
course, you must have Excel on your sion) output at pin 19 then goes low MAX515 is Vcc-0.4V (Vcc is the voltcomputer in order to do this.
when conversion is completed and age from the parallel port). This means
Once the data has been logged in,
this signals the PC via pin 10 of the that if the computer supplies 5V, then
you can then use Excel to produce
the maximum analog output will
graphs or charts in the usual manner.
be 4.6V. REF1, an LM385-2.5Z
You can sample the incoming data
voltage reference diode, supplies
(0-20V) on the 11 analog inputs at
a 2.5V reference to the REFIN
10-second, 1-minute, 10-minute or
(pin 6) input of both ICs, giving
60-minute intervals just by clicking
a resolution of about 2.5mV for
the appro
priate button. We’ll have
the two analog outputs.
more to say about logging to an Excel
Note that the MAX515 DACs
spreadsheet a little later on.
will not operate if the voltage
from the parallel port is down
How it works
around 3V – see panel.
Now take a look at the circuit – see
ICs 2 & 3 provide the digital
Fig.3. The circuit uses six ICs plus a
outputs. IC2 is a 74HC595 8-bit
2.5V voltage reference and not much
serial in/parallel out shift regiselse.
ter. The data comes in on pin 14
The four main ICs in the line-up
(SER) and is clocked into a D-type
are a 74HC595 shift reg
ister (IC2),
storage register when RCLK (pin
an MC145041 8-bit A/D converter
12) goes high. The data on the E
(IC4) and two MAX515 10-bit D/A
(enabled) pin determines which
converters (IC5 & IC6). Each of these
register is being updated.
main blocks is controlled via a 3-wire
The eight outputs from shift
serial interface that’s compatible with
register IC2 directly drive IC3
SPI, QSPI and Microwire standards.
which is a ULN2803 Darlington
IC4 is used to sample and digitTransistor Array. This device has
ise the data on the 11 analog input Fig.2: this block diagram shows the main
open collector outputs and these
channels (Ch1-Ch10 and Batt). Each circuit sections of the I/O Card. The card
can be used to drive LEDs, relays
input signal is fed to a voltage divider is controlled using software, with signals
or opto-couplers, to control other
consisting of 330kΩ and 39kΩ resis- sent via the PC’s parallel port.
circuits. The maximum voltage
August 1998 23
Fig.3: the circuit uses six ICs, with each of the main blocks controlled via a
3-wire serial interface. IC4 performs A/D conversion for the analog inputs, while
D/A converters ICs 5 & 6 provide the two analog outputs. ICs 2 & 3 provide the
eight open-collector digital outputs which can be used to drive relays or LEDs.
that can be switched by the open
collector outputs is 30V.
IC1 doesn’t really play any role in
the circuit operation as such. This
device is a Dallas Semiconductor DS
24 Silicon Chip
2401 Silicon Serial Number. It comes
in a standard TO-92 package but only
two of its pins (Data and GND) are
used. Each of these devices comes
with a unique registration number
and this number is read by the software via pin 15 of the parallel port.
If the number matches the number
programmed into the software, the
software functions normally. If they
don’t match, a demonstration version
of the software is loaded instead.
This means that the software supplied with each individual DS2401
Fig.4: follow this
parts layout diagram
to assemble the PC
board. As shown
here, IC3 is driving
eight LEDs but you
can easily modify the
circuit to drive relays
or optocouplers.
is tailored to match that device. The
same software will not work with other hardware because the code number
will be different.
Power for the circuit is derived
from pin 9 of the parallel port which
supplies a +5V rail. This means that
no external power supply is required.
Construction
All the parts, including the DB25M
connector, are installed on a small PC
board measuring 76 x 68mm. Fig.4
shows the assembly details.
Begin the assembly by installing PC
stakes at the external wiring positions
(ie, at the analog inputs, at the outputs
and at the GND positions). This done,
install the 10 wire links, noting that
three of these links (shown dotted) are
under ICs 2, 5 & 6. The resistors and
the capacitors can go in next. Take
care to ensure that the two 100µF
electrolytics are installed with the
correct polarity.
Note that our prototype shows the
eight digital outputs driving eight
LEDs via 2.2kΩ resistors. This is also
shown on the layout diagram (Fig.4).
If you want to drive relays or optocou
plers, the output circuit should be
modified accordingly. For example, a
relay can be driven by connecting it
directly to an output of IC3 as shown
on Fig.3.
The six ICs (including the DS2401)
can go in next, followed by the LM385
2.5V voltage reference diode. Note
that the DS2401 and the reference
diode both look the same, so be careful
not to get them mixed up.
Finally, complete the assembly
by installing the DB25M connector.
Check that this part lies flat against
the PC board before soldering its pins.
Go over your work and check the PC
board carefully for mistakes before
connecting the unit to a computer,
ready for testing. You can either plug
the unit directly into the parallel port
or connect it via a DB25 male-tofemale cable.
Installing the software
The software comes on two floppy
discs and runs under Windows 3.1x,
Windows 95 and Windows NT. You
install it by running setup.exe on the
first disc and then following a few onscreen instructions. In Windows 95,
for example, you click Start, Run and
then type A:\setup.exe in the space
provided (assuming that the floppy
No Analog Output?
The MAX515 10-bit D/A converters specified will not work if
the voltage from the parallel port
is down around 3V. If that happens,
there will be no voltage on the
analog outputs, regardless of the
slider settings.
There are two ways around this
problem:
(1) Use the optional LPT2 card
from Softmark (this card supplies
about 4.95V); or
(2) Use an external 5V DC power
supply to power the circuit. If you
choose this option, remove link
LK2 and connect the external +5V
rail to the vacant pad next to IC2.
disc is in the A: drive). The installer
program creates the appropriate program group and installs a shortcut in
the Start menu.
In Windows 3.1x, you click File,
Run and type A:\setup.exe.
When you boot the software, it first
opens a dialog box that lets you select
between two printer ports (LPT1 and
LPT2). LPT2 is the initial default but
most users will need to select LPT1
since they will only have one parallel
port on their computer. You then click
OK to bring up the instrument panel
shown in Fig.1.
Initially, all the displays will be
off, since the Power is off. You turn
the display on by clicking the Power
button.
Parts List
1 PC board, 76 x 68mm
1 PC-mount DB25M connector
1 2-disc software package
4 PC stakes
Semiconductors
1 DS2401 silicon serial number
(IC1)
1 74HC595 8-bit shift register
(IC2)
1 ULN2803 Darlington transistor
array (IC3)
1 MC145041 8-bit A/D converter
(IC4)
2 MAX515 10-bit D/A converters
(IC5 & IC6)
1 LM385-2.5Z 2.5V reference
(REF1)
Capacitors
2 100µF 16VW PC electrolytics
2 0.1µF monolithic
Resistors (0.25W, 1%)
11 330kΩ
9 2.2kΩ (see text)
11 39kΩ
1 120Ω
By the way, once you’ve selected a
port, it can be saved as the default by
clicking the Power button to off (this
rewrites the io.ini file). The software
will now always boot with the new
port as the default, unless you change
it again.
Testing
It’s now just a matter of checking
that everything works. To do this, first
August 1998 25
Fig.5: clicking “Logging” on the virtual
instrument panel brings up the Logging
System I/O Interface shown at right. This
lets you select the logging interval, after
which you can automatically log to an
Excel spreadsheet as shown above.
connect a voltmeter to each analog
output in turn (ie, between the output
and GND) and check that the output
voltage can be varied from 0-5V (nominal) as you drag the slider under the
corresponding meter.
The eight digital outputs can now
be checked. Each output should initially be high and should go low when
its corresponding button is clicked
on the instrument panel to turn it on.
Note that because the digital outputs are open collector outputs, you
will need to connect a load to test
them; eg, a relay or a LED in series
with a 2.2kΩ resistor. Don’t forget the
wire a diode across the relay coil as
shown in the circuit, to quench the
back EMF generated when the relay
turns off. If you don’t do this, you
Where To Buy Parts
Parts for this design are available from Softmark, PO Box 1609, Hornsby,
NSW 2077 (phone/fax 02 9482 1565). Prices are as follows:
Hardware
MAX515 10-bit D/A converter ..............................................................$8
MC145041 8-bit A/D converter ............................................................$5
ULN2803 transistor array .....................................................................$4
74HC595 8-bit shift register .................................................................$3
LM385-2.5Z reference diode ................................................................$1
DB25M connector ................................................................................$2
PC board ............................................................................................$10
Full kit (hardware only) .......................................................................$40
Optional LPT2 card ............................................................................$15
Software (two discs) plus DS2401
Version 2.0 with logging .....................................................................$32
Version 1.0 without logging ................................................................$22
Payment by cheque or money order only. Please add $5 for postage. Note:
the software associated with this design is copyright to Softmark.
26 Silicon Chip
can destroy the switching transistors
in IC3.
If the circuit is working correctly,
then either the relay will turn on or a
LED will light when its corresponding
digital output is clicked on.
Now apply a voltage from 0-20V
to each of the analog inputs in turn
and check that the correct voltage is
displayed for each channel. If you
have a variable supply, check that the
reading varies as you vary the input
voltage.
To check the logging feature, click
Logging at the top left of the main
Window. The “I/O Interface - Logging
System” dialog box will now open
(see Fig.5) and you should be able to
start the automatic logging process by
selecting the “Logging Interval” and
clicking the On button.
Excel should now automatically be
launched and the sampled data automatically logged into the spreadsheet
at the selected time intervals (see
Fig.5). To stop the logging process,
click the Off button on the Logging
System dialog box. The program will
then instruct you to click the Save +
Exit button, after which you can save
the spreadsheet data in Excel to a file
and directory of your choosing. The
Logging System dialog box can now
be closed by clicking the Main Form
SC
button.
|