Payday loans
Home People Gerry Spain Serial data logging
Serial data logging PDF Print E-mail
Written by Gerry Spain   
Monday, 11 May 2009 14:02

A few instruments still use serial output's and are pretty easy to log one you know the command set for the instrument. This is a basic recipie for setting up a simple logging system. In general I would setup instruments to generate one-minute averages and have the PC poll for the data. In some cases the instruments simply stream the data on the serial port which requires a different approach

Polling setup:

1) Install some version on Linux on an appropriate PC. You don't actually need a powerful machine - a 486 or even a 386 will work for but if you can set up a system like that,you don't need to read this article....Mostly I'm running Fedora 12 or 13 on P4's or better

2) Depending on how you want to use the PC, the installation should include useful tools such as gcc, gnuplot, ntp, rsync, mutt and possibly others

3) Install sjinn. Sjinn is a general purpose program which allows you to communicate with serial ports and includes some basic scripts which show you how to call the program from within a script. http://sjinn.sourceforge.net

Some other useful comms programs would be minicom, kermit, CuteCom, GTKTerm, moserial or even this piece of code http://www.comptechdoc.org/os/linux/programming/c/linux_pgcserial.html

4) If you wish to do basic statistical analysis, statist is a handy program which can be run from a script. See http://statist.wald.intevation.org/.

For more powerful post-processing analysis and plotting, check out http://www.r-project.org/ and http://www.openair-project.org/

5) For a really basic machine you can compile sjinn on a different PC and copy the executable to /usr/bin or /local/usr/bin to the logging PC. Have the logging script start up automatically when the PC boots (stick it in rc.local or run it as a cron job). Use ntp to maintain the clock accuracy. Transfer the data to another machine on a regular basis eg using rsync, ftp or even mutt. Rsync may be a bit too much of a resource hog for a low powered machine but is very efficient. ftp is old and venerable and maybe a bit slow but it works. If you want to email files, mutt allows you attach files as attachments rather than including the file in the body of the message. Alternatively run a server on the logging PC and have an external PC poke it at interval to get the data

Streaming setup:

In some ways a streaming instrument is easier to deal with as you simply have to pipe the data into a file as it arrives.

eg put cat /dev/ttyS0 >> filename into an infinte loop or tail  -f /dev/ttyS0 >> filename. Whatever appears on COM1 will end up in filename. It's not very elegant but it works. Another other option is to use a program like minicom or kermit to do the same thing, it just requires a little more setting up.

 

Last Updated on Sunday, 27 March 2011 16:26
 
Copyright © 2017 Atmospheric Physics Research Cluster. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.
 
None