Pond Temperature - how it works

Parts: 

The Sensors:

The temperature sensors are from Dallas Semiconductor - part # DS18S20 - these devices, and others in Dallas Semi's 1-wire stable, communicate over a single piece of twisted pair wire (1 wire for data and 1 wire for ground) - each has a unique serial number and can be polled to report their readings.  The DS18S20 is accurate to .5 degrees C.  See http://pdfserv.maxim-ic.com/en/ds/DS18S20.pdf for details

The devices are located in the main pond at 32" (the deepest point in the pond), 12" and at 6" in the filtering bog.  There is also a 4th sensor about 24" above the pond.   It is exposed to the sun so that the length of sunlight on the water can be determined by the extreme temperature swings reported when the sun is falling on the sensor.  All sensors are housed inside of standard 1/2" PCV pipe - a small hole in end caps, sealed with silicon glue, exposes the ends of the sensors to the air or water.

The sensors are wired in parallel and connected to one pair of a 100' Cat 6 twisted pair cable that runs from the pond to the basement workshop.  The device that reads the sensors is from:  http://www.phanderson.com/tm125.html, a really great source of such microprocessors, sensors and code to use them.  The device connects to the twisted pair from the pond sensors and to a PC via a standard serial cable.  A simple Quick Basic program sends a single character to the serial port on the TM125 device to initiate a read.  The program reads the four sensors and stores the results to a file.  Another QB45 program reads the file, collects the most recent 150 sets of readings and creates a HTML document that is FTPed to the web server.  All of this happens every 15 minutes and is controlled by a batch file called by Windows Scheduler.

First program:  1-WIREA.BAS

Second program: 1WIRHTM2.BAS

Sample data file  1WIREOUT.TXT

Graphing - NEW

The original program placed the temperature data onto the web in table format.  I had been interested in showing it in a graph as well but did not have an appropriate tool until I ran across a program called GUNPLOTGnuplot is a command line driven graphing program that can read tabular data and create a graph in GIF, PNG and other image formats.

In order to incorporate Gnuplot into the temperature program all that was necessary was to create a text file that contained the data to be graphed, define the graph to be created by creating a script file and to execute a command that told Gnuplot to read the file based on the command script sending output to a GIF file.

Here are the files along with some comments:

GRAPOUT.TXT - the file created by the 1wirhtm2.bas program..  Each line in the file contains the date and time of the temperature reading, the ambient temperature, Main 32, Main 12 and bog temperatures in Fahrenheit

LAST150.PLT - a script file that defines the graph (see notes below)

LAST150. GIF - output from Gnuplot.

SINCEOCT.PLT and ALL.GIF - script and output for all readings since starting in October, 2003

 

LAST150.PLT  follows:

set terminal gif small size 900, 768 transparent x000000

set output "last150.gif"

set time

set size 1.0,0.500

set y2tics

set grid

set title "Pond Temperatures (last 150 readings)" 0.000000,0.000000 ""

set ylabel "Degrees Fahrenheit" 0.000000,0.000000 ""

set xlabel "\n15 Minute Observations"

set key below

plot 'c:graphout.txt' using 3 title "Ambient" with lines, 'c:graphout.txt' using 5 title "Main 12" with lines, 'c:graphout.txt' using 6 title "Bog 6" with lines, 'c:graphout.txt' using 4 title "Main 32" with lines

set output

Notes: