Raspberry Pi 1-wire network in 2019
First published: 22nd May 2019
Back in 2013, I wrote abouttemperature monitoring using a Raspberry Pi and a DS18S20 temperature sensor, which was easy. I followed that up with humidity monitoring using a DS2438, which was more difficult. The temperature monitoring was easy because a kernel module existed, so it was just a matter of reading the pseudo-file, but no kernel module existed for the DS2438 so my "solution" was a rather slow, unreliable method in perl. In 2017, Mariusz Białończyk wrote a kernel module, but it wasn't incorporated in the kernel at that time, so I waited... and forgot. Now I've been reminded, and the kernel module is available, it is even in the latest version of Raspbian, so using it is just a matter of adding:
w1-ds2438
to /etc/modules. But even more exciting, there are many more 1-wire kernel modules available now.
I would like to thank Mariusz Białończyk and the other module authors for their efforts, and finally get to the point of this page: to provide an at-a-glance summary of the available 1-wire kernel modules and the capabilities of the devices they interface with. This information is easily available, just search for the device and read the data sheet, only takes a minute for each device, but it will save me a few minutes in future when I'm looking for the right device for a project, and I hope it will save you a few minutes too.
Module | in raspbian* | Device | Description | Possible applications and notes |
---|---|---|---|---|
w1-ds2405 | no | DS2405 | Addressable Switch (single input/output) | Not recommended for new designs |
w1-ds2406 | yes | DS2406 | Dual Addressable Switch Plus 1Kb Memory | |
w1-ds2408 | yes | DS2408 | 8-Channel Addressable Switch | |
w1-ds2413 | yes | DS2413 | Dual Channel Addressable Switch | Used in Apple's Magsafe connector |
w1-ds2423 | yes | DS2423 | 4Kb RAM with counters | |
w1-ds2431 | yes | DS2431 | 1Kb EEPROM | |
w1-ds2433 | yes | DS2433 | 4Kb EEPROM | |
w1-ds2438 | yes | DS2438 | Smart Battery Monitor | humidity monitoring |
w1-ds2780 | yes | DS2780 | Standalone Fuel Gauge IC | The DS2780 measures voltage, temperature and current, and estimates available capacity for rechargeable Lithium Ion and Lithium Ion Polymer batteries. |
w1-ds2781 | yes | DS2781 | 1-Cell or 2-Cell Stand-Alone Fuel Gauge IC | The DS2781 measures voltage, temperature, and current, and estimates available capacity for rechargeable Lithium-Ion and Lithium-Ion Polymer batteries in One-Cell or Two--Cell Applications. |
w1-ds28e04 | yes | DS28E04-100 | 4096-Bit Addressable EEPROM with PIO | 4096 bits of EEPROM Memory, Seven Address Inputs for Physical Location Configuration, Two General-Purpose PIO Pins with Pulse-Generation Capability |
w1-ds2805 | no | DS28E05 | EEPROM 112 byte | |
w1-ds28e17 | yes | DS28E17 | 1-Wire-to-I2C Master Bridge | Extend I2C communication distance with 1-wire protocol, 100 meters (typ) in Standard Speed for a properly configured network |
w1-smem | yes | Driver for 1-wire Dallas network protocol, 64bit memory family. | ||
w1-therm | yes | DS18S20 | High-Precision Digital Thermometer | ±0.5°C Accuracy from -10°C to +85°C |
DS1822 | Econo Digital Thermometer | ±2.0°C Accuracy from -10°C to +85°C | ||
DS18B20 | Programmable Resolution Digital Thermometer | ±0.5°C Accuracy from -10°C to +85°C, Programmable Resolution from 9 Bits to 12 Bits | ||
DS1825 | Programmable Resolution Digital Thermometer With 4-Bit ID | 4 pin-programmable bits to uniquely identify Up to 16 sensor locations on a bus, ±0.5°C Accuracy from -10°C to +85°C, Programmable Resolution from 9 bits to 12 bits | ||
DS28EA00 | Digital Thermometer with Sequence Detect and PIO | Two GPIO pins (used for sequence detection), ±0.5°C Accuracy from -10°C to +85°C, Programmable Resolution from 9 bits to 12 bits |
As for applications, that is up to your imagination. I think the key features are being able to sense and switch at up to 100m from your raspberry pi, and the capability for identification of the attached device. Apple illustrates the potential with the DS2413, the id of the chip is used to identify the power adapter and its capabilities, and the switching is used for indicating the power state. How about incorporating DS2780 or DS2781 into a battery packs for the raspberry pi? Each pack could report its charge status, and the PIO could be used to blink an LED when it needs changing. The humidity monitor shows how a battery voltage monitor is just an Analog to Digital convertor that can be repurposed. If your sensor provides a suitable analog signal, or you can process it to a suitable level, then it can be read with the DS2438, DS2780 or DS2781.
Treat this information with caution. I've used the DS18S20 and DS2438, but the rest is just my reading of the available information. I may have misinterpreted a datasheet or something. Enjoy your projects.
Updated: 31st October 2019
in raspbian
Not all the modules are included in the Raspbian distribution by default. Thanks to Günter for pointing that out. I've added the "in raspbian" column to show those present on my Raspbian stretch installation. If you know how to add the others (are they in a package?), let me know and I'll add the information here.
Also added the DS2423 to the table. An interesting chip: two inputs increment counters on low pulses.