The DS2438 is originally a "Smart Battery Monitor".
For use in the home automation, he has four interesting features:
- A voltmeter, this provides the bus voltage - ideal for monitoring (VDD)
- A thermometer - can always be useful (Temperature)
- An AD converter (VAD) - can be used for measuring the moisture or brightness
- A current input (Xsens) - at leisure
Practical example: moisture measurement
The humidity sensor HIH-4000 from HONEYWELL has an accuracy of 3.5%, ranging from 0 to 100% RH.
Because of its linear output the DS2438 can be read out directly. A temperature compensation can be taken into account because the DS2438 has an internal temperature sensor.
As it goes, illustrates the following script:
$Vad = GetValue(44045);
$Vdd = GetValue(14570);
$temp = GetValue(18691;
$Srh = ($Vad - 0.958062) 30.680;
$Srh = $Srh / ((1.0305 + (0.000044 $temp) - (0.0000011 pow($temp,2))));
echo "Humidity: $Srh %rh Temp.Comp.\n";
SetValue(49935 /[Humidity %rh]*/, $Srh);