Re: Humidity sensor(s)

139 views
Skip to first unread message

Dale Reagan

unread,
Apr 30, 2013, 9:24:43 PM4/30/13
to digi...@googlegroups.com
Hi Jason,

Guessing - your 'code' that saves the data probably is treating the
humidity data as a 'temperature' reading.
Review the 'code' that saves (moves the data) to your DB - again, just a guess.
If it makes no sense then touch base.


At 06:38 PM 4/30/2013, you wrote:
>I inherited a system with 2 1-wire sensors using Digitemp 3.5.0. It's been
>running this way for years perfectly well.
>
>Recently we had some A/C issues in our server room that have caused me to
>realize our two sensor setup wasn't the most accurate. So I've added two
>additional sensors that do temperatures and humidity, the MS-TH (also
>added a few other temp. only sensors that work fine):
>
><http://www.ibuttonlink.com/products/ms-th>http://www.ibuttonlink.com/products/ms-th
>
>We use the Link45 as the connector to the linux box. I had ordered a
>LinkTH connector since the website suggested that it was able to read
>humidity and the Link45 was not?
>
>I wired them all up and replaced the Link45 with the LinkTH. I can not get
>the LinkTH to be read. I get the "Adabter cannot be found" general error
>and nothing I do will fix it (even downloaded Digitemp 3.6.0, unzipped and
>did the .
>
># /digitemp_DS9097U -s/dev/ttyS0 -i
>
>same error. If I put the Link45 back, I can read all the new sensors
>including the humidity sensors that show a % humidity as follows:
>
>digitemp-3.5.0]# ./digitemp -a
>DigiTemp v3.5.0 Copyright 1996-2007 by Brian C. Lane
>GNU Public License v2.0 - http://www.digitemp.com
>Apr 30 15:35:38 Sensor 0 C: 20.88 F: 69.58
>Apr 30 15:35:39 Sensor 1 C: 19.69 F: 67.44
>Apr 30 15:35:40 Sensor 2 C: 20.62 F: 69.12
>Apr 30 15:35:41 Sensor 3 C: 21.31 F: 70.36
>Apr 30 15:35:42 Sensor 4 C: 23.12 F: 73.62
>Apr 30 15:35:43 Sensor 5 C: 21.56 F: 70.81
>Apr 30 15:35:44 Sensor 6 C: 22.94 F: 73.29
>Apr 30 15:35:45 Sensor 7 C: 23.12 F: 73.62
>Apr 30 15:35:46 Sensor 8 C: 19.78 F: 67.61 H: 37%
>Apr 30 15:35:47 Sensor 9 C: 19.31 F: 66.76 H: 38%
>
>So I have humidity and temps being red from the same sensor... perfect!
>
>But when I check the database, not so perfect. It seems that both humidity
>sensors have been lumped into a single sensor called "Apr". And the only
>measurement being logged in the database is "30"... constantly...
>regardless of whatever
>
>digitemp -a gives me.
>
>Heres some database entries:
>
>| 899019 | 2013-04-30 15:15:12 | Apr | 30.00 |
>| 899020 | 2013-04-30 15:15:12 | Apr | 30.00 |
>| 899021 | 2013-04-30 15:20:11 | 2828D9CC0300006B | 68.45 |
>| 899022 | 2013-04-30 15:20:11 | 2884C55B0100003F | 65.75 |
>| 899023 | 2013-04-30 15:20:11 | 2842C5CC0300003A | 68.11 |
>| 899024 | 2013-04-30 15:20:11 | 2836D65B01000064 | 67.89 |
>| 899025 | 2013-04-30 15:20:11 | 280DC4CC030000A6 | 72.84 |
>| 899026 | 2013-04-30 15:20:11 | 28B3A7CC030000ED | 69.58 |
>| 899027 | 2013-04-30 15:20:11 | 28072DCC03000040 | 72.16 |
>| 899028 | 2013-04-30 15:20:11 | 284F46CC030000F5 | 72.05 |
>| 899029 | 2013-04-30 15:20:11 | Apr | 30.00 |
>| 899030 | 2013-04-30 15:20:11 | Apr | 30.00 |
>| 899031 | 2013-04-30 15:25:12 | 2828D9CC0300006B | 68.22 |
>| 899032 | 2013-04-30 15:25:12 | 2884C55B0100003F | 65.30 |
>| 899033 | 2013-04-30 15:25:12 | 2842C5CC0300003A | 67.78 |
>| 899034 | 2013-04-30 15:25:12 | 2836D65B01000064 | 67.21 |
>| 899035 | 2013-04-30 15:25:12 | 280DC4CC030000A6 | 72.72 |
>| 899036 | 2013-04-30 15:25:12 | 28B3A7CC030000ED | 69.35 |
>| 899037 | 2013-04-30 15:25:12 | 28072DCC03000040 | 71.94 |
>| 899038 | 2013-04-30 15:25:12 | 284F46CC030000F5 | 71.83 |
>| 899039 | 2013-04-30 15:25:12 | Apr | 30.00 |
>| 899040 | 2013-04-30 15:25:12 | Apr | 30.00 |
>+--------+---------------------+------------------+------------+
>898805 rows in set (2.85 sec)
>
>
>What is going on? How can I log the measured humidity!?!?! This is driving
>me crazy!

:)
Dale

Jason Sipula

unread,
Apr 30, 2013, 11:56:40 PM4/30/13
to digi...@googlegroups.com
Thanks Dale. I'm going to look into this a bit further tomorrow if time allows. I realized when I got home that my readings:

| 899040 | 2013-04-30 15:25:12 | Apr                        |      30.00 | 

is the date, Apr = April, 30.00 = 30th. So this appears that either my version of digitemp of whatever is running the database expected a string of some length but the humidity sensor is passing in something else that's longer? 

Jason Sipula

unread,
May 1, 2013, 7:00:02 PM5/1/13
to digi...@googlegroups.com
I was able to get this resolved. I was correct that the database script was expecting a String value of a certain length or format, and when the sensor added the Humidity bit, it through off the program's assumptions.

To fix for DigiTemp 3.5.0 (May work on other versions too)

Browse to your .digitemprc file (make a backup first!). Open to edit it...

If you already did the ./digitemp -s/dev/ttyS0 -i to add your new sensors then you should have them in this file as well as a line called HUM_FORMAT. This is the formatting for the humidity sensor output... this is what we ill update.
I simply commented out the one that was there as a reference and then modified it:


TTY /dev/ttyS0
READ_TIME 1000
LOG_TYPE 1
LOG_FORMAT "%b %d %H:%M:%S Sensor %s C: %.2C F: %.2F"
CNT_FORMAT "%b %d %H:%M:%S Sensor %s #%n %C"
#HUM_FORMAT "%b %d %H:%M:%S Sensor %s C: %.2C F: %.2F H: %h%%"
HUM_FORMAT "%R %h"
SENSORS 10


You can see we created a new HUM_FORMAT line as: %R %h

%R == show sensor's hex ID
%h == show humidity percentage.

This allowed the rest of the scripts/program to treat the humidity percentage as if it were a temperature reading. I chose this "hacky" fix since it did not require altering the database tables or altering/modifying our graphing program (dtgraph) to treat it differently.

See my attached image to see what our dtgraph looks like now. You will notice the humidity lines show up down near the 30 F marker, this is just to be read by the user as 30% now. The other lines we know are temp's, so will be read by the user as degrees F.

On Tuesday, April 30, 2013 6:24:43 PM UTC-7, Dale Reagan wrote:
dtgraph_update.JPG
Reply all
Reply to author
Forward
0 new messages