Difference between revisions of "Laboratory Scale Logging Computer"
imported>Ken |
imported>Ken |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | = Lab Scale Logger = | |
+ | Software has been developed at WERC to interface two different laboratory scales to a Linux computer. So far the system has been made with work with the Ohaus Navigator and the Denver Instruments PK6, but other scales or other types of equipment could likely also be supported. | ||
+ | |||
+ | == Overview == | ||
The software is currently installed on one computer, host name "nuptse", and configured to log data from both the Ohaus and Denver Instruments scales. The system is intended to be reliable and simple to operate. To begin logging data: | The software is currently installed on one computer, host name "nuptse", and configured to log data from both the Ohaus and Denver Instruments scales. The system is intended to be reliable and simple to operate. To begin logging data: | ||
Line 13: | Line 16: | ||
* the computer should beep once when the USB key is seen, and will automatically copy queued data to the key | * the computer should beep once when the USB key is seen, and will automatically copy queued data to the key | ||
* the computer will beep twice with the data copy is complete and the key can be removed | * the computer will beep twice with the data copy is complete and the key can be removed | ||
+ | |||
+ | To turn off the computer, it should be sufficient to hit Ctl-Alt-Del. | ||
+ | |||
+ | == Implementation Details == | ||
+ | |||
+ | The system consists of a few programs (or scripts, same thing) written in perl, implemented on a Linux system. | ||
+ | |||
+ | * scaled-ohaus.pl | ||
+ | |||
+ | The "scale daemon" is the working machine for the system. It sets things up, including creating a "named pipe" that is used for command input and output, then sits in the background only doing something when the pipe yields a command to process. | ||
+ | |||
+ | * readscale-ohaus.pl | ||
+ | |||
+ | The readscale utility simply does a "p" (optionally "P") query to the scaled daemon, which in turn queries the scale and returns the result. This utility is suitable to run via cron, for instance, if output from the scale is wanted on the order of minutes or longer intervals. Or perhaps readscale might be connected to a GUI button in a system to read the scale whenever the button is pressed. | ||
+ | |||
+ | * scale-cmd-ohaus.pl | ||
+ | |||
+ | The scale-cmd utility is the primary user interface for the system. It accepts commands on its standard input, and writes results to standard output. The "h" command can be used to display a help screen to show other available commands. | ||
+ | |||
+ | * wraptty.pl | ||
+ | |||
+ | This command is not really tied to the scale software, but can be used, for instance, to run the scale-cmd interface on a non-login virtual terminal. | ||
+ | |||
+ | == a working system on host nuptse == | ||
+ | |||
+ | Host nuptse is intended to be used as an "appliance", so not needing a login session. Running as root, on startup the scaled-ohaus.pl daemon is started, and then scale-cmd-ohaus is started under the wraptty wrapper to put the interface on tty9. | ||
+ | |||
+ | Also, the data will be automatically logged to | ||
+ | |||
+ | /var/local/spool/ohaus.txt | ||
+ | |||
+ | for any data query from the scale. Another subsystem is in place on host nuptse to auto-mount a usb key, copy the files in /var/local/spool/ to it, and then unmount the usb key. This process beeps once when the usb key is mounted, and beeps twice when the copy is complete and the usb is unmounted and can be removed. | ||
+ | |||
+ | With this system, host nuptse can be left running if desired, or started up when needed, etc. The "p" and "iN" commands can be used to query the scale, where the N is an interval in seconds at which to query the scale. Use i-N to stop an interval query, and "i" alone to see what queries are active. | ||
+ | |||
+ | It might be worth also running the interface for another scale on tty8, but that can wait until there's a reason to do so. |
Latest revision as of 19:02, 23 October 2008
Contents
Lab Scale Logger
Software has been developed at WERC to interface two different laboratory scales to a Linux computer. So far the system has been made with work with the Ohaus Navigator and the Denver Instruments PK6, but other scales or other types of equipment could likely also be supported.
Overview
The software is currently installed on one computer, host name "nuptse", and configured to log data from both the Ohaus and Denver Instruments scales. The system is intended to be reliable and simple to operate. To begin logging data:
- turn on the computer
- connect the serial port to the scale
- power-on the scale
Data should automatically start being received from the scale and stored to the hard drive. To retrieve the logged data from the computer:
- connect a USB "key" to an available port on the computer
- the computer should beep once when the USB key is seen, and will automatically copy queued data to the key
- the computer will beep twice with the data copy is complete and the key can be removed
To turn off the computer, it should be sufficient to hit Ctl-Alt-Del.
Implementation Details
The system consists of a few programs (or scripts, same thing) written in perl, implemented on a Linux system.
- scaled-ohaus.pl
The "scale daemon" is the working machine for the system. It sets things up, including creating a "named pipe" that is used for command input and output, then sits in the background only doing something when the pipe yields a command to process.
- readscale-ohaus.pl
The readscale utility simply does a "p" (optionally "P") query to the scaled daemon, which in turn queries the scale and returns the result. This utility is suitable to run via cron, for instance, if output from the scale is wanted on the order of minutes or longer intervals. Or perhaps readscale might be connected to a GUI button in a system to read the scale whenever the button is pressed.
- scale-cmd-ohaus.pl
The scale-cmd utility is the primary user interface for the system. It accepts commands on its standard input, and writes results to standard output. The "h" command can be used to display a help screen to show other available commands.
- wraptty.pl
This command is not really tied to the scale software, but can be used, for instance, to run the scale-cmd interface on a non-login virtual terminal.
a working system on host nuptse
Host nuptse is intended to be used as an "appliance", so not needing a login session. Running as root, on startup the scaled-ohaus.pl daemon is started, and then scale-cmd-ohaus is started under the wraptty wrapper to put the interface on tty9.
Also, the data will be automatically logged to
/var/local/spool/ohaus.txt
for any data query from the scale. Another subsystem is in place on host nuptse to auto-mount a usb key, copy the files in /var/local/spool/ to it, and then unmount the usb key. This process beeps once when the usb key is mounted, and beeps twice when the copy is complete and the usb is unmounted and can be removed.
With this system, host nuptse can be left running if desired, or started up when needed, etc. The "p" and "iN" commands can be used to query the scale, where the N is an interval in seconds at which to query the scale. Use i-N to stop an interval query, and "i" alone to see what queries are active.
It might be worth also running the interface for another scale on tty8, but that can wait until there's a reason to do so.