PIC
DAS
PIC Based - Data Acquisition System
By: Steve
Hageman
The PIC
DAS Project: Inside and Out!
As seen in
the January 2001 issue of QEX
magazine.
For
information on article
reprints, click here.
How about putting
a computer controlled, 12 Bit Data Acquisition System that
you built on your own workbench! The Hagtronics PIC DAS project published in
QEX is just that!
Why pay hundreds for
a commercial Data Acquisition System when you can build the PIC DAS
for less than $50.00? The PIC DAS is built around a Microchip
PIC16C63A microcontroller and contains an 8 bit bidirectional Digital
I/O port, 12 bit, 8 channel A/D converter and a 12 bit, 4 channel
output D/A converter. It is perfect for quickly controlling any
project on your workbench! Use the Digital I/O to sense switch
closures with the help from the built-in weak pullups, control
OPAMP's, power supplies and the like with the built-in D/A
converters. Measure temperature or sense voltage or current with the
built-in A/D converter. The real usefulness of this system is that it
has a known simple to use interface that uses real ASCII commands
over an RS232 link. This method of control saves programming time
that would otherwise be wasted controlling the test setup, instead of
actually doing the test.
Click here for a larger
view
Here is a
sample PIC DAS application using Agilent VEE to control the PIC DAS
hardware.
The
application read and plotted the inside and outside temperature for
24 hours.
The yellow
trace is the inside temperature and the cyan trace is the outside
temperature.
Here is a screen shot
of a temperature measurement application using two LM35 semiconductor
temperature sensors and the PIC DAS. The entire application was
written with 16 statements in Agilent VEE (see below) to measure the
temperature here at Steve's Workshop for 24 hours and then plot the
results. Quick and easy, with excellent results, that's why I
designed the PIC DAS in the first place.
As with all my
projects, the firmware and programming examples are provided for
free. If you need a preprogrammed PIC I can supply those also if
needed (see below).
I hope you enjoy
building and using the PIC DAS!
PIC DAS TYPICAL PERFORMANCE
Digital I/O
ports....................................................... 1, 8 bit
(With selectable weak pullups)
A/D Conversion
Channels.....................................................
8
Resolution...................................................
12 bits ( 1 mVolt / bit )
Input
Range................................................. 0-4.095
Volts
D/A Conversion
Channels.....................................................
4
Resolution...................................................
12 bits ( 1 mVolt / bit )
Output
Range.............................................. 0-4.095
volts
I/O
Connections...................................................... Via
26, quick connect, screw terminals
Programming
Programs
via 9600 Baud RS232 connection to a PC. Programming is via standard
ASCII commands
May be programed in
DOS or Windows. Includes a 32 bit Windows ActiveX control for super
simple
programming with any
32 bit Windows development environment or may even be used with Excel
to
directly input
readings, etc into a spreadsheet.
Power
Source............................................................
Internal 9 volt battery
Size............................................................................
8 x 3 x 1"
PIC DAS
Project FAQ's
Please e-mail with
your questions. That's how this all works, you share with me, I'll
post it so everyone knows -- and I'll give you credit too!
Article FAQ:
1) A simple, brief
programming guide for the PIC
DAS can be found here.
2) A reoccurring
question is 'How fast is...", usually used in conjunction with the
A/D converter. Well with 9600 Baud communication a character is sent
every 1 millisecond (mSec). The A/D command requires 5 characters
minimum to start a conversion going. That's 5 mSec. The PIC DAS takes
only hundreds of microseconds to make the conversion, then the
results are sent back to the PC. The data sent back is 2 to 5
characters long depending on the A/D voltage (i.e. the A/D code is 0
to 4096, plus a carriage return), so this time is 2 to 5 mSec long.
Hence the total conversion time is somewhere in the range of 10
Milliseconds minimum. The host language adds time depending on what
happens to the data when it returns. As a test, 1000 A/D samples were
made with a simple QBASIC program on a Pentium 200 CPU, the data was
returned and simply discarded (it was not printed or plotted as this
takes a huge amount of time). The elapsed time was 12 mSec per
sample, or 12 seconds for 1000 samples. The DAC can be calculated in
a similar manor, but suffice to say that a typical update time was
also approximately 12 mSec per update point.
Parts / Hardware
FAQ:
I will be keeping
folks abreast of where to get parts, etc. for the project
here:
1) The complete parts
lists for all the project is available here as a
text file.
2) A PCB is available
for the project from FAR
Circuits.
Check with FAR directly please, as they supply the PCB's, not
me.
3) An assembly
drawing for the FAR Circuits PCB is available for download here (GIF
Format).
4) A schematic of the
PIC DAS is available for download here (GIF
Format).
5)
A
preprogrammed 16C63A PIC is available from me for $20 US Dollars. Shipping
to the 'ol US of A (and Canada, Eh?) is FREE. Shipping to Europe is
$5.00 (Via US Post Office Global Priority Mail). Shipping to South
America is $10 US Dollars (Via anyway I think it will get there!).
Sorry South America, the postal system down there just looses too
much of what I send.
6) The Maxim and
Microchip PIC parts are usually available as samples. Check this out
at www.maxim-ic.com and www.microchip.com. If you can't convince them
that you deserve samples, then Digi-Key will gladly sell you the
parts.
7) C9 is shown on the
schematic but does not exist on the layout, just omit C9 when
building the PIC DAS.
Software / Firmware
FAQ's:
1) The associated
application software is available free as PIC_DAS.ZIP at the
ARRL/QEX
files site.
The PIC DAS may be run from DOS or Windows 95, 98 and NT (Also
hopefully Win2k, but not tested yet).
2) A sample QBasic
program that exercises all of the functionality of the PIC DAS is
available for download
here. This
should be useful if you wish to program the PIC DAS from a standard
BASIC or from DOS using QBasic. Depending on the computer OS and
speed you may have to fiddle with the delays some.
3) For Windows 9x, NT
and above, I have created an ActiveX control that automates the
programming process greatly. The ActiveX control may be used with
Visual basic, Visual C++, Delphi, Agilent VEE and even Microsoft
applications such as Excel and Word. To download the ActiveX install
file click here to download picdas_activex.zip (1.7 meg file).
4) Only use Winzip or
some other 32 bit (i.e. long file name aware) unzipping program,
otherwise all the long filenames will be truncated to the old DOS 8.3
format and the program will refuse to install !!!
5) Overwriting of
outdated files during install the should be safe as these files are
all genuine, Microsoft files. If you don't feel safe about this, note
the name of the file name(s) the install program want's to update,
respond NO to the prompt(s). Then find these file(s), copy them to a
floppy and reinstall the program. This way if anything goes wrong,
you can recover from the problem.
6) You can uninstall
the ActiveX control program by going to -> Control Panel ->
Add/Remove programs.
7) I write all my
firmware for the PIC's with the CCS PCM
C compiler
(Hey, life is just way too short for all that assembler stuff ;).
This is really a fine little compiler, and the best $99 dollar
compiler since QuickC ! Heartily recommended (the Hagtronics 'Two
Thumbs Up'). The PIC firmware source code can be downloaded by
clicking here. If you can program a
PIC16C63A yourself , the firmware download contains a HEX programming
file. This HEX file contains the fuse settings and works with a
Microchip PicStart Plus programmer. Sorry I can't support other
programmers, please contact your programmer manufacturer and ask them
how to load a genuine Microchip HEX file!
8) Copyright:
The software/firmware is freeware when used with the PIC DAS project
as described in QEX. If you want to use the software for any
commercial purpose, then all I ask is that you contact me for a
license. Fair enough?
PIC DAS
Applications:
Computer controlled
power supply test system
References:
Agilent Technologies VEE - Test
Programming made fun!
[1] For more
information on Agilent VEE, a graphical test programming language,
check out the Agilent Technologies web site at, www.agilent.com/find/vee.
[2] For more
information on using ActiveX controls with Excel, check out Werner
Haussmann's articles in Test And Measurement
World. Search
the article archive for 'Haussmann' or 'ActiveX'.
|Comments?| |To
Steve's Workshop Home|
Updated -
26Aug07