QtDMM

From Noah.org
Jump to: navigation, search


QtDMM is a great GUI interface to Digital MultiMeters that have a computer interface. It has a few bugs, but these can be worked around.

Build

It is very important that you build it correctly from source. You need to turn off the FORTIFY flag checking in gcc. See Compiler Flags FORTIFY.

You will also need qt3-dev-tools. Unpack the tarball. Set the QTDIR environment variable! The following is for building under Ubuntu, but other distros are probably not much different:

sudo aptitude install qt3-dev-tools
QTDIR=/usr/share/qt3/ ./configure BASECFLAGS=-U_FORTIFY_SOURCE
make

Radio Shack DMM Model #22-812

I use a Radio Shack Model #22-812. I'm not normally a fan of anything from Radio Shack, but this meter is inexpensive and it has a very useful RS-232 serial interface.

Under QtDMM: Preferences find the Multimeter settings section. I use the following settings:

Port
/dev/ttyUSB
Bits
8
Parity
None
Stop bits
1
Baud rate
4800
Digits
4000
Protocol
9 bytes binary, continuous (RS 22-812)

Plotting saved data

To plot saved data to graphs, you will need to install "GNU Plotutils" and "ImageMagick":

    sudo aptitude install plotutils imagemagick

The following command will plot data saved as "power_test_1.data":

( egrep -v "^\s*#" | awk '{print $3}' |  \ 
    graph --page-size ledger --x-label 'Samples 100ms'  \ 
    --y-label 'Current mA' -r 0.1 -u 0.1 -h 0.8 -w 0.8  \ 
    --auto-abscissa -F HersheySans -T ps |  \ 
    convert -background white -flatten - power_test_1.png )  \ 
    < power_test_1.data

For more examples see Gnuplot.

chart.sh, a script for plotting power data

#!/bin/bash

#
# This converts digital multimeter capture files into graphs.
#
# Copyright (c) 2010, Noah Spurrier <noah@noah.org>
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# Version 1
#

exit_with_usage() {
    local EXIT_CODE="${1:-0}"
    local ERROR_MESSAGE="${2:-''}"

    # Errors print to stderr.
    if [ ${EXIT_CODE} -ge 1 ]; then
        exec 1>&2
        echo "${ERROR_MESSAGE}"
        echo
    fi

    echo "This converts digital multimeter capture files into graphs."
    echo
    echo "Usage: $0 [-h | --help] [*.data]"
    echo "  -h --help         : Shows this help."

    exit "${EXIT_CODE}"
}

# Generate graph in Amps.
for DATA_FILENAME in "$@"
do
    cat $DATA_FILENAME | egrep -v "^\s*#" | awk '{print $3}' | \
    graph --page-size ledger --x-label 'Sample rate: 100ms' \
    --y-label 'Amps' -r 0.1 -u 0.1 -h 0.8 -w 0.8 \
    --auto-abscissa -F HersheySans -T ps | \
    convert -background white -flatten - ${DATA_FILENAME%.dat}_amp.png
done

# Generate graph in Watts.
for DATA_FILENAME in "$@"
do
    cat $DATA_FILENAME | egrep -v "^\s*#" | awk '{print $3*9.0}' | \
    graph --page-size ledger --x-label 'Sample rate: 100ms' \
    --y-label 'Watts' -r 0.1 -u 0.1 -h 0.8 -w 0.8 \
    --auto-abscissa -F HersheySans -T ps | \
    convert -background white -flatten - ${DATA_FILENAME%.dat}_watt.png
done

# vim:set sr et ts=4 sw=4 ft=sh: // See Vim, :help 'modeline'

import and export bug

Import and export of test data does not work perfectly. You can export the data, but it screws up the recorded data by saving every sample with the same date-time stamp -- and without fractions of a second which is critical since you can sample every 100 milliseconds. This is not so much of a problem since you at least know the time between samples which is good enough for graphing.

ZMeter alternative

An alternative to QtDMM is ZMeter.