Domotiga/1-Wire

1-Wire Support

There are two ways to use your 1-wire devices with DomotiGa, one is using the Midon TEMP08 interface, the other is using a DS9079(U) interface together with digitemp. You can also build your own DS9079 compatible interface, see the links below for information.

I use an Midon TEMP08 1-wire interface to measure the temperatures of my boiler/heating system. To do this I have placed several DS1820 temperature sensors on the pipes of my heating system, and connected them to the Midon TEMP08. This device reports every x minutes the values automatically so I don't have to poll it.

It supports a lot of different 1-wire sensors, but I only ported code for DS1820 sensors, since I don't have any other sensors to test with.

Setup TEMP08

Before you can use it you have to tweak some settings.

The very first time you use your TEMP08, erase all settings:

ERA
Are you sure? (y/n) 

Set the clock:

SCK 04,20,39,13

Version:

VER
TEMP08 v2.04 2006-07-03
MidonDesign.com 1517

Set poll minutes to 1 minute:

SPT 1

Set Celsius:

STD C

Next use the INI command to search for any 1-Wire devices connected to the 1-Wire bus.

INI
...

Disable some sensors:

DIS
01 4D0000004FC78A26 DS2438 OK P56 4F 4C 6D 69 64 6F 6E FE ! V
02 1D00000005B5E51D DS2423 OK M ?

Update interval = 01 minutes
Temp display = C
Serial # display = On
Wind dirn reverse = On
Debug = Off
Some temp sensors Parasitic powered
Qty of DS1820=00
Qty of DS1822=00
Qty of DS18B2=00
Qty of DS2438=01
WED 20:50:52

Debug off:

DEB OFF

WED 20:54:21
Reading Sensors...
Voltage #01[4D0000004FC78A26]=00.60V 04.98V
Temp #01[4D0000004FC78A26]=24.31C

Install and Setup digitemp

Install digitemp like do:

$ sudo apt-get install digitemp

Then connect your interface to the serial port, and determine it's serial device. Now you can check if sensors are seen, by walking the 1-wire bus.

$ digitemp_DS9097U -s /dev/ttyUSB4  -w
DigiTemp v3.5.0 Copyright 1996-2007 by Brian C. Lane
GNU Public License v2.0 - http://www.digitemp.com
Turning off all DS2409 Couplers
...
Devices on the Main LAN
1049023A01080011 : DS1820/DS18S20/DS1920 Temperature Sensor
0956F3B001000081 : DS2502/DS1982 1Kbit Add only memory
1D3AB905000000DB : DS2423 4Kbit RAM + Counter

The first one is a temp sensor I have connected, the second device is the memory chip build into it, the third a dual counter. If all devices are connected and seen on the 1-wire bus, initialize digitemp so it creates a config file.

$ digitemp_DS9097U -s /dev/ttyUSB6 -i
DigiTemp v3.5.0 Copyright 1996-2007 by Brian C. Lane
GNU Public License v2.0 - http://www.digitemp.com
Turning off all DS2409 Couplers
..
Searching the 1-Wire LAN
1049023A01080015 : DS1820/DS18S20/DS1920 Temperature Sensor
ROM #0 : 1049023A01080015
Wrote .digitemprc

The created file looks like this:

TTY /dev/ttyUSB4
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%%"
SENSORS 2
ROM 0 0x10 0x49 0x02 0x3A 0x01 0x08 0x00 0x11
ROM 1 0x1D 0x3A 0xB9 0x05 0x00 0x00 0x00 0xDB

Move it to a central place.

$ sudo mv .digitemprc /etc/digitemp.conf

Important, edit the file so the serial id is also displayed in the output (add the %R to every FORMAT line) it looks like this afterwards.

TTY /dev/ttyUSB4
READ_TIME 1000
LOG_TYPE 1
LOG_FORMAT "%R %b %d %H:%M:%S Sensor %s C: %.2C F: %.2F"
CNT_FORMAT "%R %b %d %H:%M:%S Sensor %s #%n %C"
HUM_FORMAT "%R %b %d %H:%M:%S Sensor %s C: %.2C F: %.2F H: %h%%"
SENSORS 2
ROM 0 0x10 0x49 0x02 0x3A 0x01 0x08 0x00 0x11
ROM 1 0x1D 0x3A 0xB9 0x05 0x00 0x00 0x00 0xDB

Now we can call digitemp with

$ digitemp_DS9097U -a -q -c /etc/digitemp.conf
1049023A01080011 Nov 23 13:21:19 Sensor 0 C: 17.62 F: 63.73
1D3AB905000000DB Nov 23 13:21:19 Sensor 1 #0 1
1D3AB905000000DB Nov 23 13:21:19 Sensor 1 #1 1

So now you need to configure the devices as type 1-Wire and with the serial ID (for example 1049023A0108001) as address in DomotiGa to get the readings of this sensor.

As of DomotiGa version 0.1.174 there is no device type 'Digitemp' anymore, they are type 1-Wire like the Midon TEMP08 ones. You have to change the address of existing Digitemp Devices from Sensor # to their serial IDs. Thanks to Timo for the changes.

If people have sample digitemp output of other 1-Wire type devices, please sent them so can add them to the Digitemp.module!

Resources