What Can you Expect? —A Data Collection Project Using Linux
Both the temperature conversion circuit and the multimeter run from 9-volt batteries. Since I wanted to take data for weeks at a time without worrying about them going dead, I designed and built a couple of simple power supplies using adjustable voltage regulators and the cube transformers that plug in the wall, to act as battery eliminators. These also fit on a piece of vector board a little over one square inch. (See Figure 4.)
The last part was visualizing the data. I used gnuplot to read the log file and plot temperature versus time. I hadn't used gnuplot before, but a couple of hours going through the man pages got me to a point where I could view the plot on the Linux console or print it to my HP LaserJetIII.
Lines in /var/log/temps.log look like this:
Dec 31 10:45:01 server1 rddmm: 68.9 Degrees F
The operative gnuplot directives are:
set xdata time set format x "%b %d\n%H:%M" set title "Internal Server Temperature at Timekeeping Crystal" set timefmt "%b %d %H:%M:%S" set xrange [ "Jan 03 14:00:00" : "Jan 04 07:59:00"] set ylabel "Degrees F" -2 plot "/var/log/temps.log" using 1:6 with lines 1The xdata and timefmt directives tell gnuplot the horizontal axis is measured in time and how the times in the log file look. The xrange directive determines which lines of the log file get plotted. The format x directive defines the labels on the x axis; the \n between the date and time forces a two-line label. The plot command tells gnuplot where to find the log file, which columns to plot and to use line plot style 1. The set title and set ylabel put a title and y-axis label on the plot.
To print the plot to the laser jet, I used:
set terminal pcl5 set output '/root/plot.out' replot
Then from the shell:
lpr /root/plot.outIn a similar fashion, I plotted the difference of system clock time measurements versus the reference NTP server on the Internet with the gnuplot directives shown here:
set xdata time set timefmt "%Y-%m-%d %H:%M" set xrange ["1999-01-03 15:00":"1999-01-04 07:00"] set format x "%b %d\n%H:%M" set title "Delta sysclock Minus Delta refclock" set ylabel "Seconds" -2 plot "/root/clk_hr.prn" using 1:3 with lines 1
And now, after all of this, is the system clock being affected by temperature? By looking at Figures 4 and 5, you can see that the variations in the clock differences do not follow the temperature variations inside the server. As a matter of fact, there is a large time variation that corrected itself, which I must chalk up to variations in network latency. By taking time data once per hour instead of once per day as I was originally doing, it became easier to identify the random network variations, which had originally peaked my curiosity.
These techniques are also adaptable to measuring and recording other physical parameters using devices with a serial interface. This particular digital multimeter can measure DC and AC voltage and current, capacitance, frequency and transistor gain. All these are accessible through the serial interface.
Linux and a project like this have brought me back to the days when you could actually create something useful with hardware and software. Sadly, most things for computers today come out of a shrink-wrapped box. Linux provides me with the tools I can use to make things happen in the real world.
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems
Join editor Bill Childers and Bit9's Paul Riegle on April 27 at 12pm Central to learn how to keep your Linux systems secure.
Free to Linux Journal readers.Register Now!
- Cluetrain at Fifteen
- Getting Good Vibrations with Linux
- Embedding Python in Your C Programs
- [<Megashare>] Watch Mrs Brown's Boys Movie Online Full Movie HD 2014
- New Products
- Customizing Vim
- Security Hardening with Ansible
- Readers' Choice Awards 2013
- Tech Tip: Really Simple HTTP Server with Python
- Memory Ordering in Modern Microprocessors, Part I