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:
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||Device||Description||Possible applications and notes|
|w1-ds2405||DS2405||Addressable Switch (single input/output)||Not recommended for new designs|
|w1-ds2406||DS2406||Dual Addressable Switch Plus 1Kb Memory|
|w1-ds2408||DS2408||8-Channel Addressable Switch|
|w1-ds2413||DS2413||Dual Channel Addressable Switch||Used in Apple's Magsafe connector|
|w1-ds2438||DS2438||Smart Battery Monitor||humidity monitoring|
|w1-ds2780||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||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-ds2805||DS28E05||EEPROM 112 byte|
|w1-ds28e04||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-ds28e17||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||Driver for 1-wire Dallas network protocol, 64bit memory family.|
|w1-therm||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.