Getting the temperature.

schaltung_600_341.gif
linuxds1820.gif
SUNP0034.JPG
Decided to put some old heat sensors work with linux via Digitemp. The command names have changed a bit.
From two of the more popular sites: (note: 25 pin connectors will use different connections.)
http://hacknmod.com/tag/serial-port/
http://hackaday.com/tag/serial-port/
http://martybugs.net/electronics/tempsensor/
Temperature sensing with linux:  http://pihost.us/~stacato/digitemp/
You should be able to install digitemp from the repo without have to download the software and manually installing it.
Debian based:
$ sudo apt-get install digitemp
Fedora based:
$ sudo yum install digitemp
——————————————————-
$ sudo apt-get digitemp
Once inststalled You can use
$ sudo digitemp_DS9097u -s /dev/ttyUSB0 -w

Now, to read the temperatures. You’ll want the digitemp package, which is pre-packaged in Debian and probably most other Linux distributions. Once it’s installed, you’ll need to know what program to use. Several are available for different DS masters, but in the LinkUSBi’s case, you’ll want digitemp_DS9097U. To begin, verify the bus is working correctly by walking it:
# digitemp_DS9097U -w -s /dev/ttyUSB0
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
28D1483C0200002F : DS18B20 Temperature Sensor
28E9393C020000C3 : DS18B20 Temperature Sensor
010EBED512000046 : DS2401/DS1990A Serial Number iButton
This shows the two DS18B20 temperature sensors (T-Sense probes), as well as the DS2401 embedded in my LinkUSBi. (The DS2401 literally does nothing but return a serial number. Still, as mentioned before it’s useful to have to verify the bus is working correctly even if no other devices are plugged into it.)
Next you’ll want to create a config file. I chose to store it in /etc/digitemp.conf.
# digitemp_DS9097U -i -c /etc/digitemp.conf -s /dev/ttyUSB0
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
28D1483C0200002F : DS18B20 Temperature Sensor
28E9393C020000C3 : DS18B20 Temperature Sensor
ROM #0 : 28D1483C0200002F
ROM #1 : 28E9393C020000C3
Wrote /etc/digitemp.conf
You will be left with a file called /etc/digitemp.conf that looks something like this:
TTY /dev/ttyUSB0
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 0x28 0xD1 0x48 0x3C 0x02 0x00 0x00 0x2F 
ROM 1 0x28 0xE9 0x39 0x3C 0x02 0x00 0x00 0xC3
You can rearrange the ROM mappings as you’d like. 1-Wire refers to devices by their 64-bit IDs; the numeric mappings are for digitemp’s benefit. In my case, 28D1483C0200002F is the probe I’d like to use, so #0 is fine.
Now, let’s see what’s being returned:
# digitemp_DS9097U -q -c /etc/digitemp.conf -a
Mar 04 22:22:43 Sensor 0 C: 25.38 F: 77.67
Mar 04 22:22:44 Sensor 1 C: 27.56 F: 81.61
Great, works fine. We’ll soon need the data in a machine-readable format, so here’s how to do that:
# digitemp_DS9097U -q -c /etc/digitemp.conf -o 3 -a
0 77.79 81.50
"

Comments

Popular posts from this blog

Guiless?

MSOffice vs Libreoffice

Raspberry pi zero.