First Test of RainWise 1-Wire Rain Gauge

It’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 I had to log in and shut it down before making any changes to the bus (IP address is hidden for paranoia security reasons):

$ 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

The uptime command shows that the NSLU2 has been running continuously for 14 days which is pretty cool, since I haven’t touched it at all, just letting it log data from the sensors and draw graphs.

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’m not sure how OWFS would behave afterwards, so I powered down the NSLU2 in order to keep the test as simple as possible).

OWFS had to be started again after a reboot. This can be done automatically, I just have to figure out how ;-) . 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):

$ 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

Rushing into the OWFS directory to check if the rain gauge showed up: Yep, it’s there alright! 1D.50E00D000000 is a new unit:

$ 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

Checking the contents of the new unit / directory:

$ 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

The counters.A file is empty but counters.B contains the data:

$ cat counters.A
           0

$ cat counters.B
        2091

Apparently the reed switch was activated 2091 times since production ;-)

I flipped the small white internal rain bucket a couple of times and verified that the counter is actually working:

$ cat counters.B
        2093

The .ALL register / file holds both the A and B counter:

$ cat counters.ALL
           0,        2095

After this small test of the counters I installed the rain gauge outside in a garden bed:

I’m pretty sure this is the first time I have appreciated the cold December rain :-D Gotta do some testing, right?

With really cold hands from the wiring job outside I turned on the NSLU2 again, and what a relief – all the 1-Wire units were up and running in the OWFS directory:

$ 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

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’s probably some better solution out there that will cost me a fortune.

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):

$ cd 1D.50E00D000000/
$ cat counters.B
        2109

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:

$ cat counters.B
        2135

Now that I’m confident that the rain gauge is properly set up and working it’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.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>