Back in the early days of the personal
computer revolution, TV and radio interviewers used to ask, 'What's it all
for?' One of the standard answers was, 'Well, we can run our central
heating with it'. Overall, it's likely the answer was designed to be
understandable to the non-technical, media-oriented audience - I doubt
that many people actually used their prototype machines to control their
central heating, and those that did probably froze to death the following
year. Over the years, personal computers got better and cheaper and took
up more sensible jobs such as pretending to be a typewriter or a simple
calculator. However, some people were still of the opinion that they could
do more. Clearly, the people at Pico were among them because they built
DrDAQ.
A PC can be programmed to make
measurements, analyse them and act on them. The problem is that a standard
PC has very few 'feelers' to the outside world - keyboard, mouse, that's
about it. The traditional solution is to add an analog-to-digital (AtoD)
converter. These tend to be expensive, and you usually have to open your
PC to add them. Even when you have an AtoD converter installed, your
troubles aren't over because you need sensors, which are expensive and
tricky. All in all, if you have ever considered using a PC to make
automatic measurements of anything, you have probably given up due to cost
and complexity.
Something that seems so simple in theory
soon becomes impractical when you look into it. This is where DrDAQ enters
and changes everything. DrDAQ is a low-cost AtoD converter with a range of
sensors built in. It is easy to install because it just plugs into a
parallel port, and it comes with all the software you need to get started.
If you do need external sensors, you will find that adding them is made as
easy as possible. There is even a limited output facility that you can use
to control things.
Control call

What could you use DrDAQ for? Well, if
you have ever considered a PC-based instrumentation project, you are
probably reviving your old ideas already. If not, all you have to do is
think about something you would like to measure or monitor on a long-term
basis. The most obvious application is in education. Take a PC, a portable
if you like; add a DrDAQ, and you have a computer-based lab. The good news
is that the PC doesn't even have to be a particularly good one. An
almost-scrap PC running Windows 3.x can be used, because DrDAQ comes with
Win16 and Win32 versions of the software. Using DrDAQ, you can automate
many chemistry, physics and biology experiments and, in doing so, you can
learn a lot about the instrumentation side of using a computer. Equally, a
class demonstration with the help of a DrDAQ-equipped PC is likely to be
more informative, having the ability to present graphs of what is going on
in real time.
When you move away from educational
applications, you will find that not every idea is suitable for a DrDAQ
setup. This is mainly because instrumentation applications quickly become
demanding in terms of the number of measurements per second, and the
quality and robustness of the sensors. For example, you might decide to
use DrDAQ to instrument the engine of your classic car, one that doesn't
already have a computer under the bonnet. In this case you would be able
to use DrDAQ, but the problem would be in buying or constructing suitable
sensors for carbon monoxide, RPM, oil pressure and so on. After solving
these problems, the cost of DrDAQ would be such a small part of the entire
project you'd probably settle on something more sophisticated.
DrDAQ is good at the smaller,
quick-to-lash-up-and-throw-away type of problem. If you wanted to know the
temperature range or the number of hours of sunlight in a particular spot
in your garden or greenhouse, DrDAQ would provide a quick and easy
solution.
DrDAQ is a neat printed circuit board
that is supplied without a case. The electronics are on the back of the
board; only the connectors and built-in sensors are found on the front.
The back is protected by a foam rubber sticker. If you plan to use DrDAQ
in a permanent installation, putting it in a box would be a good idea. As
far as connecting it to the PC goes, a standard parallel port is all that
is required. It doesn't have to be a bi-directional port - any parallel
port will do. A 25-pin D-type connector is used, and a printer cable is
supplied to connect DrDAQ to your PC. The only possible problem is if your
PC has a printer connected to its parallel port. DrDAQ doesn't share a
parallel port at all well. If it is necessary, installing a second
parallel port isn't expensive. You can't use a USB-provided parallel port
for DrDAQ, although one could be used for the printer to free up the
existing parallel port.
Sense and sensors built in

The unit comes with a microphone, a light
sensor and a temperature sensor built in and ready for measuring. A
four-way screw terminal connector provides additional inputs for voltage
and resistance measurements and a single digital output. The digital
output is a simple on/off output that works between 0V and 5V (for
example, with TTL). However, it is important to note that it can only
supply 1mA, so it needs an amplifier or relay to control anything in the
outside world. A small LED on the PCB is the only other output. At the
front of the board, two telephone-style connectors are used to connect
general external sensors. At the moment, only temperature sensors are
available but a humidity sensor will be available soon.
A BNC connector is also provided, so you
can connect a pH sensor. If you don't know what pH is, you probably won't
want to use one. Put simply, it measures acidity and alkalinity on a scale
of 0 to 14, with a pH of 7 being neutral. If you want to make use of DrDAQ
for chemistry or environmental measurements, a low-cost pH meter is a very
attractive option. A pH sensor is available from Pico and costs £35. This
means that a complete pH meter/data logging system can be bought for less
than £100, which compares well with other pH meters with a similar
resolution.
The entire range of sensors, and their
resolution and accuracy, can be seen in the table on page 420. As you can
see, it is reasonable for such a small, low-cost device. The final thing
you need to know is that DrDAQ can sample 15,000 readings per second, or
better, depending on the speed of the PC that accepts the data. Quite
reasonable, but not fast enough for many applications. For example, you
can use DrDAQ to sample sound waveforms but, with a sampling rate of
15KHz, the highest frequency you can work with is 8KHz. (As a rule, the
highest frequency is always half the sampling rate.) So if you attempt to
use DrDAQ for the digital input of speech or music, the quality would be
greatly reduced. A standard sound card would do this a lot better than
DrDAQ, anyway.
Installing DrDAQ is so simple as to
require little comment - just plug it in and it works. The software is
just as simple to install by using the floppy disks provided. These
install a driver for the parallel port, two pieces of applications
software and some programming examples.
The applications software is what really
makes DrDAQ value for money - you can download demo versions from the Pico
Web site. The star of the show is PicoScope, a software oscilloscope. This
probably isn't the software you'll be using for serious applications - for
that, you'll have to use PicoLog, a data logger, or write your own
software. However, it will probably be PicoScope that you use to get
started, and playing with it is great fun.
PicoScope

The first thing to say here is that PicoScope has all the outward
appearances of being an oscilloscope, and it has the same basic function,
but using it doesn't feel like using a real oscilloscope. Part of the
reason is that the feedback time is much longer. If you sit in front of a
real scope, you have almost instant feedback on the result of any
adjustment you make; getting it to lock and trigger the way you want it to
is a skill you learn by trial and error. I don't think you can learn the
same skill by playing with PicoScope, but you can discover what the
controls are all about.
When you start PicoScope, you will see
something similar to an oscilloscope display. By default, the first
channel is set to the sound sensor with time base and sensitivity set
correctly, so if you whistle you will see a rough sine wave. How rough
will depend on the quality of your whistle. This is a very good way of
finding out how the PicoScope works.
PicoScope simulates a four-channel scope,
and you can select any of the internal or external sensors to display on
any channel using the drop-down lists. You can also change the time base
by selecting from a drop-down list. You can set the trigger mode in the
same way. The trigger determines when the trace starts. Without a trigger,
even the simplest display on a real scope drifts and becomes difficult to
see - with it, the display is stable and you can see what you're looking
at. For one-off wave forms, you can capture transients by setting the
trigger to start the trace at a particular point on the wave form. This
works the same way in PicoScope, but you can also drag a small visual
indicator that sets the trigger voltage - in other words, the voltage that
the input has to reach before the trace starts. In addition, there is the
facility to freeze a trace by clicking on the Stop button in the lower
left-hand corner. Try this with a real oscilloscope and it won't work
unless you have a very expensive storage scope.
Other improvements over a real
oscilloscope include the ability to place horizontal and vertical lines on
the screen to specify measurement points. The values of x and y at
specific positions are displayed on the screen. You can also select
measurements you wish to be displayed, such as AC voltage, maximum,
minimum, frequency and mark space ratio. These can be based on the whole
displayed wave form or just a specified portion placed between markers.
The only problem was that if I selected the wrong scale, the program
crashed. There is also a facility to set alarms, which can be used to make
the PC go beep or stop the trace when the measured value goes out of the
set range.
Spectrum gadget

In addition to the software oscilloscope,
PicoScope has a software spectrum analyser built in. When you select
View,New Spectrum a new window opens and displays a frequency plot. The
analysis is performed for each scan of the oscilloscope, which effectively
gives you a real-time spectrum of the signals being displayed. By default,
the spectrum is computed for 256 frequencies from 0Hz (DC) to the maximum
that you have selected (up to 5KHz). If you want a more accurate spectrum,
you can select up to 4,096 but this takes more time and slows the display
down. Similarly, you can open more than one oscilloscope and spectrum
analyser, but this slows things down even more.
To give you some idea of how good DrDAQ
is, place it under an incandescent (not fluorescent) light - you can see
the 50Hz AC wave form. If you put this through the spectrum analyzer you
will get a peak at 100Hz, and you can spend a few minutes working out why.
What is even more surprising is that the same sensor can pick up the frame
rate of a TV monitor. If you hold it up to the PC's display, you can see
the brightness of the phosphor vary as the electron beam scans it. Use the
spectrum analyzer to see how fast the monitor refreshes. If you want to
record slowly varying data, a chart recorder is automatically selected
when you set a time base running slower then 500ms per division. Finally,
it is worth mentioning that you can open a standard voltage meter as a
separate window. There is also an XY scope which allows you to do things
like display Lissajous figures and phase plots.
You can save a configuration as a file or
add it as a menu option. To add a menu, you have to define a .ini file -
this gives the menu structure and the files to load if the menu option is
selected, allowing you to customize DrDAQ to a number of standard tasks
and select them from the menu as required.
What I found surprising about PicoScope
was the range of features that weren't well documented, if they were
documented at all. For example, you can save data to a disk file in text
format or as a .wmf format vector drawing of the display. You can also set
the trigger to save data to a file so that you can really capture
transients. What isn't made very clear is that you can do this using the
oscilloscope or the spectrum analyzer, so you can capture raw data or
frequency distributions. Even less well documented is the fact that you
can paste an active link using dynamic data exchange (DDE). DDE may be an
old technology but it is still supported, and it provides a way of making
an active link between an application such as a spreadsheet and the raw
data or spectrum. There is a brief example of how to program the DDE link
in Excel. Another example of poor documentation - you can define your own
sensor characteristics. A signal conditioner file is used, but the
documentation is missing.
PicoLog

The second significant piece of software
included with DrDAQ is PicoLog. In principle, data logging is easy: you
say what data input you want to record, and how often. In practice,
though, data logging software is often difficult to use. However, PicoLog
is both easy and surprisingly powerful. I say 'surprisingly' because its
user interface is small and looks unpromising. Its most powerful features
are also well hidden. For example, it can be used to log data over a
TCP/IP network. Simply start a copy running on one machine and set it as
the server, and start a copy running on another machine as the client.
Once both programs are running, the client displays the readings being
made on the server.
Using the PLW Recorder is easy. Simply
select the input channels you want to record and how often you want to
record them. When you press the record button, a file is created storing
the data as requested. You can re-record the data and view it using a
spreadsheet-style window or a chart. The chart can represent data plotted
against time or an XY plot. You can view the logged data on a chart.
You can include calculated parameters in
the data logging, such as power from voltage and resistance. An alarm can
be set on each channel. This can include a Holdoff parameter, which gives
the amount of time the value can be outside of its specified range before
the alarm is raised. If you want to record data automatically or at a
remote site, PicoLog is as good a way of doing it as any.
Programming

The supplied software is useful for
getting to know the hardware and for investigating how the data
acquisition works, but many users will want to write their own programs
where DrDAQ is just a part of the procedure. Using DrDAQ via a programming
language is very straightforward as long as the language can make DLL
calls. A functions library is supplied as Drdaq32.dll or Drdaq16.dll,
depending on which version of Windows you are running. Unfortunately,
there is no COM object or type library that can be used to control DrDAQ.
A module file is provided for Visual Basic that defines all the DLL
functions, and header and lib files are provided for C++. Examples and
definition files for Delphi, Excel, LabView and HP-Vee are included.
Essentially, any language that can call a DLL function can be used to
program DrDAQ.
The only problem is that the
documentation isn't extensive - you get an example to look at and then the
rest is up to you to work out. To make it easier, let's look at how you
would write a program in Visual Basic.
Basic training

Starting with a new .EXE project, load
the module picodriverswin32drdaq32.bas. Use the command Project,Add
Module. You also need to copy the DrDAQ32.dll to the WindowsSystem
directory. Before you can use DrDAQ its driver has to be opened using
drdaq_open_unit(port), which returns 1 if it was successful. When you have
finished, the driver using a drdaq_close_unit(port) call. If DrDAQ is on
LPT1 then the form load event can open it using something like:
Private Sub Form_Load()
Dim result As Integer
result = drdaq_open_unit(1)
If result <> 1 Then Stop
End Sub
The form's unload event handler can close
it again using:
Private Sub Form_Unload(Cancel As
Integer)
drdaq_close_unit (1)
End Sub
There is also a function:
drdaq_get_unit_info(string,length,line,port) which returns information in
the string concerning DrDAQ on the specified port. The string has to be a
fixed length, and you have to specify its length in the call. You can add
a button to the form and code its click event handler to get each line of
information - DrDAQ has four. Print them in the debug area:
Private Sub Command1_Click()
Dim i As Integer
Dim s As String * 255
Dim ret As Integer
For i = 0 To 4
s = ''
ret = drdaq_get_unit_info(s, 255, i, 1)
Debug.Print s
Next i
End Sub
Now we come to the question of how to
read the data from DrDAQ. The problem here is that the language in use
might be slow compared to the sampling rate that DrDAQ can manage. As long
as we only want to take readings at a rate within the scope of the
language, things are simple. There is a drdaq_get_value(channel) command
which returns the current reading of the selected channel as an integer.
This integer has to be scaled, but that's all there is to it.
To try this out, add a button and the
code:
Private Sub Command2_Click()
Dim value As Integer
value = drdaq_get_value(6)
Debug.Print value / 10
End Sub

The channel numbers correspond to the
channels as listed in the PicoScope and PicoLogger. Thus, channel six is
the internal temperature sensor. There are also function calls that return
information about the sensor, such as maximum and minimum values and
channel text. The drdaq_get_value_and_time function returns the precise
time at which the value was obtained.
The problems start when you want to read
data as fast as the input device can work. In this mode, you have to ask
it to take a set of readings at a particular rate and then let it get on
with it. When it is finished, you can ask for the data - as much or as
little as you want to use. The first step is to specify the sampling rate
using: drdaq_set_interval(time,samples,chanlist,no of chans)
Time (in microseconds) specifies how long
the data should take to gather in total, and 'samples' specifies how many
samples to take. Hence: drdaq_set_interval(10000,10... specifies 10ms and
10 samples, so we are requesting one sample every millisecond. The
function returns the time taken to gather the samples. If you request a
sampling rate that can't be achieved, the time taken will be longer than
you specified. The next parameter is an array that lists the channels to
be sampled, and the final parameter sets the size for the array. So to
gather 10 samples every millisecond on channel one, you would use:
Dim ActualTime As Integer
Dim channels(1) As Integer channels(1) =
1
ActualTime = drdaq_set_interval(10000,
10, channels(1), 1)
Debug.Print ActualTime

Notice that the data is actually gathered
by this call. To make the readings as specified by the set_interval
function, you have to use the drdaq_get_times_and_values function. The
first parameter is an integer array that will be used to store the times;
the second is a long array that will be used to return the values; the
third gives the size of the first two arrays. To get the times and values
of the 10 readings specified by the previous set_interval, you would use:
Dim readings(10) As Integer
Dim Times(10) As Long
Dim ret As Integer ret =
drdaq_get_times_and_values(Times(1), readings(1), 10)
For i = 1 To 10
Debug.Print Times(i), readings(i)
Next i
Every time you call get_times_and_values,
a new set of measurements is made. If you specify multiple channels, the
data that is returned is interleaved in the array. If you don't want the
exact times at which the measurements were made, you can use the
drdaq_get_values function. There is a drdaq_set_trigger function, which
can be used to delay the data gathering until the input on the specified
channel starts to change or reaches a threshold value.
The only additional commands you need to
know are: drdaq_set_do(state) and: drdaq_set_led(state) which will set the
digital output or the LED to the specified state; '0' is 'off' and '1' is
'on'.
Verdict

If you visit the Pico Web site, you will
find details of science
experiments that you can carry out using DrDAQ. If you already have
one DrDAQ, you can win or earn another by writing up an original
experiment for the Web site. You can also download demonstration versions
of the software. Overall, DrDAQ is an excellent product. It is easy to use
and makes it possible to use a PC in many interesting ways.
My only criticism is that the section in
the helpfile that tells you how to make your own sensors is blank. You can
make use of the raw voltage and resistance inputs to make your own sensors
but, currently, the external sensor connectors are for Pico's own
products. I hope that Pico sees the light and makes the information
available very soon.
(Please note that since the DrDAQ
review unit was supplied to the magazine, the help file has been updated
to include the section on making your own sensors. If you have an old help
file visit our download
pages for a free upgrade
Reviewed UK Edition
Computer
Shopper Issue 151, Page 417 |