Outils pour utilisateurs

Outils du site


brouillon_1-wire

Ceci est une ancienne révision du document !


Debian Etch

Materiel

Clé USB

Capteur de température

Brancher

la clé DS9490R

 $ tail -f /var/log/syslog
Aug 13 23:29:12 k8 kernel: usb 3-2.1.4: new full speed USB device using ehci_hcd and address 11
Aug 13 23:29:12 k8 kernel: usb 3-2.1.4: configuration #1 chosen from 1 choice
Aug 13 23:29:12 k8 kernel: Driver for 1-wire Dallas network protocol.
Aug 13 23:29:12 k8 kernel: usbcore: registered new interface driver DS9490R
Aug 13 23:29:24 k8 kernel: w1_master_driver w1_bus_master1: Family 81 for 81.0000002ab801.87 is not registered.

Ok… bon… et alors?

Les modules chargés:

# diff lsmod-1.txt lsmod-2.txt
1a2,4
> ds2490                  7776  0
> wire                   21764  1 ds2490
> cn                      8032  1 wire
111c114
< usbcore               133004  7 wacom,pl2303,usbserial,usb_storage,ehci_hcd,uhci_hcd
---
> usbcore               133004  8 ds2490,wacom,pl2303,usbserial,usb_storage,ehci_hcd,uhci_hcd 

Mais encore:

# lsusb
Bus 003 Device 014: ID 04fa:2490 Dallas Semiconductor DS1490F 2-in-1 Fob, 1-Wire adapter

avant de brancher

Avant de brancher la clé, il faut desactiver le chargement de certains pilotes.

Editer le fichier /etc/modprobe.d/blacklist pour avoir (à la fin par exemple):

# ----
# TJ
blacklist ds9490r
blacklist ds2490
blacklist wire
# ----

Si besoin, forcer aussi le dechargement des pilotes en faisant:

# modprobe -r ds2490
# modprobe -r wire

J'ai aussi ajouté un petit:

# rmmod cn

(c'est koi ce truk?)

Digitemp

Install

# aptitude install digitemp

Test

Et puis:

# digitemp_DS2490 -a -v
DigiTemp v3.5.0 Copyright 1996-2007 by Brian C. Lane
GNU Public License v2.0 - http://www.digitemp.com
Found DS2490 device #1 at 003/012

Ca a marché ?

# digitemp_DS2490 -a -v -w
DigiTemp v3.5.0 Copyright 1996-2007 by Brian C. Lane
GNU Public License v2.0 - http://www.digitemp.com
Found DS2490 device #1 at 003/012
Turning off all DS2409 Couplers
.
Devices on the Main LAN
8101B82A00000087 : Unknown Family Code

Hu?

Branchons le capteur DS1820 :

# digitemp_DS2490 -w -v
DigiTemp v3.5.0 Copyright 1996-2007 by Brian C. Lane
GNU Public License v2.0 - http://www.digitemp.com
Found DS2490 device #1 at 006/012
Turning off all DS2409 Couplers
..
Devices on the Main LAN
1035317F0108005B : DS1820/DS18S20/DS1920 Temperature Sensor
8101B82A00000087 : Unknown Family Code

Chouette, mon petit cablage fonctionne :-)

Configurer

D'aprés le “man”, on initialise un fichier .digitemprc avec -i

# digitemp_DS2490 -i
DigiTemp v3.5.0 Copyright 1996-2007 by Brian C. Lane
GNU Public License v2.0 - http://www.digitemp.com
Found DS2490 device #1 at 006/012
Turning off all DS2409 Couplers
..
Searching the 1-Wire LAN
1035317F0108005B : DS1820/DS18S20/DS1920 Temperature Sensor
ROM #0 : 1035317F0108005B
Wrote .digitemprc

C'est quoi ce fichier:

# cat .digitemprc
TTY USB
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 1
ROM 0 0x10 0x35 0x31 0x7F 0x01 0x08 0x00 0x5B

Examinons le senseur:

# digitemp_DS2490 -t 0
DigiTemp v3.5.0 Copyright 1996-2007 by Brian C. Lane
GNU Public License v2.0 - http://www.digitemp.com
Found DS2490 device #1 at 006/012
Aug 14 23:04:56 Sensor 0 C: 25.25 F: 77.45

Yes ! Il fait chaud.

interrogations

Un autre format de reponse:

# digitemp_DS2490 -t 0 -o 2
DigiTemp v3.5.0 Copyright 1996-2007 by Brian C. Lane
GNU Public License v2.0 - http://www.digitemp.com
Found DS2490 device #1 at 006/012
0       25.56

Le “0” est juste le nombre de seconde ecoulé…
“25.56” est la température.

Autre chose:

# digitemp_DS2490 -t 0 -o 2 -n 3 -d 5
DigiTemp v3.5.0 Copyright 1996-2007 by Brian C. Lane
GNU Public License v2.0 - http://www.digitemp.com
Found DS2490 device #1 at 006/012
0       25.50
5       25.50
10      25.50

Explication rapide:
-t 0 interroger le senseur 0 (d'aprés la config)
-o 2 format de réponse
-n 3 interroger 3 fois…
-d 5 delay entre les interrogations

Autoriser user

J'ai fait ça:

# chmod u+s /usr/bin/digitemp_DS2490

Ainsi, titi il peut aussi faire:

$ digitemp_DS2490 -q -t 0 -o 2
Found DS2490 device #1 at 003/007
0       29.12

Etch

Mes tests préliminaires ont été fait sous Lenny (la version Testing de Debian) !

Ca ne fonctionne pas sous Etch !

Même aprés avoir essayé de compiler la dernière version, j'ai la même erreur dans les logs.

Digitemp a compiler

# aptitude install libusb-dev
$ wget http://www.digitemp.com/software/linux/digitemp-3.5.0.tar.gz
$ tar xvzf digitemp-3.5.0.tar.gz
$ make ds2490 

Fin.

rrd

BROUILLON !

$ rrdtool create rrd/temp.rrd DS:temp:GAUGE:600:U:U RRA:AVERAGE:0.5:1:24 RRA:AVERAGE:0.5:6:10
$ rrdtool graph temp.png --start -3600 DEF:mytemp=rrd/temp.rrd:temp:AVERAGE LINE2:mytemp#CCCCCC

ou –start -1hour

Un coup d'oeil:

$ rrdtool fetch rrd/temp.rrd AVERAGE --start -3600
                           temp

1218929700: 2.4416800000e+01
1218930000: 2.4262666667e+01
1218930300: 2.4573033333e+01
1218930600: 2.4700000000e+01
1218930900: 2.4616700000e+01
1218931200: 2.4511600000e+01
1218931500: 2.4465300000e+01
1218931800: 2.4332233333e+01
1218932100: 2.4397100000e+01
1218932400: 2.4633600000e+01
1218932700: 2.4514566667e+01
1218933000: 2.4408766667e+01
1218933300: nan
$ rrdtool graph temp.png --start -1hour DEF:mytemp=rrd/temp.rrd:temp:AVERAGE AREA:mytemp#660000:"Temperature" --title "temperature jardin" --vertical-label "Degré Celcius"
$ rrdtool graph temp.png --start -3600 DEF:mytemp=rrd/temp.rrd:temp:AVERAGE LINE2:mytemp#CC0000:"Temperature en Degré Celcius"

Old

la clé DS9490R

$ tail -f /var/log/syslog

(la 1er fois)

Apr  2 10:59:24 nin kernel: usb 1-7.1.3: new full speed USB device using ehci_hcd and address 48
Apr  2 10:59:24 nin kernel: usb 1-7.1.3: configuration #1 chosen from 1 choice
Apr  2 10:59:24 nin kernel: Driver for 1-wire Dallas network protocol.
Apr  2 10:59:24 nin kernel: usbcore: registered new driver DS9490R
Apr  2 10:59:36 nin kernel: w1_master_driver w1_bus_master1: Family 81 for 81.000000290ecc.09 is not registered.

Par la suite, on a:

Apr  2 14:24:36 nin kernel: usb 1-7.1.3: new full speed USB device using ehci_hcd and address 56
Apr  2 14:24:36 nin kernel: usb 1-7.1.3: configuration #1 chosen from 1 choice
Apr  2 14:24:49 nin kernel: w1_master_driver w1_bus_master9: Family 81 for 81.000000290ecc.09 is not registered.
$ dmesg
usb 1-7.1.3: new full speed USB device using ehci_hcd and address 56
usb 1-7.1.3: configuration #1 chosen from 1 choice
w1_master_driver w1_bus_master9: Family 81 for 81.000000290ecc.09 is not registered.
$ ls /dev
crw-rw----  1 root root    442,   55 2008-04-02 14:24 usbdev1.56_ep00
crw-rw----  1 root root    442,   55 2008-04-02 14:24 usbdev1.56_ep81
crw-rw----  1 root root    442,   55 2008-04-02 14:24 usbdev1.56_ep02
crw-rw----  1 root root    442,   55 2008-04-02 14:24 usbdev1.56_ep83
$ lsusb
Bus 001 Device 056: ID 04fa:2490 Dallas Semiconductor DS1490F 2-in-1 Fob, 1-Wire adapter
$ lsmod | grep ds
ds2490                  7616  0
wire                   21700  1 ds2490
usbcore               112644  6 ds2490,usbhid,usb_storage,ohci_hcd,ehci_hcd

la sonde thermal

$ tail -f /var/log/syslog
Apr  2 14:35:51 nin kernel: 0x81: count=16, status: 00 00 2f 40 05 04 04 00 20 43 00 00 00 00 00 00
Apr  2 14:35:51 nin kernel:                                   enable flag:        0
Apr  2 14:35:51 nin kernel:                                  1-wire speed:        0
Apr  2 14:35:51 nin kernel:                        strong pullup duration:       2f
Apr  2 14:35:51 nin kernel:                    programming pulse duration:       40
Apr  2 14:35:51 nin kernel:                    pulldown slew rate control:        5
Apr  2 14:35:51 nin kernel:                              write-1 low time:        4
Apr  2 14:35:51 nin kernel:      data sample offset/write-0 recovery time:        4
Apr  2 14:35:51 nin kernel:                      reserved (test register):        0
Apr  2 14:35:51 nin kernel:                           device status flags:       20
Apr  2 14:35:51 nin kernel:                  communication command byte 1:       43
Apr  2 14:35:51 nin kernel:                  communication command byte 2:        0
Apr  2 14:35:51 nin kernel:           communication command buffer status:        0
Apr  2 14:35:51 nin kernel:              1-wire data output buffer status:        0
Apr  2 14:35:51 nin kernel:               1-wire data input buffer status:        0
Apr  2 14:35:51 nin kernel:                                      reserved:        0
Apr  2 14:35:51 nin kernel:                                      reserved:        0
Apr  2 14:35:53 nin kernel: w1_master_driver w1_bus_master9: Family 26 for 26.000000816a51.82 is not registered.
brouillon_1-wire.1218990051.txt.gz · Dernière modification : 2008/08/17 16:20 de thierry