<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Diagram Tips . com</title>
	<atom:link href="http://diagramtips.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://diagramtips.com</link>
	<description>Let&#039;s talk electronics</description>
	<lastBuildDate>Sat, 30 Jun 2012 08:46:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Aquaponics pH to 1-Wire Converter &#8211; Part 2</title>
		<link>http://diagramtips.com/2012/01/22/aquaponics-ph-to-1-wire-converter-part-2/</link>
		<comments>http://diagramtips.com/2012/01/22/aquaponics-ph-to-1-wire-converter-part-2/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 14:56:01 +0000</pubDate>
		<dc:creator>Thomas Wagner Nielsen</dc:creator>
				<category><![CDATA[1-Wire]]></category>
		<category><![CDATA[a d converter]]></category>
		<category><![CDATA[bat54s]]></category>
		<category><![CDATA[battery monitor]]></category>
		<category><![CDATA[bnc connector]]></category>
		<category><![CDATA[ds2450]]></category>
		<category><![CDATA[DS2760]]></category>
		<category><![CDATA[ds2762]]></category>
		<category><![CDATA[dual op-amp]]></category>
		<category><![CDATA[geda]]></category>
		<category><![CDATA[Hobby-Boards]]></category>
		<category><![CDATA[internal resistance]]></category>
		<category><![CDATA[li+]]></category>
		<category><![CDATA[maxim]]></category>
		<category><![CDATA[op-amp offset voltage]]></category>
		<category><![CDATA[pcb layout]]></category>
		<category><![CDATA[ph probe]]></category>
		<category><![CDATA[qucs]]></category>
		<category><![CDATA[soil moisture sensor]]></category>

		<guid isPermaLink="false">http://diagramtips.com/?p=726</guid>
		<description><![CDATA[This is the first draft of the pH to 1-Wire converter schematic, and some of the component values are still missing. The original circuit runs on 12 VDC, but since the A/D converter IC must be supplied with 5 VDC &#8230; <a href="http://diagramtips.com/2012/01/22/aquaponics-ph-to-1-wire-converter-part-2/">Continue reading <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://diagramtips.com/2012/01/08/aquaponics-ph-to-1-wire-converter-part-1/' rel='bookmark' title='Aquaponics pH to 1-Wire Converter &#8211; Part 1'>Aquaponics pH to 1-Wire Converter &#8211; Part 1</a></li>
</ol>
</div>
]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p>This is the first draft of the pH to 1-Wire converter schematic, and some of the component values are still missing. The original circuit runs on 12 VDC, but since the A/D converter IC must be supplied with 5 VDC only I want to scale down the circuit, so that 5 V is the maximum voltage present. I assume I would have to tweak some resistor values in order to make the circuit run at this lower supply voltage, but I haven&#8217;t looked into the details yet. I&#8217;ll post an updated schematic and the calculations later.</p>
<p><a href="http://diagramtips.com/images/2012/ph_1wire_1.png" target="_blank"><img class="alignnone" title="ph_1wire_1.png" src="http://diagramtips.com/images/2012/ph_1wire_1_preview.jpg" alt="ph_1wire_1.png" width="400" height="282" /></a></p>
<p><em>(Click on the picture above for a larger version.)</em></p>
<p>These are the source files:</p>
<p>gEDA schematic, .sch and .pdf:<br />
<a href="http://diagramtips.com/geda_schematics/ph_1wire_1.sch" target="_blank"><img class="alignnone" title="ph_1wire_1.sch" src="http://diagramtips.com/images/geda_schematic.png" alt="ph_1wire_1.sch" width="47" height="39" /></a> <a href="http://diagramtips.com/geda_schematics/ph_1wire_1.pdf" target="_blank"><img class="alignnone" title="ph_1wire_1.pdf" src="http://diagramtips.com/images/pdf.png" alt="ph_1wire_1.pdf" width="50" height="50" /></a></p>
<p>gEDA symbols, DS2762 and BAT54S:<br />
<a href="http://diagramtips.com/geda_symbols/DS2762-1.sym" target="_blank"><img class="alignnone" title="DS2762-1.sym" src="http://diagramtips.com/images/geda_symbol.png" alt="DS2762-1.sym" width="42" height="49" /></a> <a href="http://diagramtips.com/geda_symbols/BAT54S-1.sym" target="_blank"><img class="alignnone" title="BAT54S-1.sym" src="http://diagramtips.com/images/geda_symbol.png" alt="BAT54S-1.sym" width="42" height="49" /></a></p>
<p>The original idea was to use a 1-Wire A/D converter with built-in <a title="1-Wire USB on a Long Ethernet Cable" href="http://diagramtips.com/2011/10/03/1-wire-usb-on-a-long-ethernet-cable/" target="_blank">1-Wire digital interface</a>, but the one I found was not recommended for new designs. This is what Maxim writes about the DS2450 A/D converter:</p>
<blockquote><p>This product is Not Recommended for New Designs. Some versions may be No Longer Available or being discontinued and subject to Last Time Buy, after which new orders can not be placed.</p></blockquote>
<p>Also known as &#8216;NRND&#8217;. Most of the other A/D converters I found at Maxim had another interface, but the main IC on the soil moisture sensor board from Hobby Boards also converts analog signals to digital and that&#8217;s a DS2760. The updated version is called DS2762, which is the one that I have used in the new circuit.</p>
<p>The DS2760 on the soil moisture sensor board measures current, but the IC also has a voltage input pin. The IC is actually a &#8216;High-Precision Li+ Battery Monitor With Alerts&#8217; as Maxim calls it. The idea is to only use the voltage input pin and 1-Wire interface to get a popular, and cheap, A/D converter, with high input resistance.</p>
<p>Since the DS2762 operates on 5 VDC, the ground reference for the amplifier section should be changed to 2.5 V instead of 7 V in order to use the entire input voltage span of the A/D converter. The 7 V in the original circuit was meant to be measured with a voltage meter and you would have the pH value directly as a reading (pH 7 = 7.00 V, pH 8 = 8.00 V etc.). There&#8217;s no meter or display on this new circuit, only <a title="How to Read 1-Wire Temperature Using a NSLU2 With Debian" href="http://diagramtips.com/2011/09/11/how-to-read-1-wire-temperature-using-a-nslu2-with-debian/" target="_blank">data delivered to a computer via the 1-Wire interface</a>, so voltages in the circuit can be converted to something meaningful using <a title="Automatic Temperature Measurements Using NSLU2" href="http://diagramtips.com/2011/08/31/automatic-temperature-measurements-using-nslu2/" target="_blank">software on the computer</a>. Historical data can be displayed with e.g. RRDtool.</p>
<p>When the supply voltage is changed, the gain of the voltage amplifier has to change too, along with a change in offset voltage, i.e. ground reference. IC300 is a dual op-amp IC, where R351, R352 and R355 determines the gain. R300 sets the ground reference voltage level. Apparently it is necessary to put in trimmer resistors, since practical op-amps are not perfect like theoretical ones. Also, the pH probe is worn down as time goes by, and the circuit will have to be calibrated regularly.</p>
<p>Several capacitors have been added to short circuit any fast changing signals as these are irrelevant to aquaponics pH measurements and any alternating currents are considered noise in this respect. It means that the pH values from the 1-Wire interface will need seconds to stabilize. D101 is included to protect the 1-Wire interface.</p>
<p>Since the schematic does not represent the PCB layout, a note has been written about the seemingly long wires going from the BNC connector to the op-amp. On the actual PCB the traces must be as short as possible, because the internal resistance of a pH probe is very high and any electromagnetic radiation will induce relatively high unwanted voltages in the circuit. It shouldn&#8217;t be a problem though to place IC300 close to J300.</p>
<p>DS2762 has a general purpose I/O pin (PIO) which can be used for debugging. D100 could be connected to this pin to be able to signal something, but it would probably need an extra transistor. As I want things to be as simple as possible I haven&#8217;t included this, but at least there&#8217;s a resistor footprint to work with now.</p>
<p>I want to experiment with the values of R351, R353, R354 and R355 in Qucs, as I don&#8217;t fully understand the impact of changing the supply voltage, hence the missing resistor values. But I don&#8217;t mind &#8211; Qucs turns out to be an awesome piece of software for the electronics hacker <img src='http://diagramtips.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<div class='yarpp-related-rss'>
<p>Related posts:</p><ol>
<li><a href='http://diagramtips.com/2012/01/08/aquaponics-ph-to-1-wire-converter-part-1/' rel='bookmark' title='Aquaponics pH to 1-Wire Converter &#8211; Part 1'>Aquaponics pH to 1-Wire Converter &#8211; Part 1</a></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://diagramtips.com/2012/01/22/aquaponics-ph-to-1-wire-converter-part-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Aquaponics pH to 1-Wire Converter &#8211; Part 1</title>
		<link>http://diagramtips.com/2012/01/08/aquaponics-ph-to-1-wire-converter-part-1/</link>
		<comments>http://diagramtips.com/2012/01/08/aquaponics-ph-to-1-wire-converter-part-1/#comments</comments>
		<pubDate>Sun, 08 Jan 2012 09:22:31 +0000</pubDate>
		<dc:creator>Thomas Wagner Nielsen</dc:creator>
				<category><![CDATA[1-Wire]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[a d converter]]></category>
		<category><![CDATA[bnc]]></category>
		<category><![CDATA[coax cable]]></category>
		<category><![CDATA[DS9490R]]></category>
		<category><![CDATA[NSLU2]]></category>
		<category><![CDATA[rj12]]></category>

		<guid isPermaLink="false">http://diagramtips.com/?p=662</guid>
		<description><![CDATA[Aquaponics systems need a good water quality, and one of the parameters is pH value, which needs to be within a certain range in order for the fish and plants to thrive. This is of course also true for fish-only &#8230; <a href="http://diagramtips.com/2012/01/08/aquaponics-ph-to-1-wire-converter-part-1/">Continue reading <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://diagramtips.com/2011/09/11/how-to-read-1-wire-temperature-using-a-nslu2-with-debian/' rel='bookmark' title='How to Read 1-Wire Temperature Using a NSLU2 With Debian'>How to Read 1-Wire Temperature Using a NSLU2 With Debian</a></li>
<li><a href='http://diagramtips.com/2011/12/21/linux-scripts-for-rainwise-1-wire-rain-gauge/' rel='bookmark' title='Linux Scripts for RainWise 1-Wire Rain Gauge'>Linux Scripts for RainWise 1-Wire Rain Gauge</a></li>
<li><a href='http://diagramtips.com/2011/10/03/1-wire-usb-on-a-long-ethernet-cable/' rel='bookmark' title='1-Wire USB on a Long Ethernet Cable'>1-Wire USB on a Long Ethernet Cable</a></li>
</ol>
</div>
]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p>Aquaponics systems need a good water quality, and one of the parameters is pH value, which needs to be within a certain range in order for the fish and plants to thrive. This is of course also true for fish-only aquariums, but since I have an aquaponics system set up already, this is what I&#8217;ll focus on. There are a few pictures of the system in this blog post: <a title="Debian on NSLU2 With USB Hard Disk and Homeplug Network" href="http://diagramtips.com/2011/09/05/debian-on-nslu2-with-usb-hard-disk-and-homeplug-network/" target="_blank">Debian on NSLU2 With USB Hard Disk and Homeplug Network</a> (I&#8217;m using a Debian NSLU2 but it should be possible to use an Unslung NSLU2 too).</p>
<p>The small <a title="How to Read 1-Wire-Temperature Using a NSLU2 With Debian" href="http://diagramtips.com/2011/09/11/how-to-read-1-wire-temperature-using-a-nslu2-with-debian/" target="_blank">NSLU2 computer</a> has a USB connector and with a DS9490R 1-Wire to USB adapter it&#8217;s easy to collect data from a 1-Wire unit onto a hard disk. Then I just need a pH-to-1-Wire adapter, which is what I want to build and describe in the upcoming blog posts. <a title="1-Wire USB on a Long Ethernet Cable" href="http://diagramtips.com/2011/10/03/1-wire-usb-on-a-long-ethernet-cable/" target="_blank">A 1-Wire bus has a much longer reach than a USB bus</a> and that is very convenient for many purposes.</p>
<p>I&#8217;m going to build a circuit with the following specifications that will interface to a common pH probe immersed in the aquaponics water:</p>
<p><em>Input</em></p>
<ul>
<li>BNC connector</li>
<li>High impedance</li>
<li>0.059 V / pH unit</li>
<li>12 VDC power supply</li>
</ul>
<p><em>Output</em></p>
<ul>
<li>RJ12 connector</li>
<li>1-Wire</li>
</ul>
<p>The block diagram for the circuit looks like this:</p>
<p><img class="alignnone" title="pH 1-Wire interface block diagram" src="http://diagramtips.com/images/2012/ph_1_wire_interface_block_diagram.jpg" alt="" width="385" height="245" /></p>
<p>Most of the circuit is originally described at <a title="66pacific.com" href="http://66pacific.com" target="_blank">66pacific.com</a>.</p>
<p><em>BNC Connector</em></p>
<p>The pH probe that is supposed to be connected to the voltage amplifier only sends out 0.059 V per pH unit and using a coax cable will keep out noise. Coax cable naturally terminates in a BNC connector.</p>
<p><em>Voltage Amplifier</em></p>
<p>The small signal from the pH probe is amplified so that it matches a commonly available A/D converter.</p>
<p><em>Ground Reference</em></p>
<p>The voltage signal coming from the pH probe is both positive (pH &lt; 7) and negative (pH &gt; 7). Since the power supply for the circuit is from an ordinary 12 VDC mains adapter and the signal is going to an A/D converter, the ground reference for the voltage amplifier is raised to ensure positive voltages only for the converter, assuming that a normal one is only able to handle positive voltages.</p>
<p><em>A/D Converter</em></p>
<p>Converts the amplified analog voltage to a digital value and makes it available on the 1-Wire bus.</p>
<p><em>RJ12 Connector</em></p>
<p>A common type of connector for the 1-Wire bus. Only 2 pins are used although 6 are available. The pinout is shown on this page: <a title="RJ12 Pinout" href="http://diagramtips.com/rj12-pinout/" target="_blank">RJ12 Pinout</a></p>
<p><em>Voltage Regulator</em></p>
<p>This block improves the quality of the supply voltage, which makes it possible to use many different generic mains adapters.</p>
<p><em>DC Connector</em></p>
<p>A generic low voltage coaxial power connector commonly used on mains adapters.</p>
<p>&#8212;</p>
<p>The next step is to draw the schematic with all the circuit components. Comments and suggestions are welcome in the comments section below.</p>
<div class='yarpp-related-rss'>
<p>Related posts:</p><ol>
<li><a href='http://diagramtips.com/2011/09/11/how-to-read-1-wire-temperature-using-a-nslu2-with-debian/' rel='bookmark' title='How to Read 1-Wire Temperature Using a NSLU2 With Debian'>How to Read 1-Wire Temperature Using a NSLU2 With Debian</a></li>
<li><a href='http://diagramtips.com/2011/12/21/linux-scripts-for-rainwise-1-wire-rain-gauge/' rel='bookmark' title='Linux Scripts for RainWise 1-Wire Rain Gauge'>Linux Scripts for RainWise 1-Wire Rain Gauge</a></li>
<li><a href='http://diagramtips.com/2011/10/03/1-wire-usb-on-a-long-ethernet-cable/' rel='bookmark' title='1-Wire USB on a Long Ethernet Cable'>1-Wire USB on a Long Ethernet Cable</a></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://diagramtips.com/2012/01/08/aquaponics-ph-to-1-wire-converter-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Scripts for RainWise 1-Wire Rain Gauge</title>
		<link>http://diagramtips.com/2011/12/21/linux-scripts-for-rainwise-1-wire-rain-gauge/</link>
		<comments>http://diagramtips.com/2011/12/21/linux-scripts-for-rainwise-1-wire-rain-gauge/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 11:21:04 +0000</pubDate>
		<dc:creator>Thomas Wagner Nielsen</dc:creator>
				<category><![CDATA[1-Wire]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[NSLU2]]></category>
		<category><![CDATA[rain gauge]]></category>

		<guid isPermaLink="false">http://diagramtips.com/?p=583</guid>
		<description><![CDATA[After the first successful test of my RainWise rain gauge it&#8217;s time to automatically generate graphs showing the amount of rainfall versus time. First I log into my NSLU2 via SSH: $ ssh 192.168.1.xx $ uptime 16:07:28 up 14 days, &#8230; <a href="http://diagramtips.com/2011/12/21/linux-scripts-for-rainwise-1-wire-rain-gauge/">Continue reading <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://diagramtips.com/2011/12/03/first-test-of-rainwise-1-wire-rain-gauge/' rel='bookmark' title='First Test of RainWise 1-Wire Rain Gauge'>First Test of RainWise 1-Wire Rain Gauge</a></li>
<li><a href='http://diagramtips.com/2011/11/24/1-wire-rain-gauge-pictures/' rel='bookmark' title='1-Wire Rain Gauge Pictures'>1-Wire Rain Gauge Pictures</a></li>
<li><a href='http://diagramtips.com/2011/10/23/watermark-soil-moisture-sensor-probe-calibration/' rel='bookmark' title='Watermark Soil Moisture Sensor Probe Calibration'>Watermark Soil Moisture Sensor Probe Calibration</a></li>
</ol>
</div>
]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p>After the first <a title="First Test of RainWise 1-Wire Rain Gauge" href="http://diagramtips.com/2011/12/03/first-test-of-rainwise-1-wire-rain-gauge/" target="_blank">successful test of my RainWise rain gauge</a> it&#8217;s time to automatically generate graphs showing the amount of rainfall versus time.</p>
<p>First I log into my NSLU2 via SSH:</p>
<pre>$ ssh 192.168.1.xx

$ uptime
 16:07:28 up 14 days,  3:07,  1 user,  load average: 0.10, 0.06, 0.01</pre>
<p>I can&#8217;t help checking the uptime when I log in. I&#8217;m still amazed by how little maintenance this <a title="Debian on NSLU2 With USB Hard Disk and HomePlug Network" href="http://diagramtips.com/2011/09/05/debian-on-nslu2-with-usb-hard-disk-and-homeplug-network/" target="_blank">small NSLU2 computer</a> requires. This is usually the case with Linux servers, but on top of that is has low power consumption and small form factor &#8211; I almost forget that it&#8217;s there.</p>
<p>Generation of graphs happens automatically so before making any changes to the scripts, I prefer disabling the automatic scripts. This is done via Debian crontab, and I just put a &#8216;hash&#8217; or number sign (#) in front of the command lines to comment them out:</p>
<pre>$ crontab -e

# m h  dom mon dow   command
# */5 * * * * /home/thomas/rrdtool/update_database.sh &amp;&gt; /dev/null
# */5 * * * * /home/thomas/rrdtool/upload_graphs.sh</pre>
<p>Once you have done a crontab edit with the <code>-e</code> option, you can view crontab commands as they are at the moment with the <code>-l</code> option for crontab list. You can format crontab listings as explained in the first line with the &#8216;hash&#8217;. I&#8217;m using the <code>nano</code> editor when editing crontab.</p>
<p>I want to generate graphs based on the rain data and for that I need a data set in the <a title="How to Use RRDtool on Debian NSLU2 to Capture Temperature Data" href="http://diagramtips.com/2011/09/17/how-to-use-rrdtool-on-debian-nslu2-to-capture-temperature-data/" target="_blank">RRDtool database</a>. The old database is deleted and the rain parameter is added to the database generation script:</p>
<pre>$ cd /home/thomas/rrdtool/
$ rm database.rrd
$ nano create_database.sh 

#!/bin/bash
rrdtool create database.rrd --start N --step 300 \
DS:airtemp:GAUGE:600:U:U \
DS:soiltemp:GAUGE:600:U:U \
DS:soilmoist:GAUGE:600:U:U \
DS:rain:GAUGE:600:U:U \
RRA:AVERAGE:0.5:1:12 \
RRA:AVERAGE:0.5:1:288 \
RRA:AVERAGE:0.5:12:168 \
RRA:AVERAGE:0.5:12:720 \
RRA:AVERAGE:0.5:288:365</pre>
<p>In order to generate the <code>database.rrd</code> file the script is executed:</p>
<pre>$ ./create_database.sh</pre>
<p>The main script of the measurement logging system is the <code>update_database.sh</code> script (see below).</p>
<p>There&#8217;s no formatting of the counter data from the circuit inside the rain gauge. The <code>rainread</code> variable is used directly in calculations. I have created a file called <code>rain_count.txt</code>, which contains the counter value as it was 5 minutes ago. This is the time between each execution of the script, so the old value is in a file, and the new value is <a title="How to Read 1-Wire Temperature Using a NSLU2 With Debian" href="http://diagramtips.com/2011/09/11/how-to-read-1-wire-temperature-using-a-nslu2-with-debian/" target="_blank">read from the 1-Wire</a> counter. When these two values are subtracted you get the amount of rain in the last 5 minutes, but it&#8217;s in ticks, or number of buckets. Each tick represents 0.25 mm of rain, and multiplied with the number of ticks, you get the total amount of rain in [mm]. Note that when you&#8217;re doing math in a Linux script, you can make up names for your variables, like <code>rainbuckets</code>, but when you want to use the content of a variable you have to use the dollar sign, like <code>$rainbuckets</code>, or else it will be interpreted as the text &#8216;rainbucket&#8217;. It doesn&#8217;t make sense to multiply a number with a text (apples and bananas).</p>
<p>After the old value in the text file has been used in the calculations, the old value is replaced by the new value, to be used for the next calculation coming up in 5 minutes.</p>
<p>A few lines have been added to produce the rain graphs.</p>
<pre>$ nano update_database.sh 

#!/bin/bash
cd /home/thomas/rrdtool

# Read data from sensors
airtempread=`cat /home/thomas/owfs/10.4F7494010800/temperature`
soiltempread=`cat /home/thomas/owfs/10.06A394010800/temperature`
soilmoistread=`cat /home/thomas/owfs/30.6A1E62120000/current`
rainread=`cat /home/thomas/owfs/1D.50E00D000000/counters.B`

# Format readings
airtemp=`echo $airtempread | cut -c -4`
soiltemp=`echo $soiltempread | cut -c -4`
soilmoist1=`echo $soilmoistread | cut -c -7`

# Calculate soil moisture
drylimit=0.1394
wetlimit=1.338
range=`echo "$wetlimit-$drylimit" | bc`
a=`echo "(-1)*$soilmoist1" | bc`
b=`echo "$a-$drylimit" | bc`
c=`echo "scale=3; $b/$range" | bc`
d=`echo "100*$c" | bc`
soilmoist=`echo $d | cut -c -5`

# Calculate rain
a=`cat /home/thomas/rrdtool/rain_count.txt`
rainbuckets=`echo "$rainread-$a" | bc`
rain=`echo "0.25*$rainbuckets" | bc`
echo $rainread &gt; /home/thomas/rrdtool/rain_count.txt

# Update database
rrdtool update database.rrd N:$airtemp:$soiltemp:$soilmoist:$rain

# Create graphs
#0000FF = blue trace color
#CC6600 = brown trace color

rrdtool graph temp_h.png -y 2:1 --vertical-label "[deg C]" \
--start -1h DEF:airtemp=database.rrd:airtemp:AVERAGE \
DEF:soiltemp=database.rrd:soiltemp:AVERAGE \
LINE1:airtemp#0000FF:"Air temperature [deg C]" \
LINE1:soiltemp#CC6600:"Soil temperature [deg C]"

rrdtool graph temp_d.png -y 2:1 --vertical-label "[deg C]" \
--start -1d DEF:airtemp=database.rrd:airtemp:AVERAGE \
DEF:soiltemp=database.rrd:soiltemp:AVERAGE \
LINE1:airtemp#0000FF:"Air temperature [deg C]" \
LINE1:soiltemp#CC6600:"Soil temperature [deg C]"

rrdtool graph temp_w.png -y 2:1 --vertical-label "[dec C]" \
--start -1w DEF:airtemp=database.rrd:airtemp:AVERAGE \
DEF:soiltemp=database.rrd:soiltemp:AVERAGE \
LINE1:airtemp#0000FF:"Air temperature [deg C]" \
LINE1:soiltemp#CC6600:"Soil temperature [deg C]"

rrdtool graph temp_m.png -y 2:1 --vertical-label "[dec C]" \
--start -1m DEF:airtemp=database.rrd:airtemp:AVERAGE \
DEF:soiltemp=database.rrd:soiltemp:AVERAGE \
LINE1:airtemp#0000FF:"Air temperature [deg C]" \
LINE1:soiltemp#CC6600:"Soil temperature [deg C]"

rrdtool graph temp_y.png -y 2:1 --vertical-label "[dec C]" \
--start -1y DEF:airtemp=database.rrd:airtemp:AVERAGE \
DEF:soiltemp=database.rrd:soiltemp:AVERAGE \
LINE1:airtemp#0000FF:"Air temperature [deg C]" \
LINE1:soiltemp#CC6600:"Soil temperature [deg C]"

rrdtool graph soil_moisture_h.png --vertical-label "[%]" \
--start -1h DEF:soilmoist=database.rrd:soilmoist:AVERAGE \
LINE1:soilmoist#CC6600:"Soil moisture"

rrdtool graph soil_moisture_d.png --vertical-label "[%]" \
--start -1d DEF:soilmoist=database.rrd:soilmoist:AVERAGE \
LINE1:soilmoist#CC6600:"Soil moisture"

rrdtool graph soil_moisture_w.png --vertical-label "[%]" \
--start -1w DEF:soilmoist=database.rrd:soilmoist:AVERAGE \
LINE1:soilmoist#CC6600:"Soil moisture"

rrdtool graph soil_moisture_m.png --vertical-label "[%]" \
--start -1m DEF:soilmoist=database.rrd:soilmoist:AVERAGE \
LINE1:soilmoist#CC6600:"Soil moisture"

rrdtool graph soil_moisture_y.png --vertical-label "[%]" \
--start -1y DEF:soilmoist=database.rrd:soilmoist:AVERAGE \
LINE1:soilmoist#CC6600:"Soil moisture"

rrdtool graph rain_h.png --vertical-label "[mm/5 min]" \
--start -1h DEF:rain=database.rrd:rain:AVERAGE \
LINE1:rain#0000FF:"Rain"

rrdtool graph rain_d.png --vertical-label "[mm/5 min]" \
--start -1d DEF:rain=database.rrd:rain:AVERAGE \
LINE1:rain#0000FF:"Rain"

rrdtool graph rain_w.png --vertical-label "[mm/5 min]" \
--start -1w DEF:rain=database.rrd:rain:AVERAGE \
LINE1:rain#0000FF:"Rain"

rrdtool graph rain_m.png --vertical-label "[mm/5 min]" \
--start -1m DEF:rain=database.rrd:rain:AVERAGE \
LINE1:rain#0000FF:"Rain"

rrdtool graph rain_y.png --vertical-label "[mm/5 min]" \
--start -1y DEF:rain=database.rrd:rain:AVERAGE \
LINE1:rain#0000FF:"Rain"</pre>
<p>Finally, the graph upload script has been updated to include the new graphs:</p>
<pre>$ nano upload_graphs.sh 

#!/bin/bash
sleep 30
lftp -u USER,PASSWORD SERVER &lt;&lt;EOF
cd /temp/
lcd /home/thomas/rrdtool/
put temp_h.png
put temp_d.png
put temp_w.png
put temp_m.png
put temp_y.png
put soil_moisture_h.png
put soil_moisture_d.png
put soil_moisture_w.png
put soil_moisture_m.png
put soil_moisture_y.png
put rain_h.png
put rain_d.png
put rain_w.png
put rain_m.png
put rain_y.png
quit 0
EOF</pre>
<p>When the changes have been made the <code>crontab</code> job is activated again:</p>
<pre>$ crontab -e

# m h  dom mon dow   command
*/5 * * * * /home/thomas/rrdtool/update_database.sh &amp;&gt; /dev/null
*/5 * * * * /home/thomas/rrdtool/upload_graphs.sh</pre>
<p>If you want to inspect your RRDtool database manually you can use <code>rrdtool</code> with the <code>fetch</code> option, which is useful if you want to check if data is stored properly in the database. I used this when I was debugging my script:</p>
<pre>$ rrdtool fetch database.rrd AVERAGE</pre>
<p>The output looks something like this:</p>
<pre>            airtemp        soiltemp       soilmoist        rain
...
1324218600: 1.0633744190e+00 3.6800000000e+00 4.6966255810e+01
3.9866799250e+00
...
1324289100: nan nan nan nan
...</pre>
<p>This is the resulting graph showing the amount of rainfall versus time:</p>
<p><img class="alignnone" title="Rain, day, 2011-12-18, 21:22" src="http://diagramtips.com/images/2011/rain_d_2011_12_18_21_22.png" alt="" width="497" height="163" /></p>
<p>This shows a small test I did while I was outside gardening, so I&#8217;m looking forward to see some real weather data.</p>
<p>I&#8217;m still a bit confused about what unit I should put on the Y axis. The normal rainfall graphs I&#8217;ve seen is actually bar charts, where each bar represents 1 hour or perhaps 6 hours of rainfall, with only [mm] as units on the Y axis. I wouldn&#8217;t say that my graph is wrong, just that my bars are extremely thin, but they do indeed only cover 5 minutes each, and are actually reduced to a 1 pixel wide vertical line. Maybe the &#8216;/5 min&#8217; can be removed. The problem is that I don&#8217;t know enough about RRDtool to make bar charts, but if you have knowledge about this, please leave a comment below &#8211; or any other thoughts that you want to share.</p>
<p>Anyway, the rainfall graph is fun to watch, and even if the values are not absolute, it will give you an idea about what&#8217;s going on in the garden. It will be interesting to compare with the soil moisture graph and see how the soil responds to rain.</p>
<p>The next natural step would be to connect a sprinkler to the NSLU2 and let it control the soil moisture to provide the best growing conditions for plants, and not just do measurements. This is something I&#8217;ve been rambling about for years, so let&#8217;s see when, or if, that happens <img src='http://diagramtips.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  I do have an aquaponics setup that needs electronic pimping too&#8230;</p>
<div class='yarpp-related-rss'>
<p>Related posts:</p><ol>
<li><a href='http://diagramtips.com/2011/12/03/first-test-of-rainwise-1-wire-rain-gauge/' rel='bookmark' title='First Test of RainWise 1-Wire Rain Gauge'>First Test of RainWise 1-Wire Rain Gauge</a></li>
<li><a href='http://diagramtips.com/2011/11/24/1-wire-rain-gauge-pictures/' rel='bookmark' title='1-Wire Rain Gauge Pictures'>1-Wire Rain Gauge Pictures</a></li>
<li><a href='http://diagramtips.com/2011/10/23/watermark-soil-moisture-sensor-probe-calibration/' rel='bookmark' title='Watermark Soil Moisture Sensor Probe Calibration'>Watermark Soil Moisture Sensor Probe Calibration</a></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://diagramtips.com/2011/12/21/linux-scripts-for-rainwise-1-wire-rain-gauge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First Test of RainWise 1-Wire Rain Gauge</title>
		<link>http://diagramtips.com/2011/12/03/first-test-of-rainwise-1-wire-rain-gauge/</link>
		<comments>http://diagramtips.com/2011/12/03/first-test-of-rainwise-1-wire-rain-gauge/#comments</comments>
		<pubDate>Sat, 03 Dec 2011 21:14:08 +0000</pubDate>
		<dc:creator>Thomas Wagner Nielsen</dc:creator>
				<category><![CDATA[1-Wire]]></category>
		<category><![CDATA[NSLU2]]></category>
		<category><![CDATA[reed switch]]></category>
		<category><![CDATA[USB]]></category>

		<guid isPermaLink="false">http://diagramtips.com/?p=519</guid>
		<description><![CDATA[It&#8217;s time to connect the RainWise rain gauge to the rest of the 1-Wire system. (Check out my last blog post for pictures of the rain gauge: 1-Wire Rain Gauge Pictures ) Since my NSLU2 1-Wire system is running 24/7 &#8230; <a href="http://diagramtips.com/2011/12/03/first-test-of-rainwise-1-wire-rain-gauge/">Continue reading <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://diagramtips.com/2011/11/24/1-wire-rain-gauge-pictures/' rel='bookmark' title='1-Wire Rain Gauge Pictures'>1-Wire Rain Gauge Pictures</a></li>
<li><a href='http://diagramtips.com/2011/09/11/how-to-read-1-wire-temperature-using-a-nslu2-with-debian/' rel='bookmark' title='How to Read 1-Wire Temperature Using a NSLU2 With Debian'>How to Read 1-Wire Temperature Using a NSLU2 With Debian</a></li>
<li><a href='http://diagramtips.com/2011/10/03/1-wire-usb-on-a-long-ethernet-cable/' rel='bookmark' title='1-Wire USB on a Long Ethernet Cable'>1-Wire USB on a Long Ethernet Cable</a></li>
</ol>
</div>
]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p>It&#8217;s time to connect the RainWise rain gauge to the rest of the 1-Wire system. (Check out my last blog post for pictures of the rain gauge: <a title="1-Wire rain gauge pictures" href="http://diagramtips.com/2011/11/24/1-wire-rain-gauge-pictures/" target="_blank">1-Wire Rain Gauge Pictures</a> )</p>
<p>Since my <a title="How to Read 1-Wire Temperature Using a NSLU2 With Debian" href="http://diagramtips.com/2011/09/11/how-to-read-1-wire-temperature-using-a-nslu2-with-debian/" target="_blank">NSLU2 1-Wire system</a> is running 24/7 I had to log in and shut it down before making any changes to the bus (IP address is hidden for <del>paranoia</del> security reasons):</p>
<pre>$ ssh 192.168.1.xx
Linux LKGB5E3E5 2.6.26-2-ixp4xx #1 Mon Jun 13 20:24:52 UTC 2011
armv5tel

$ uptime
 09:55:39 up 14 days, 14:37,  1 user,  load average: 0.44, 0.16, 0.05

$ su
# halt</pre>
<p>The <code>uptime</code> command shows that the NSLU2 has been running continuously for 14 days which is pretty cool, since I haven&#8217;t touched it at all, just letting it log data from the sensors and draw graphs.</p>
<p>I bought the rain gauge years ago but the internal battery was still okay and showed a voltage of 3.11 V to be used for the counter memory. I connected the 1-Wire to the USB adapter and turned on the NSLU2. (You could probably just unplug the USB adapter and then make the changes to the 1-Wire bus, but I&#8217;m not sure how OWFS would behave afterwards, so I powered down the NSLU2 in order to keep the test as simple as possible).</p>
<p>OWFS had to be started again after a reboot. This can be done automatically, I just have to figure out how <img src='http://diagramtips.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> . Fortunately OWFS initialized perfectly with the new 1-Wire rain gauge connected to the bus (although it was the only unit connected in order to make a simple test):</p>
<pre>$ su
# /opt/owfs/bin/owfs --allow_other -u /home/thomas/owfs
DEFAULT: ow_usb_msg.c:DS9490_open(276) Opened USB DS9490 bus master
at 1:4.

DEFAULT: ow_usb_cycle.c:DS9490_ID_this_master(191) Set DS9490 1:4
unique id to 81 59 25 27 00 00 00 CE

# exit</pre>
<p>Rushing into the OWFS directory to check if the rain gauge showed up: Yep, it&#8217;s there alright! 1D.50E00D000000 is a new unit:</p>
<pre>$ cd owfs

$ ls -la
total 4
drwxr-xr-x 1 root   root      8 Dec  3 10:17 .
drwxr-xr-x 7 thomas thomas 4096 Sep 28 13:36 ..
drwxrwxrwx 1 root   root      8 Dec  3 10:18 1D.50E00D000000
drwxrwxrwx 1 root   root      8 Dec  3 10:18 81.592527000000
drwxr-xr-x 1 root   root      8 Dec  3 10:17 bus.0
drwxr-xr-x 1 root   root      8 Dec  3 10:17 settings
drwxr-xr-x 1 root   root      8 Dec  3 10:17 statistics
drwxr-xr-x 1 root   root     32 Dec  3 10:17 structure
drwxr-xr-x 1 root   root      8 Dec  3 10:17 system
drwxr-xr-x 1 root   root      8 Dec  3 10:17 uncached</pre>
<p>Checking the contents of the new unit / directory:</p>
<pre>$ cd 1D.50E00D000000/

$ ls -la
total 0
drwxrwxrwx 1 root root   8 Dec  3 10:18 .
drwxr-xr-x 1 root root   8 Dec  3 10:17 ..
-r--r--r-- 1 root root  16 Dec  3 10:17 address
-rw-rw-rw- 1 root root 256 Dec  3 10:17 alias
-r--r--r-- 1 root root  12 Dec  3 10:18 counters.A
-r--r--r-- 1 root root  25 Dec  3 10:18 counters.ALL
-r--r--r-- 1 root root  12 Dec  3 10:18 counters.B
-r--r--r-- 1 root root   2 Dec  3 10:17 crc8
-r--r--r-- 1 root root   2 Dec  3 10:17 family
-r--r--r-- 1 root root  12 Dec  3 10:17 id
-r--r--r-- 1 root root  16 Dec  3 10:17 locator
-rw-rw-rw- 1 root root 512 Dec  3 10:17 memory
-rw-rw-rw- 1 root root  12 Dec  3 10:18 mincount
drwxrwxrwx 1 root root   8 Dec  3 10:18 pages
-r--r--r-- 1 root root  16 Dec  3 10:17 r_address
-r--r--r-- 1 root root  12 Dec  3 10:17 r_id
-r--r--r-- 1 root root  16 Dec  3 10:17 r_locator
-r--r--r-- 1 root root  32 Dec  3 10:17 type</pre>
<p>The <code>counters.A</code> file is empty but <code>counters.B</code> contains the data:</p>
<pre>$ cat counters.A
           0

$ cat counters.B
        2091</pre>
<p>Apparently the reed switch was activated 2091 times since production <img src='http://diagramtips.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>I flipped the small white internal rain bucket a couple of times and verified that the counter is actually working:</p>
<pre>$ cat counters.B
        2093</pre>
<p>The .ALL register / file holds both the A and B counter:</p>
<pre>$ cat counters.ALL
           0,        2095</pre>
<p>After this small test of the counters I installed the rain gauge outside in a garden bed:</p>
<p><img class="alignnone" title="Rain gauge, RainWise, garden" src="http://diagramtips.com/images/2011/rain_gauge_rainwise_garden.jpg" alt="" width="356" height="400" /></p>
<p>I&#8217;m pretty sure this is the first time I have appreciated the cold December rain <img src='http://diagramtips.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':-D' class='wp-smiley' />  Gotta do some testing, right?</p>
<p>With really cold hands from the wiring job outside I turned on the <a title="Debian on NSLU2 With USB Hard Disk and Homeplug Network" href="http://diagramtips.com/2011/09/05/debian-on-nslu2-with-usb-hard-disk-and-homeplug-network/" target="_blank">NSLU2</a> again, and what a relief &#8211; all the 1-Wire units were up and running in the OWFS directory:</p>
<pre>$ cd owfs

$ ls -la
total 4
drwxr-xr-x 1 root   root      8 Dec  3 13:12 .
drwxr-xr-x 7 thomas thomas 4096 Sep 28 13:36 ..
drwxrwxrwx 1 root   root      8 Dec  3 13:12 10.06A394010800
drwxrwxrwx 1 root   root      8 Dec  3 13:12 10.4F7494010800
drwxrwxrwx 1 root   root      8 Dec  3 13:12 1D.50E00D000000
drwxrwxrwx 1 root   root      8 Dec  3 13:12 30.6A1E62120000
drwxrwxrwx 1 root   root      8 Dec  3 13:12 81.592527000000
drwxr-xr-x 1 root   root      8 Dec  3 13:12 alarm
drwxr-xr-x 1 root   root      8 Dec  3 13:12 bus.0
drwxr-xr-x 1 root   root      8 Dec  3 13:12 settings
drwxrwxrwx 1 root   root      8 Dec  3 13:12 simultaneous
drwxr-xr-x 1 root   root      8 Dec  3 13:12 statistics
drwxr-xr-x 1 root   root     32 Dec  3 13:12 structure
drwxr-xr-x 1 root   root      8 Dec  3 13:12 system
drwxr-xr-x 1 root   root      8 Dec  3 13:12 uncached</pre>
<p>Things tend to get a bit harder when you have to build electronics outside in the rain with mud everywhere. If any of the outdoor sensors are going to be moved I have to find an easier and more robust way of connecting the 1-Wire units together. It is easier to use terminal strips compared to soldering and heat shrink, but you still have to provide some weather protection. There&#8217;s probably some better solution out there that will cost me a fortune.</p>
<p>Anyway, the counter in the rain gauge tells us that the internal measuring cup flipped several times during the installation in the garden (it was 2095 before installation):</p>
<pre>$ cd 1D.50E00D000000/
$ cat counters.B
        2109</pre>
<p>Just for fun I slowly emptied a cup of water into the rain gauge, and I could clearly hear the internal cup flipping from side to side:</p>
<pre>$ cat counters.B
        2135</pre>
<p>Now that I&#8217;m confident that the rain gauge is properly set up and working it&#8217;s time to pack up the tools, go back inside and come up with a script that will create a nice graph showing how much it rains as time goes by.</p>
<div class='yarpp-related-rss'>
<p>Related posts:</p><ol>
<li><a href='http://diagramtips.com/2011/11/24/1-wire-rain-gauge-pictures/' rel='bookmark' title='1-Wire Rain Gauge Pictures'>1-Wire Rain Gauge Pictures</a></li>
<li><a href='http://diagramtips.com/2011/09/11/how-to-read-1-wire-temperature-using-a-nslu2-with-debian/' rel='bookmark' title='How to Read 1-Wire Temperature Using a NSLU2 With Debian'>How to Read 1-Wire Temperature Using a NSLU2 With Debian</a></li>
<li><a href='http://diagramtips.com/2011/10/03/1-wire-usb-on-a-long-ethernet-cable/' rel='bookmark' title='1-Wire USB on a Long Ethernet Cable'>1-Wire USB on a Long Ethernet Cable</a></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://diagramtips.com/2011/12/03/first-test-of-rainwise-1-wire-rain-gauge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>1-Wire Rain Gauge Pictures</title>
		<link>http://diagramtips.com/2011/11/24/1-wire-rain-gauge-pictures/</link>
		<comments>http://diagramtips.com/2011/11/24/1-wire-rain-gauge-pictures/#comments</comments>
		<pubDate>Thu, 24 Nov 2011 13:19:33 +0000</pubDate>
		<dc:creator>Thomas Wagner Nielsen</dc:creator>
				<category><![CDATA[1-Wire]]></category>
		<category><![CDATA[NSLU2]]></category>
		<category><![CDATA[rain gauge]]></category>
		<category><![CDATA[reed switch]]></category>

		<guid isPermaLink="false">http://diagramtips.com/?p=487</guid>
		<description><![CDATA[This is the newest addition to my 1-Wire system: A rain gauge from RainWise, with Hobby-Boards.com electronics inside. Picture of rain gauge: I bought this several years ago when I began my gardening frenzy, but never had a chance to &#8230; <a href="http://diagramtips.com/2011/11/24/1-wire-rain-gauge-pictures/">Continue reading <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss yarpp-related-none'>

No related posts.
</div>
]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p>This is the newest addition to my <a title="How to Read 1-Wire Temperature Using a NSLU2 With Debian" href="http://diagramtips.com/2011/09/11/how-to-read-1-wire-temperature-using-a-nslu2-with-debian/" target="_blank">1-Wire system</a>: A rain gauge from RainWise, with Hobby-Boards.com electronics inside.</p>
<p>Picture of rain gauge:</p>
<p><img class="alignnone" title="Rain gauge, RainWise" src="http://diagramtips.com/images/2011/rain_gauge_rainwise.jpg" alt="Rain gauge, RainWise" width="400" height="304" /></p>
<p>I bought this several years ago when I began my gardening frenzy, but never had a chance to install it before now. Well, of course I had, but I think my basic 1-Wire system had to mature a bit first, which it has and it&#8217;s running very well now, so it&#8217;s time to add more to the system.</p>
<p>The rain gauge has a filter at the bottom to keep leaves out of the internal mechanics:</p>
<p><img class="alignnone" title="Rain gauge, RainWise, filter" src="http://diagramtips.com/images/2011/rain_gauge_rainwise_filter.jpg" alt="Rain gauge, RainWise, filter" width="400" height="287" /></p>
<p>I like the fact that the whole thing is black, which I hope will cause any snow to melt in the heat absorbed from the sun, so that snow will be counted as precipitation too. After all, it is falling down from the sky too, which is what I want to measure. It will probably eat hail too.</p>
<p>The rain gauge consists of a <a title="1-Wire USB on a Long Ethernet Cable" href="http://diagramtips.com/2011/10/03/1-wire-usb-on-a-long-ethernet-cable/" target="_blank">long 1-Wire cable</a>, a white plastic cup with two compartments, adjustment screws and a PCB:</p>
<p><img class="alignnone" title="Rain gauge, RainWise, parts" src="http://diagramtips.com/images/2011/rain_gauge_rainwise_parts.jpg" alt="Rain gauge, RainWise, parts" width="400" height="306" /></p>
<p>The amount of rain is measured by registering how many times one of the compartments of the white cup is filled. Each time a compartment is filled, the cup tips over and creates a pulse with a reed switch.</p>
<p><img class="alignnone" title="Rain gauge, RainWise, cup, reed magnetic switch" src="http://diagramtips.com/images/2011/rain_gauge_rainwise_cup.jpg" alt="Rain gauge, RainWise, cup, reed magnetic switch" width="400" height="301" /></p>
<p>The reed switch is connected to a PCB with a counter and a backup battery. The PCB also takes care of the 1-Wire communication:</p>
<p><img class="alignnone" title="Rain gauge, RainWise, PCB, battery" src="http://diagramtips.com/images/2011/rain_gauge_rainwise_pcb_battery.jpg" alt="Rain gauge, RainWise, PCB, battery" width="400" height="393" /></p>
<p><img class="alignnone" title="Rain gauge, RainWise, PCB secondary side" src="http://diagramtips.com/images/2011/rain_gauge_rainwise_pcb_secondary_side.jpg" alt="Rain gauge, RainWise, PCB secondary side" width="400" height="357" /></p>
<p>I want to connect this rain gauge to my existing <a title="Automatic Temperature Measurements Using NSLU2" href="http://diagramtips.com/2011/08/31/automatic-temperature-measurements-using-nslu2/" target="_blank">Debian NSLU2 1-Wire system</a> to be able to add more data to my RRDtool graphs.</p>
<p>If you want to see a really complex 1-Wire system you should definitely check out the house monitoring project made by Silvano Gai at <a title="House monitoring project" href="http://ip6.com/projects/" target="_blank">http://ip6.com/projects/</a>.</p>
<div class='yarpp-related-rss yarpp-related-none'>
<p>No related posts.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://diagramtips.com/2011/11/24/1-wire-rain-gauge-pictures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Calculate the Calibration of Watermark Moisture Sensors for Soil</title>
		<link>http://diagramtips.com/2011/11/08/how-to-calculate-the-calibration-of-watermark-moisture-sensors-for-soil/</link>
		<comments>http://diagramtips.com/2011/11/08/how-to-calculate-the-calibration-of-watermark-moisture-sensors-for-soil/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 07:48:10 +0000</pubDate>
		<dc:creator>Thomas Wagner Nielsen</dc:creator>
				<category><![CDATA[1-Wire]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Hobby-Boards]]></category>
		<category><![CDATA[NSLU2]]></category>
		<category><![CDATA[soil moisture sensor]]></category>
		<category><![CDATA[Watermark]]></category>

		<guid isPermaLink="false">http://diagramtips.com/?p=446</guid>
		<description><![CDATA[My 1-Wire Watermark soil moisture sensor board from Hobby-Boards generates a negative number ranging from -1.338 when fully wet to -0.1394 when totally dry. These are the limits and normal everyday readings fall in between these limits. I already had &#8230; <a href="http://diagramtips.com/2011/11/08/how-to-calculate-the-calibration-of-watermark-moisture-sensors-for-soil/">Continue reading <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://diagramtips.com/2011/10/23/watermark-soil-moisture-sensor-probe-calibration/' rel='bookmark' title='Watermark Soil Moisture Sensor Probe Calibration'>Watermark Soil Moisture Sensor Probe Calibration</a></li>
</ol>
</div>
]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p>My <a title="1-Wire USB on a Long Ethernet Cable" href="http://diagramtips.com/2011/10/03/1-wire-usb-on-a-long-ethernet-cable/" target="_blank">1-Wire</a> Watermark soil moisture sensor board from Hobby-Boards generates a negative number ranging from -1.338 when fully wet to -0.1394 when totally dry. These are the limits and normal everyday readings fall in between these limits.</p>
<p>I already had a basic script <a title="How to Read 1-Wire Temperature Using a NSLU2 with Debian" href="http://diagramtips.com/2011/09/11/how-to-read-1-wire-temperature-using-a-nslu2-with-debian/" target="_blank">installed on my NSLU2</a> in order to find the limits to be used for calibration, so I just need to update the calculation section with the limits and the necessary math to get a readout in percent instead [%]:</p>
<pre># Calculate soil moisture
drylimit=0.1394
wetlimit=1.338
range=`echo "$wetlimit-$drylimit" | bc`
a=`echo "(-1)*$soilmoist1" | bc`
b=`echo "$a-$drylimit" | bc`
c=`echo "scale=3; $b/$range" | bc`
d=`echo "100*$c" | bc`
soilmoist=`echo $d | cut -c -5`</pre>
<p>The original script called <code>update_database.sh</code> is shown in this post: <a title="Watermark Soil Moisture Sensor Probe Calibration" href="http://diagramtips.com/2011/10/23/watermark-soil-moisture-sensor-probe-calibration/" target="_blank">Watermark Soil Moisture Sensor Probe Calibration</a></p>
<p>With this new modification the soil moisture graph will now show the data in percent:</p>
<p><img class="alignnone" title="Soil moisture, day, 2011-11-08" src="http://diagramtips.com/images/2011/soil_moisture_d_2011_11_08.png" alt="" width="497" height="163" /></p>
<p>It shows a remarkably steady low moisture content, but again, it hasn&#8217;t rained for days, perhaps even weeks, so for now I trust that this graphs is telling the truth. Time will tell if the system is stuck at this level, or if the rain will be able to change the curve.</p>
<div class='yarpp-related-rss'>
<p>Related posts:</p><ol>
<li><a href='http://diagramtips.com/2011/10/23/watermark-soil-moisture-sensor-probe-calibration/' rel='bookmark' title='Watermark Soil Moisture Sensor Probe Calibration'>Watermark Soil Moisture Sensor Probe Calibration</a></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://diagramtips.com/2011/11/08/how-to-calculate-the-calibration-of-watermark-moisture-sensors-for-soil/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Watermark Soil Moisture Sensor Probe Calibration</title>
		<link>http://diagramtips.com/2011/10/23/watermark-soil-moisture-sensor-probe-calibration/</link>
		<comments>http://diagramtips.com/2011/10/23/watermark-soil-moisture-sensor-probe-calibration/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 12:14:12 +0000</pubDate>
		<dc:creator>Thomas Wagner Nielsen</dc:creator>
				<category><![CDATA[1-Wire]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Temperature]]></category>
		<category><![CDATA[Daisy Chain]]></category>
		<category><![CDATA[soil moisture sensor]]></category>
		<category><![CDATA[USB]]></category>
		<category><![CDATA[Watermark]]></category>

		<guid isPermaLink="false">http://diagramtips.com/?p=388</guid>
		<description><![CDATA[OWFS and the 1-Wire bus are able to handle several 1-Wire units at a time and I want to display air and soil temperature together in the same graph, and also add a Watermark soil moisture sensor to the system. &#8230; <a href="http://diagramtips.com/2011/10/23/watermark-soil-moisture-sensor-probe-calibration/">Continue reading <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://diagramtips.com/2011/10/03/1-wire-usb-on-a-long-ethernet-cable/' rel='bookmark' title='1-Wire USB on a Long Ethernet Cable'>1-Wire USB on a Long Ethernet Cable</a></li>
</ol>
</div>
]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p><a title="How to Read 1-Wire Temperature Using a NSLU2 with Debian" href="http://diagramtips.com/2011/09/11/how-to-read-1-wire-temperature-using-a-nslu2-with-debian/" target="_blank">OWFS</a> and the 1-Wire bus are able to handle several 1-Wire units at a time and I want to display air and soil temperature together in the same graph, and also add a Watermark soil moisture sensor to the system. The soil moisture sensor is controlled by a PCB from <a title="Hobby-Boards.com" href="http://www.hobby-boards.com/" target="_blank">Hobby-Boards.com</a>, but the temperature sensors are connected directly to the <a title="1-Wire USB on a Long Ethernet Cable" href="http://diagramtips.com/2011/10/03/1-wire-usb-on-a-long-ethernet-cable/" target="_blank">1-Wire bus in a daisy chain</a>.</p>
<p>When the units are connected they show up in the <code>owfs</code> directory. <code>10.x...</code> are temperature sensors, <code>30.6...</code> is the ground moisture sensor circuit board, and <code>81.5...</code> is the USB-to-1-Wire adapter:</p>
<pre>$ ssh 192.168.1.xx
$ cd owfs
$ ls -la

total 4
drwxr-xr-x 1 root   root      8 Oct 19 13:58 .
drwxr-xr-x 7 thomas thomas 4096 Sep 28 13:36 ..
drwxrwxrwx 1 root   root      8 Oct 19 15:39 10.06A394010800
drwxrwxrwx 1 root   root      8 Oct 19 15:39 10.4F7494010800
drwxrwxrwx 1 root   root      8 Oct 19 15:39 30.6A1E62120000
drwxrwxrwx 1 root   root      8 Oct 19 15:39 81.592527000000
drwxr-xr-x 1 root   root      8 Oct 19 13:58 alarm
drwxr-xr-x 1 root   root      8 Oct 19 13:58 bus.0
drwxr-xr-x 1 root   root      8 Oct 19 13:58 settings
drwxrwxrwx 1 root   root      8 Oct 19 15:39 simultaneous
drwxr-xr-x 1 root   root      8 Oct 19 13:58 statistics
drwxr-xr-x 1 root   root     32 Oct 19 13:58 structure
drwxr-xr-x 1 root   root      8 Oct 19 13:58 system
drwxr-xr-x 1 root   root      8 Oct 19 13:58 uncached</pre>
<p>My previous system only had a single temperature sensor connected to it, so I delete the old RRDtool database:</p>
<pre>$ cd /home/thomas/rrdtool/
$ rm database.rrd
$ nano create_database.sh</pre>
<p>and add the new temperature sensor and the soil moisture sensor (<code>soiltemp</code> and <code>soilmoist</code>) to a new database using the <code>create_database.sh</code> script:</p>
<pre>#!/bin/bash
rrdtool create database.rrd --start N --step 300 \
DS:airtemp:GAUGE:600:U:U \
DS:soiltemp:GAUGE:600:U:U \
DS:soilmoist:GAUGE:600:U:U \
RRA:AVERAGE:0.5:1:12 \
RRA:AVERAGE:0.5:1:288 \
RRA:AVERAGE:0.5:12:168 \
RRA:AVERAGE:0.5:12:720 \
RRA:AVERAGE:0.5:288:365</pre>
<p>(Check out my other post about RRDtool for more details on how to get the logging system up and running: <a title="How to Use RRDtool on Debian NSLU2 to Capture Temperature Data" href="http://diagramtips.com/2011/09/17/how-to-use-rrdtool-on-debian-nslu2-to-capture-temperature-data/" target="_blank">How to Use RRDtool on Debian NSLU2 to Capture Temperature Data</a>).</p>
<p>The <code>update_database.sh</code> script also needs an update to include the soil temperature data and the soil moisture data:</p>
<pre>#!/bin/bash
cd /home/thomas/rrdtool

# Read data from sensors
airtempread=`cat /home/thomas/owfs/10.4F7494010800/temperature`
soiltempread=`cat /home/thomas/owfs/10.06A394010800/temperature`
soilmoistread=`cat /home/thomas/owfs/30.6A1E62120000/current`

# Format reading
airtemp=`echo $airtempread | cut -c -4`
soiltemp=`echo $soiltempread | cut -c -4`
soilmoist1=`echo $soilmoistread | cut -c -7`

# Calculate soil moisture
a=`echo "(-1)*$soilmoist1" | bc`
soilmoist=`echo $a | cut -c -5`

# Update database
rrdtool update database.rrd N:$airtemp:$soiltemp:$soilmoist

# Create graphs
#0000FF = blue trace color
#CC6600 = brown trace color

rrdtool graph temp_h.png -y 2:1 --vertical-label "[deg C]" \
--start -1h DEF:airtemp=database.rrd:airtemp:AVERAGE \
DEF:soiltemp=database.rrd:soiltemp:AVERAGE \
LINE1:airtemp#0000FF:"Air temperature [deg C]" \
LINE1:soiltemp#CC6600:"Soil temperature [deg C]"

rrdtool graph temp_d.png -y 2:1 --vertical-label "[deg C]" \
--start -1d DEF:airtemp=database.rrd:airtemp:AVERAGE \
DEF:soiltemp=database.rrd:soiltemp:AVERAGE \
LINE1:airtemp#0000FF:"Air temperature [deg C]" \
LINE1:soiltemp#CC6600:"Soil temperature [deg C]"

rrdtool graph temp_w.png -y 2:1 --vertical-label "[dec C]" \
--start -1w DEF:airtemp=database.rrd:airtemp:AVERAGE \
DEF:soiltemp=database.rrd:soiltemp:AVERAGE \
LINE1:airtemp#0000FF:"Air temperature [deg C]" \
LINE1:soiltemp#CC6600:"Soil temperature [deg C]"

rrdtool graph temp_m.png -y 2:1 --vertical-label "[dec C]" \
--start -1m DEF:airtemp=database.rrd:airtemp:AVERAGE \
DEF:soiltemp=database.rrd:soiltemp:AVERAGE \
LINE1:airtemp#0000FF:"Air temperature [deg C]" \
LINE1:soiltemp#CC6600:"Soil temperature [deg C]"

rrdtool graph temp_y.png -y 2:1 --vertical-label "[dec C]" \
--start -1y DEF:airtemp=database.rrd:airtemp:AVERAGE \
DEF:soiltemp=database.rrd:soiltemp:AVERAGE \
LINE1:airtemp#0000FF:"Air temperature [deg C]" \
LINE1:soiltemp#CC6600:"Soil temperature [deg C]"

rrdtool graph soil_moisture_h.png --vertical-label "[]" \
--start -1h DEF:soilmoist=database.rrd:soilmoist:AVERAGE \
LINE1:soilmoist#CC6600:"Soil moisture"

rrdtool graph soil_moisture_d.png --vertical-label "[]" \
--start -1d DEF:soilmoist=database.rrd:soilmoist:AVERAGE \
LINE1:soilmoist#CC6600:"Soil moisture"

rrdtool graph soil_moisture_w.png --vertical-label "[]" \
--start -1w DEF:soilmoist=database.rrd:soilmoist:AVERAGE \
LINE1:soilmoist#CC6600:"Soil moisture"

rrdtool graph soil_moisture_m.png --vertical-label "[]" \
--start -1m DEF:soilmoist=database.rrd:soilmoist:AVERAGE \
LINE1:soilmoist#CC6600:"Soil moisture"

rrdtool graph soil_moisture_y.png --vertical-label "[]" \
--start -1y DEF:soilmoist=database.rrd:soilmoist:AVERAGE \
LINE1:soilmoist#CC6600:"Soil moisture"</pre>
<p>Watermark soil moisture sensor circuits need to be calibrated before the system will produce any meaningful results. Therefore the calculation in the above script is limited to converting from a negative to a positive readout, by multiplying with -1. In order to make the calibration you need the minimum and maximum value and afterwards convert to a percentage, i.e. minimum corresponds to a totally dry sensor, and maximum corresponds to a totally wet sensor.</p>
<p>With the raw soil moisture data now available the <code>upload_graphs.sh</code> script needs to be updated to upload the new graphs too:</p>
<pre>#!/bin/bash
sleep 30
lftp -u USER,PASSWORD SERVER &lt;&lt;EOF
cd /temp/
lcd /home/thomas/rrdtool/
put temp_h.png
put temp_d.png
put temp_w.png
put temp_m.png
put temp_y.png
put soil_moisture_h.png
put soil_moisture_d.png
put soil_moisture_w.png
put soil_moisture_m.png
put soil_moisture_y.png
quit 0
EOF</pre>
<p>Using the above scripts will produce graphs that contain both the air temperature and the soil temperature in the same graph.</p>
<p>Data from the soil moisture circuit are displayed in another graph:</p>
<p><img class="alignnone" title="Temperature, 2011-10-20" src="http://diagramtips.com/images/2011/temp_d_2011_10_20.png" alt="" width="497" height="163" /></p>
<p><img class="alignnone" title="Soil moisture, 2011-10-14" src="http://diagramtips.com/images/2011/soil_moisture_d_2011_10_14.png" alt="" width="497" height="163" /></p>
<p>Note that there&#8217;s no unit on the Y-axis because it&#8217;s still the raw data coming from the soil moisture sensor circuit. The reason for the fast drop shown in the graph is that during calibration I&#8217;m controlling the actual moisture. This is not your usual kitchen table project &#8211; it turned into a kitchen <em>floor</em> project <img src='http://diagramtips.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  :</p>
<p><img class="alignnone" title="NSLU2, oven" src="http://diagramtips.com/images/2011/nslu2_oven.jpg" alt="" width="400" height="324" /></p>
<p>When I had the Watermark soil moisture probe installed in my previous garden I noticed a strong dependence on soil temperature, which I wanted to compensate for in this new installation. This is a graph produced by my old set up:</p>
<p><img class="alignnone" title="Log, soil moisture, w14 2009" src="http://diagramtips.com/images/2011/log_soil_moisture_w_14_2009.png" alt="" width="497" height="168" /></p>
<p>You do get a general idea about the soil moisture content, but the temperature influence is clear, as each number on the X-axis represents day of month and the temperature drops each night.</p>
<p>I used an oven and a freezer during calibration to find the real minimum and maximum values, that the system is able to produce.</p>
<p><img class="alignnone" title="Watermark soil moisture sensor, ice" src="http://diagramtips.com/images/2011/watermark_soil_moisture_sensor_ice.jpg" alt="" width="400" height="316" /></p>
<p>I had hoped that I could do some math in my scripts and remove this temperature dependence but after seeing the graph for the raw minimum and maximum data produced during calibration I realized that it&#8217;s not possible to that after all.</p>
<p>To the left on the X-axis I have a completely dry sensor (using the hot air fan in my oven), and to the right the sensor is completely soaked in a bowl of water:</p>
<p><img class="alignnone" title="Watermark sensor calibration" src="http://diagramtips.com/images/2011/watermark_sensor_calibration.jpg" alt="" width="500" height="268" /></p>
<p>The graph do show the temperature dependence, but the problem is that the error due to temperature is dependent on the actual soil moisture content, which is also the parameter I want to measure. So to make the correct adjustment, in order to calculate the actual moisture, I would need to know the actual moisture, which is impossible, since the actual moisture is what I wanted to measure in the first place. I guess I had hoped that the two lines would have been parallel, so that the temperature error would have been the same no matter what the actual moisture was. We&#8217;re moving into the field of physics, but the question still is: What is the maximum value to be used for calibration?</p>
<p>If the average value of 1.0 is used you&#8217;ll get measurements showing more than 100 % when the temperature exceeds 20 deg. C and the sensor is soaked. Choosing 0.7 will only make it worse. If 1.3 is chosen as maximum value the measurements will always be too low, but I&#8217;ll use this value in a new script to get the readout converted to a percentage. I&#8217;ll show the math and new graphs in my next blog post.</p>
<p>(Update 2011-11-08: Check out my new script: <a title="How to Calculate the Calibration of Watermark Moisture Sensors for Soil" href="http://diagramtips.com/2011/11/08/how-to-calculate-the-calibration-of-watermark-moisture-sensors-for-soil/" target="_blank">Watermark soil moisture sensors calibration calculator</a>)</p>
<div class='yarpp-related-rss'>
<p>Related posts:</p><ol>
<li><a href='http://diagramtips.com/2011/10/03/1-wire-usb-on-a-long-ethernet-cable/' rel='bookmark' title='1-Wire USB on a Long Ethernet Cable'>1-Wire USB on a Long Ethernet Cable</a></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://diagramtips.com/2011/10/23/watermark-soil-moisture-sensor-probe-calibration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>1-Wire USB on a Long Ethernet Cable</title>
		<link>http://diagramtips.com/2011/10/03/1-wire-usb-on-a-long-ethernet-cable/</link>
		<comments>http://diagramtips.com/2011/10/03/1-wire-usb-on-a-long-ethernet-cable/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 11:30:26 +0000</pubDate>
		<dc:creator>Thomas Wagner Nielsen</dc:creator>
				<category><![CDATA[1-Wire]]></category>
		<category><![CDATA[Temperature]]></category>
		<category><![CDATA[Daisy Chain]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[DS18S20]]></category>
		<category><![CDATA[DS2760]]></category>
		<category><![CDATA[Ethernet cable]]></category>
		<category><![CDATA[NSLU2]]></category>
		<category><![CDATA[owfs]]></category>
		<category><![CDATA[USB]]></category>
		<category><![CDATA[Watermark probe]]></category>

		<guid isPermaLink="false">http://diagramtips.com/?p=324</guid>
		<description><![CDATA[Units on 1-Wire bus must be connected in a daisy chain, which means you&#8217;ll have a lot of different connection points along the bus cable, in my case an ordinary Ethernet cable. This has been a problem for me earlier &#8230; <a href="http://diagramtips.com/2011/10/03/1-wire-usb-on-a-long-ethernet-cable/">Continue reading <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://diagramtips.com/2011/09/11/how-to-read-1-wire-temperature-using-a-nslu2-with-debian/' rel='bookmark' title='How to Read 1-Wire Temperature Using a NSLU2 With Debian'>How to Read 1-Wire Temperature Using a NSLU2 With Debian</a></li>
<li><a href='http://diagramtips.com/2011/09/05/debian-on-nslu2-with-usb-hard-disk-and-homeplug-network/' rel='bookmark' title='Debian on NSLU2 With USB Hard Disk and Homeplug Network'>Debian on NSLU2 With USB Hard Disk and Homeplug Network</a></li>
<li><a href='http://diagramtips.com/2011/08/31/automatic-temperature-measurements-using-nslu2/' rel='bookmark' title='Automatic Temperature Measurements Using NSLU2'>Automatic Temperature Measurements Using NSLU2</a></li>
</ol>
</div>
]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p>Units on 1-Wire bus must be connected in a daisy chain, which means you&#8217;ll have a lot of different connection points along the bus cable, in my case an ordinary Ethernet cable. This has been a problem for me earlier since my cable was placed outdoors for air and soil <a title="Automatic Temperature Measurements Using NSLU2" href="http://diagramtips.com/2011/08/31/automatic-temperature-measurements-using-nslu2/" target="_blank">temperature measurements</a>, and soil moisture measurements. I actually need a connection point to the 1-Wire bus at each unit I connect to the cable, because of the daisy chain topology. In order to make these connections somewhat weatherproof I chose to solder any cable joints together and cover it with heat shrink. This has worked well and my old outdoor system collected data for almost a year, before I took it down again when I had to move to another house.</p>
<p>But the soldered joints also gave me problems, because it was hard to make adjustments afterwards, like moving a unit, because the cables would have a fixed length, or taking a unit indoors for repair. This can of course be solved by investing in high quality outdoor enclosures for each unit or cable joint but since this weather data collection project is a hobby there not any immediate return on this relatively large investment. However, if you are getting paid to build this, you should be aware that the system would have a much longer lifetime if you mount the units and joints in a weather proof enclosure. But let&#8217;s stick with the hobby type of project for a while.</p>
<p>I wanted to make it easier to modify the physical setup of the system, and one of the easiest ways to connect wires is by using terminal strips:</p>
<p>(There&#8217;s a DS18S20 1-Wire IC wrapped in heat shrink to the left in the picture.)</p>
<p><img class="alignnone" title="DS18S20 Ethernet cable terminal strip" src="http://diagramtips.com/images/2011/ds18s20_ethernet_cable_terminal_strip.jpg" alt="" width="400" height="281" /></p>
<p>The 1-Wire bus uses only 2 wires (?&#8230;) for communication and power transfer. (I guess the name is referring to the communication part.)</p>
<p>A small test showed that the bus worked just fine through the terminal strip (and 17 m ~ 56 ft of Ethernet cable), which makes my life a whole lot easier, as I&#8217;m now able to modify the physical setup in many ways, without going outside with my soldering iron in the middle of the snow to replace a unit &#8211; brrr&#8230; Just bring a screwdriver.</p>
<p>For soil temperature measurements I have glued a DS18S20 temperature sensor onto an aluminium sheet. Note the two cables due to the daisy chain topology:</p>
<p><img class="alignnone" title="DS18S20 terminal strip aluminium plate" src="http://diagramtips.com/images/2011/ds18s20_terminal_strip_aluminium_plate.jpg" alt="" width="400" height="365" /></p>
<p>I assume that the metal sheet will give a good average temperature as is has some mass and therefore filters out high frequency temperature changes. The large area helps averaging the temperature too.</p>
<p>This is all of the components in the 1-Wire system so far:</p>
<p><img class="alignnone" title="DS18S20 DS2760 Watermark soil moisture sensor" src="http://diagramtips.com/images/2011/ds18s20_ds2760_watermark_soil_moisture_sensor.jpg" alt="" width="400" height="221" /></p>
<ul>
<li>To the left: DS18S20 temperature sensor, for air temperature measurements</li>
<li>Aluminium sheet: DS18S20 temperature sensor, for soil temperature measurements</li>
<li>In the middle: DS2760 PCB, for soil moisture measurements</li>
<li>To the right: Watermark soil moisture probe</li>
</ul>
<p>The DS2760 PCB has been installed in my previous garden, in a cheap plastic enclosure, wrapped in a plastic bag, but the PCB survived for several months in all kinds of weather. It still looks new with no corrosion at all. The plastic enclosure has changed color due to sunlight:</p>
<p><img class="alignnone" title="DS2760 PCB terminal strip" src="http://diagramtips.com/images/2011/ds2760_pcb_terminal_strip.jpg" alt="" width="355" height="400" /></p>
<p>I&#8217;ll also be using terminal strips for this unit and see what happens regarding corrosion.</p>
<p>The soil moisture sensor part of this system is a bit special because the circuit board needs 12 volts to function, which I&#8217;m injecting into the Ethernet cable using the brown wire pair, next to the 1-Wire bus carried by the blue wire pair. The extra voltage is generated by a generic mains adapter, protected by a fuse (red and black wires in the picture below):</p>
<p><img class="alignnone" title="1-Wire, DS9490R USB, 12 volt, fuse, terminal strip" src="http://diagramtips.com/images/2011/1_wire_ds9490r_usb_12_volt_fuse_terminal_strip.jpg" alt="" width="400" height="375" /></p>
<p>I have mounted the sensor for air temperature measurements on a stick and covered the sensor with a small cap with tin foil on it to reflect the sun:</p>
<p><img class="alignnone" title="DS18S20 tin foil hat stick" src="http://diagramtips.com/images/2011/ds18s20_tin_foil_hat_stick.jpg" alt="" width="331" height="400" /></p>
<p>I also need a barrier between the soil and the soil temperature sensor (hopefully this is not a biodegradable plastic bag <img src='http://diagramtips.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ):</p>
<p><img class="alignnone" title="DS18S20, terminal strip, aluminium plate, plastic bag" src="http://diagramtips.com/images/2011/ds18s20_terminal_strip_aluminium_plate_plastic_bag.jpg" alt="" width="400" height="393" /></p>
<p>The soil moisture sensor circuit is tied to a stick and covered with a plastic bag to provide some protection from the weather:</p>
<p><img class="alignnone" title="Soil moisture sensor circuit enclosure" src="http://diagramtips.com/images/2011/soil_moisture_sensor_circuit_enclosure.jpg" alt="" width="137" height="400" /></p>
<p><img class="alignnone" title="Soil moisture sensor circuit enclosure, plastic bag" src="http://diagramtips.com/images/2011/soil_moisture_sensor_circuit_enclosure_plastic_bag.jpg" alt="" width="136" height="400" /></p>
<p>Again, if you want a more reliable setup you should use a weather proof enclosure, but I haven&#8217;t experienced any problems so far, although it would be an obvious upgrade to make in the future.</p>
<p>The NSLU2 is placed indoors to protect it against the weather, but I have to get the signals and power outside to the sensors, so I have to go through the window. Since this is a rented house I don&#8217;t want to drill large holes in the window frame, so I have removed the extra four wires in the Ethernet cable to be able to close the window without cutting any wires accidentally. Using two different sizes of heat shrink I&#8217;m able to make a pretty discreet transition from the indoor to the outdoor environment:</p>
<p><img class="alignnone" title="1-Wire Ethernet cable joint, window" src="http://diagramtips.com/images/2011/1_wire_ethernet_cable_joint_window.jpg" alt="" width="400" height="254" /></p>
<p><img class="alignnone" title="1-Wire Ethernet cable, heat shrink, window" src="http://diagramtips.com/images/2011/1_wire_ethernet_cable_heat_shrink_window.jpg" alt="" width="400" height="262" /></p>
<p>There was already a not so neat looking satellite coax cable going through a hole in the window frame, so adding an Ethernet cable is not big deal, although it&#8217;s beginning to look messy:</p>
<p><img class="alignnone" title="1-Wire Ethernet cable, window" src="http://diagramtips.com/images/2011/1_wire_ethernet_cable_window.jpg" alt="" width="400" height="348" /></p>
<p>Rather discreet looking 1-Wire cable outside (the two cables in the top are existing coax cable for satellite):</p>
<p><img class="alignnone" title="1-Wire Ethernet, outside window" src="http://diagramtips.com/images/2011/1_wire_ethernet_outside_window.jpg" alt="" width="286" height="400" /></p>
<p>I have dug a 25 cm (10&#8243;) deep hole in the ground for the Watermark soil moisture sensor and the temperature sensor on the aluminium sheet, and once I have calibrated the soil moisture sensor the hole will be filled with soil again and the system will collect data over the winter:</p>
<p><img class="alignnone" title="Hole, soil, sensors" src="http://diagramtips.com/images/2011/hole_soil_sensors.jpg" alt="" width="400" height="250" /></p>
<p>The air temperature sensor is also in place and ready to collect data:</p>
<p><img class="alignnone" title="Hole, soil, sensors, air temperature" src="http://diagramtips.com/images/2011/hole_soil_sensors_air_temperature.jpg" alt="" width="215" height="400" /></p>
<p>Now I&#8217;m going to work on the <a title="How to Read 1-Wire Temperature Using a NSLU2 With Debian" href="http://diagramtips.com/2011/09/11/how-to-read-1-wire-temperature-using-a-nslu2-with-debian/" target="_blank">OWFS software setup</a> on my <a title="Debian on NSLU2 With USB Hard Disk and Homeplug Network" href="http://diagramtips.com/2011/09/05/debian-on-nslu2-with-usb-hard-disk-and-homeplug-network/" target="_blank">Debian NSLU2</a>.</p>
<div class='yarpp-related-rss'>
<p>Related posts:</p><ol>
<li><a href='http://diagramtips.com/2011/09/11/how-to-read-1-wire-temperature-using-a-nslu2-with-debian/' rel='bookmark' title='How to Read 1-Wire Temperature Using a NSLU2 With Debian'>How to Read 1-Wire Temperature Using a NSLU2 With Debian</a></li>
<li><a href='http://diagramtips.com/2011/09/05/debian-on-nslu2-with-usb-hard-disk-and-homeplug-network/' rel='bookmark' title='Debian on NSLU2 With USB Hard Disk and Homeplug Network'>Debian on NSLU2 With USB Hard Disk and Homeplug Network</a></li>
<li><a href='http://diagramtips.com/2011/08/31/automatic-temperature-measurements-using-nslu2/' rel='bookmark' title='Automatic Temperature Measurements Using NSLU2'>Automatic Temperature Measurements Using NSLU2</a></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://diagramtips.com/2011/10/03/1-wire-usb-on-a-long-ethernet-cable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatic File Transfer From NSLU2 to Server</title>
		<link>http://diagramtips.com/2011/09/30/automatic-file-transfer-from-nslu2-to-server/</link>
		<comments>http://diagramtips.com/2011/09/30/automatic-file-transfer-from-nslu2-to-server/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 15:04:03 +0000</pubDate>
		<dc:creator>Thomas Wagner Nielsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[1-Wire]]></category>
		<category><![CDATA[NSLU2]]></category>

		<guid isPermaLink="false">http://diagramtips.com/?p=295</guid>
		<description><![CDATA[My NSLU2 is generating new temperature graphs every 5 minutes from a network of 1-Wire sensors, but since it doesn&#8217;t have a connector for a screen I can&#8217;t look at the graphs unless I transfer the image files to my &#8230; <a href="http://diagramtips.com/2011/09/30/automatic-file-transfer-from-nslu2-to-server/">Continue reading <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://diagramtips.com/2011/08/31/automatic-temperature-measurements-using-nslu2/' rel='bookmark' title='Automatic Temperature Measurements Using NSLU2'>Automatic Temperature Measurements Using NSLU2</a></li>
</ol>
</div>
]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p>My NSLU2 is generating new temperature graphs every 5 minutes from a <a title="How to Read 1-Wire Temperature Using a NSLU2 With Debian" href="http://diagramtips.com/2011/09/11/how-to-read-1-wire-temperature-using-a-nslu2-with-debian/" target="_blank">network of 1-Wire sensors</a>, but since it doesn&#8217;t have a connector for a screen I can&#8217;t look at the graphs unless I transfer the image files to my PC. Because my PC is sometimes turned off (scary stuff, I know <img src='http://diagramtips.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ) I have to program the NSLU2 to transfer the files to an &#8216;always on&#8217; server, and then from there download the graphs to my PC for analysis.</p>
<p>In order to program the NSLU2 I log in from my PC via my local network:</p>
<p>(Replace <code>xx</code> with the actual IP address of the NSLU2)</p>
<pre>$ ssh thomas@192.168.1.xx</pre>
<p>I put the instructions for the NSLU2 in a script called <code>upload_graphs.sh</code>:</p>
<pre>$ cd /home/thomas/rrdtool/

$ nano upload_graphs.sh</pre>
<p><code>nano</code> is a standard terminal text editor, and these are the commands that goes into the script:</p>
<pre>#!/bin/bash
sleep 30
lftp -u USER,PASSWORD SERVER &lt;&lt;EOF
cd /temp/
lcd /home/thomas/rrdtool/
put temp_h.png
put temp_d.png
put temp_w.png
put temp_m.png
put temp_y.png
quit 0
EOF</pre>
<p>I immediately pause the script for 30 seconds to let the graph update script finish first before uploading the graph files.</p>
<p><code>lftp</code> is an FTP client, and <code>cd</code> means changing directory on the FTP server, whereas <code>lcd</code> is a local change of directory.</p>
<p>On a standard <a title="Debian on NSLU2 With USB Hard Disk and Homeplug Network" href="http://diagramtips.com/2011/09/05/debian-on-nslu2-with-usb-hard-disk-and-homeplug-network/" target="_blank">NSLU2 Debian installation</a> <code>lftp</code> has to be installed before running the script:</p>
<p>(<code>$</code> means I&#8217;m working as a standard user, and <code>#</code> means superuser)</p>
<pre>$ su
# apt-get install lftp
# exit</pre>
<p>The permission settings must be changed to &#8216;executable&#8217; to allow the new script to execute:</p>
<pre>$ chmod +x upload_graphs.sh</pre>
<p>Test the script with a single run to see if it&#8217;s working correctly:</p>
<pre>$ ./upload_graphs.sh</pre>
<p>before adding it to the <code>crontab</code>:</p>
<pre>$ crontab -e</pre>
<p>This line in the <code>crontab</code> list will execute the upload script every 5 minutes:</p>
<pre>*/5 * * * * /home/thomas/rrdtool/upload_graphs.sh</pre>
<p>Check if <code>crontab</code> has been updated correctly:</p>
<pre>$ crontab -l
# m h  dom mon dow   command
*/5 * * * * /home/thomas/rrdtool/update_database.sh &amp;&gt; /dev/null
*/5 * * * * /home/thomas/rrdtool/upload_graphs.sh</pre>
<p>Both the <a title="How to Use RRDTool on Debian NSLU2 to Capture Temperature Data" href="http://diagramtips.com/2011/09/17/how-to-use-rrdtool-on-debian-nslu2-to-capture-temperature-data/" target="_blank">graph generation script</a> and the upload script have now been installed as regular jobs to be run every 5 minutes.</p>
<p><em>Note: I realize that having your user name, password and server name in an <code>lftp</code> script is not very secure, so if you have a better way of doing this, please leave a comment below.</em></p>
<div class='yarpp-related-rss'>
<p>Related posts:</p><ol>
<li><a href='http://diagramtips.com/2011/08/31/automatic-temperature-measurements-using-nslu2/' rel='bookmark' title='Automatic Temperature Measurements Using NSLU2'>Automatic Temperature Measurements Using NSLU2</a></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://diagramtips.com/2011/09/30/automatic-file-transfer-from-nslu2-to-server/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to Use RRDtool on Debian NSLU2 to Capture Temperature Data</title>
		<link>http://diagramtips.com/2011/09/17/how-to-use-rrdtool-on-debian-nslu2-to-capture-temperature-data/</link>
		<comments>http://diagramtips.com/2011/09/17/how-to-use-rrdtool-on-debian-nslu2-to-capture-temperature-data/#comments</comments>
		<pubDate>Sat, 17 Sep 2011 09:52:34 +0000</pubDate>
		<dc:creator>Thomas Wagner Nielsen</dc:creator>
				<category><![CDATA[1-Wire]]></category>
		<category><![CDATA[Temperature]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[crontab]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[NSLU2]]></category>
		<category><![CDATA[rrdtool]]></category>
		<category><![CDATA[temperature]]></category>
		<category><![CDATA[temperature measurement]]></category>

		<guid isPermaLink="false">http://diagramtips.com/?p=256</guid>
		<description><![CDATA[I have a 1-Wire temperature sensor IC connected to my small Debian NSLU2 computer and in order to analyze the temperature data generated I&#8217;m using a program called RRDtool: RRDtool is the OpenSource industry standard, high performance data logging and &#8230; <a href="http://diagramtips.com/2011/09/17/how-to-use-rrdtool-on-debian-nslu2-to-capture-temperature-data/">Continue reading <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://diagramtips.com/2011/09/11/how-to-read-1-wire-temperature-using-a-nslu2-with-debian/' rel='bookmark' title='How to Read 1-Wire Temperature Using a NSLU2 With Debian'>How to Read 1-Wire Temperature Using a NSLU2 With Debian</a></li>
<li><a href='http://diagramtips.com/2011/09/05/debian-on-nslu2-with-usb-hard-disk-and-homeplug-network/' rel='bookmark' title='Debian on NSLU2 With USB Hard Disk and Homeplug Network'>Debian on NSLU2 With USB Hard Disk and Homeplug Network</a></li>
<li><a href='http://diagramtips.com/2011/08/31/automatic-temperature-measurements-using-nslu2/' rel='bookmark' title='Automatic Temperature Measurements Using NSLU2'>Automatic Temperature Measurements Using NSLU2</a></li>
</ol>
</div>
]]></description>
			<content:encoded><![CDATA[
<!-- ALL ADSENSE ADS DISABLED -->
<p>I have a 1-Wire temperature sensor IC connected to my <a title="Debian on NSLU2 With USB Hard Disk and Homeplug Network" href="http://diagramtips.com/2011/09/05/debian-on-nslu2-with-usb-hard-disk-and-homeplug-network/" target="_blank">small Debian NSLU2 computer</a> and in order to analyze the temperature data generated I&#8217;m using a program called RRDtool:</p>
<blockquote><p>RRDtool is the OpenSource industry standard, high performance data logging and graphing system for time series data.</p>
<p style="text-align: right;">&#8211; Tobi Oetiker</p>
</blockquote>
<p>RRDtool is able to make all sorts of graphs for different kinds of data but for now I just need to use it for a single temperature sensor measuring in degrees Celsius.</p>
<p>I start by logging into the NSLU2 from my laptop computer (replace .xx with the address of the NSLU2 on the intranet):</p>
<pre>$ ssh thomas@192.168.1.xx</pre>
<p>and make a directory for <code>rrdtool</code>, and write a script that will create a basic <code>rrdtool</code> database:</p>
<p>(Note that <code>$</code> in front of command means I&#8217;m working as a normal user, and <code>#</code> means I&#8217;m working as super user)</p>
<pre>$ cd /home/thomas
$ mkdir rrdtool
$ cd /home/thomas/rrdtool
$ nano create_database.sh</pre>
<p>This is what goes into the script:</p>
<pre>#!/bin/bash
rrdtool create database.rrd --start N --step 300 \
DS:temp:GAUGE:600:U:U \
RRA:AVERAGE:0.5:1:12 \
RRA:AVERAGE:0.5:1:288 \
RRA:AVERAGE:0.5:12:168 \
RRA:AVERAGE:0.5:12:720 \
RRA:AVERAGE:0.5:288:365</pre>
<p>After the script has been saved you&#8217;ll need to change the permissions setting of the file to make it executable:</p>
<pre>$ chmod +x create_database.sh</pre>
<p><code>rrdtool</code> is already available in the Debian package system &#8211; you just need to install it with <code>apt-get</code>:</p>
<pre>$ su
# apt-get install rrdtool
# exit</pre>
<p>When you run the script it will create a file called <code>database.rrd</code> which contains the <code>rrdtool</code> database:</p>
<pre>$ ./create_database.sh</pre>
<p>A directory listing shows that the database file was created:</p>
<pre>$ ls -la
total 28
drwxr-xr-x 2 thomas thomas  4096 Sep 15 18:50 .
drwxr-xr-x 6 thomas thomas  4096 Sep 15 17:49 ..
-rwxr-xr-x 1 thomas thomas   208 Sep 15 17:52 create_database.sh
-rw-r--r-- 1 thomas thomas 13764 Sep 15 18:50 database.rrd</pre>
<p>The database has to be updated regularly and the commands for that can be collected in another script that I choose to name <code>update_database.sh</code>:</p>
<pre>$ nano update_database.sh</pre>
<p>The update script takes care of three things:</p>
<ol>
<li>Reading the temperature value from the sensor, and formatting the reading</li>
<li>Updating the database file</li>
<li>Creating, or updating, image files containing temperature graphs</li>
</ol>
<p>This is the code for the script:</p>
<pre>#!/bin/bash
cd /home/thomas/rrdtool

# Read temperature from sensor
tempread=`cat /home/thomas/owfs/10.4F7494010800/temperature` 

temp=`echo $tempread | cut -c -4`

# Update database
rrdtool update database.rrd N:$temp

# Create graphs
rrdtool graph temp_h.png --start -1h DEF:temp=database.rrd:temp:AVERAGE LINE1:temp#0000FF:"Temperature [deg C]"
rrdtool graph temp_d.png --start -1d DEF:temp=database.rrd:temp:AVERAGE LINE1:temp#0000FF:"Temperature [deg C]"
rrdtool graph temp_w.png --start -1w DEF:temp=database.rrd:temp:AVERAGE LINE1:temp#0000FF:"Temperature [deg C]"
rrdtool graph temp_m.png --start -1m DEF:temp=database.rrd:temp:AVERAGE LINE1:temp#0000FF:"Temperature [deg C]"
rrdtool graph temp_y.png --start -1y DEF:temp=database.rrd:temp:AVERAGE LINE1:temp#0000FF:"Temperature [deg C]"
#0000FF means blue trace color in the graphs.</pre>
<p>(You can find more information about <code>owfs</code> in this post: <a title="How to Read 1-Wire Temperature Using a NSLU2 With Debian" href="http://diagramtips.com/2011/09/11/how-to-read-1-wire-temperature-using-a-nslu2-with-debian/" target="_blank">How to Read 1-Wire Temperature Using a NSLU2 With Debian</a> )</p>
<p><code>echo</code> and <code>cut</code> is used to discard some of the excessive decimals, so that the stored value in the database is for example 23.8 instead of 23.875.</p>
<p>The 5 <code>rrdtool graph</code> commands will create graphs, where the timespan is <code>h</code> = hour, <code>d</code> = day, <code>w</code> = week, <code>m</code> = month and <code>y</code> = year.</p>
<p>A directory listing shows that the update script was created:</p>
<pre>$ ls -la
total 32
drwxr-xr-x 2 thomas thomas  4096 Sep 15 19:04 .
drwxr-xr-x 6 thomas thomas  4096 Sep 15 17:49 ..
-rwxr-xr-x 1 thomas thomas   208 Sep 15 17:52 create_database.sh
-rw-r--r-- 1 thomas thomas 13764 Sep 15 18:50 database.rrd
-rw-r--r-- 1 thomas thomas   843 Sep 15 19:05 update_database.sh</pre>
<p>You&#8217;ll have to modify the permissions of the update script to be able to run it:</p>
<pre>$ chmod +x update_database.sh</pre>
<p>If everything goes well when you run the script the only output is the dimensions of the 5 graphs:</p>
<pre>$ ./update_database.sh
481x163
481x163
481x163
481x163
481x163</pre>
<p>and a directory listing now shows that images files have been generated (<code>.png</code> stands for <strong>P</strong>ortable <strong>N</strong>etwork <strong>G</strong>raphics):</p>
<pre>$ ls -la
total 76
drwxr-xr-x 2 thomas thomas  4096 Sep 15 19:05 .
drwxr-xr-x 6 thomas thomas  4096 Sep 15 17:49 ..
-rwxr-xr-x 1 thomas thomas   208 Sep 15 17:52 create_database.sh
-rw-r--r-- 1 thomas thomas 13764 Sep 15 19:05 database.rrd
-rw-r--r-- 1 thomas thomas  7206 Sep 15 19:05 temp_d.png
-rw-r--r-- 1 thomas thomas  7966 Sep 15 19:05 temp_h.png
-rw-r--r-- 1 thomas thomas  7951 Sep 15 19:05 temp_m.png
-rw-r--r-- 1 thomas thomas  8040 Sep 15 19:05 temp_w.png
-rw-r--r-- 1 thomas thomas  8630 Sep 15 19:05 temp_y.png
-rwxr-xr-x 1 thomas thomas   843 Sep 15 19:05 update_database.sh</pre>
<p>You could probably ask <code>rrdtool</code> to generate <code>.jpg</code> files instead if you can find a way to do so in the manual.</p>
<p>Now the database has been updated with a single snapshot of the temperature but we would like to continuously capture temperature data and keep the graphs updated. For this purpose we can use Linux <code>crontab</code>:</p>
<blockquote><p>Cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates. It is commonly used to automate system maintenance or administration, though its general-purpose nature means that it can be used for other purposes, such as connecting to the Internet and downloading email.</p>
<p style="text-align: right;">&#8211; Wikipedia</p>
</blockquote>
<p>The <code>-e</code> option is for editing:</p>
<pre>$ crontab -e
no crontab for thomas - using an empty one
crontab: installing new crontab</pre>
<p>Every 5 minutes the update script is run, and any output messages are discarded:</p>
<pre># m h  dom mon dow   command
*/5 * * * * /home/thomas/rrdtool/update_database.sh &amp;&gt; /dev/null</pre>
<p>If you want to check what jobs are installed you can use the <code>-l</code> option:</p>
<pre>$ crontab -l</pre>
<p>Since the NSLU2 doesn&#8217;t have any monitor connection on it I need to get the graphs copied to a computer with a screen to be able to see the results. For that I use FTP:</p>
<pre>$ cd /home/thomas/rrdtool
$ ftp</pre>
<p>Replace <code>SERVER</code> and <code>USERNAME</code> below with your own details:</p>
<pre>ftp&gt; open
(to) SERVER
Connected to SERVER.
Name (SERVER:thomas): USERNAME
ftp&gt; mkdir temp
ftp&gt; cd temp
ftp&gt; put temp_d.png
ftp&gt; put temp_h.png
ftp&gt; put temp_m.png
ftp&gt; put temp_w.png
ftp&gt; put temp_y.png
ftp&gt; exit</pre>
<p>You could also copy the image files to a USB memory stick and from there onto your PC.</p>
<p>From my server on the Internet I can now download and view the generated graphs.</p>
<p>The first one (<code>temp_h.png</code>) covers only 1 hour in time and the air temperature is very stable over the hour so this particular graph is not very informative:</p>
<p><img class="alignnone" title="Temperature graph, hour, 2011-09-16" src="http://diagramtips.com/images/2011/temp_h_2011_09_16.png" alt="" width="481" height="163" /></p>
<p><code>temp_d.png</code> is more interesting as you can begin to see changes in the temperature:</p>
<p><img class="alignnone" title="Temperature graph, day, 2011-09-16" src="http://diagramtips.com/images/2011/temp_d_2011_09_16.png" alt="" width="481" height="163" /></p>
<p><code>temp_w.png</code> needs a lot more time before it has been filled up with data, but if the system is stable the graph will be completed in about a week:</p>
<p><img class="alignnone" title="Temperature graph, week, 2011-09-16" src="http://diagramtips.com/images/2011/temp_w_2011_09_16.png" alt="" width="481" height="163" /></p>
<p><code>temp_m.png</code> and <code>temp_y.png</code> are long term graphs but quite interesting to look at when they have been drawn, especially if you mounted the temperature sensor outdoors. There&#8217;s nothing to see yet though, because the system is new:</p>
<p><img class="alignnone" title="Temperature graph, month, 2011-09-16" src="http://diagramtips.com/images/2011/temp_m_2011_09_16.png" alt="" width="481" height="163" /></p>
<p><img class="alignnone" title="Temperature graph, year, 2011-09-16" src="http://diagramtips.com/images/2011/temp_y_2011_09_16.png" alt="" width="481" height="163" /></p>
<p>I&#8217;m going to add more and different kinds of sensors to the <a title="Automatic temperature measurements using NSLU2" href="http://diagramtips.com/2011/08/31/automatic-temperature-measurements-using-nslu2/" target="_blank">NSLU2 logging system</a> in the coming weeks.</p>
<div class='yarpp-related-rss'>
<p>Related posts:</p><ol>
<li><a href='http://diagramtips.com/2011/09/11/how-to-read-1-wire-temperature-using-a-nslu2-with-debian/' rel='bookmark' title='How to Read 1-Wire Temperature Using a NSLU2 With Debian'>How to Read 1-Wire Temperature Using a NSLU2 With Debian</a></li>
<li><a href='http://diagramtips.com/2011/09/05/debian-on-nslu2-with-usb-hard-disk-and-homeplug-network/' rel='bookmark' title='Debian on NSLU2 With USB Hard Disk and Homeplug Network'>Debian on NSLU2 With USB Hard Disk and Homeplug Network</a></li>
<li><a href='http://diagramtips.com/2011/08/31/automatic-temperature-measurements-using-nslu2/' rel='bookmark' title='Automatic Temperature Measurements Using NSLU2'>Automatic Temperature Measurements Using NSLU2</a></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://diagramtips.com/2011/09/17/how-to-use-rrdtool-on-debian-nslu2-to-capture-temperature-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
