1-Wire is a device communications bus system designed by Dallas Semiconductor that provides low-speed data, signaling, and power over a single signal. 1-Wire is similar in concept to I2C, but with lower data rates and longer range. It is typically used to communicate with small inexpensive devices such as digital thermometers and weather instruments.
The DS18B20 digital thermometer provides 9-bit to 12-bit Celsius temperature measurements. It communicates over a 1-Wire bus that by definition requires only one data line (and ground) for communication with a central microprocessor.
It has an operating temperature range of -55°C to +125°C and is accurate to ±0.5°C over the range of °10°C to +85°C. (read more...).
Following is an example on how to wire a Dallas 1-wire sensor to the Arietta G25 using the port PC2 (J4.35). It is possible to wire more sensors on the same lines. Don't forget to enable the 1-wire bus on the device tree file using this utility: Arietta pinout.
The 1-wire driver automatically scans every 10 seconds if new sensors are plugged on the 1-wire bus.
For each 1-wire device detected a new directory is created on /sys/bus/w1/devices/w1 bus master.
debarm:~# cd "/sys/bus/w1/devices/w1 bus master" debarm:/sys/bus/w1/devices/w1 bus master# ls 28-0000028f6667 w1_master_add w1_master_remove 28-0000028fa89c w1_master_attempts w1_master_search driver w1_master_max_slave_count w1_master_slave_count power w1_master_name w1_master_slaves subsystem w1_master_pointer w1_master_timeout uevent w1_master_pullup
The two directories 28-xxxx indicate that two thermal sensors are probed on the bus (28 is the family ID) and their unique IDs are 0000028f6667 and 0000028fa89c.
The file w1_master_slaves contains an updated list:
debarm:/sys/bus/w1/devices/w1 bus master# ls debarm:/sys/bus/w1/devices/w1 bus master# cat w1_master_slaves 28-0000028fa89c 28-0000028f6667
To read the temperature for each sensor type:
debarm:/sys/bus/w1/devices/w1 bus master# cat 28-0000028f6667/w1_slave 49 01 4b 46 7f ff 07 10 f6 : crc=f6 YES 49 01 4b 46 7f ff 07 10 f6 t=20562 t=20562 indicates that the temperature read is 20.562 °C
These simple programs in Python scan the 1-wire bus to detect the thermal sensors available:
Download this example from playground then launch it by typing:
debarm:/# debarm:~/playground/python/1wire# python scan1w.py Scan for the available thermal sensors Sensor ID = 0000028fa89c
This other example reads the temperature from a specific sensor.
Change the sensor ID in the source and try it:
debarm:/# debarm:~/playground/python/1wire# python read.py Temp=20.38 C
1-wire Dallas DS18B20 thermal sensor
The Dallas/Maxim DS18B20 is a 1-wire digital thermometer:
ARM9 Linux Embedded Module (128MB)
Arietta G25 is a small and low-cost multi-chip module that integrates:
Basic Version with no strips mounted
Acme Systems srl
Via Aldo Moro 53 - 00055 Ladispoli (RM) - Italy
Partita IVA / Codice Fiscale 08114831004 - Tel +39.06.99.12.187 - Fax +39.06.622.765.31 - email: email@example.com pec: firstname.lastname@example.org
Iscritta al Registro delle Imprese di Roma al n. 08114831004 - REA: RM-1074631