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.

ModuleDeviceDescriptionPossible applications and notes
w1-ds2405DS2405Addressable Switch (single input/output)Not recommended for new designs
w1-ds2406DS2406Dual Addressable Switch Plus 1Kb Memory
w1-ds2408DS24088-Channel Addressable Switch
w1-ds2413DS2413Dual Channel Addressable SwitchUsed in Apple's Magsafe connector
w1-ds2433DS24334Kb EEPROM
w1-ds2438DS2438Smart Battery Monitorhumidity monitoring
w1-ds2780DS2780Standalone Fuel Gauge ICThe DS2780 measures voltage, temperature and current, and estimates available capacity for rechargeable Lithium Ion and Lithium Ion Polymer batteries.
w1-ds2781DS27811-Cell or 2-Cell Stand-Alone Fuel Gauge ICThe 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-ds2805DS28E05EEPROM 112 byte
w1-ds28e04DS28E04-1004096-Bit Addressable EEPROM with PIO4096 bits of EEPROM Memory, Seven Address Inputs for Physical Location Configuration, Two General-Purpose PIO Pins with Pulse-Generation Capability
w1-ds28e17DS28E171-Wire-to-I2C Master BridgeExtend I2C communication distance with 1-wire protocol, 100 meters (typ) in Standard Speed for a properly configured network
w1-smemDriver for 1-wire Dallas network protocol, 64bit memory family.
w1-thermDS18S20High-Precision Digital Thermometer±0.5°C Accuracy from -10°C to +85°C
DS1822Econo Digital Thermometer±2.0°C Accuracy from -10°C to +85°C
DS18B20Programmable Resolution Digital Thermometer±0.5°C Accuracy from -10°C to +85°C, Programmable Resolution from 9 Bits to 12 Bits
DS1825Programmable Resolution Digital Thermometer With 4-Bit ID4 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
DS28EA00Digital Thermometer with Sequence Detect and PIOTwo 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.


More Information