

The DS2417 crystal-controlled real-time clock.The DS18B20 and MAX31820 temperature sensors.The 1-Wire interface was originally developed by Dallas Semiconductor, which was acquired by Maxim Integrated in 2001, and Maxim now make a few interesting devices that communicate by 1-Wire: It's especially useful on processors with a limited number of I/O pins, such as the ATtiny85, as it only uses up one pin. Introductionġ-Wire is an ingenious interface that allows a master device to communicate with one or more slave devices over a single wire (plus ground). I also plan to use it in a couple of project that I'll describe in future articles. To test it I built a circuit driving a serial 4-digit seven-segment display, displaying temperature using the DS18B20 1-Wire temperature sensor:Ī digital thermometer based on the DS18B20 and a simple 1-Wire interface for the ATtiny85. Other means of connecting 1-Wire devices to the Raspberry Pi are also possible, such as using i2c to 1-Wire bridge chips.This article describes a simple 1-Wire interface for the ATtiny85, or other AVR processors.

Using w1-gpio on the Raspberry Pi typically needs a 4.7 kΩ pull-up resistor connected between the GPIO pin and a 3.3v supply (e.g. Once any of the steps above have been performed, and discovery is complete you can list the devices that your Raspberry Pi has discovered via all 1-Wire busses (by default GPIO 4), like so: ls /sys/bus/w1/devices/ Sudo dtoverlay w1-gpio gpiopin=27 pullup=0 # header pin 13 Sudo dtoverlay w1-gpio gpiopin=17 pullup=0 # header pin 11 Newer kernels (4.9.28 and later) allow you to use dynamic overlay loading instead, including creating multiple 1-Wire busses to be used at the same time: sudo dtoverlay w1-gpio gpiopin=4 pullup=0 # header pin 7 If you would like to use a custom pin (the default is GPIO 4)Īlternatively you can enable the one-wire interface on demand using raspi-config, or the following: sudo modprobe w1-gpio

To enable the one-wire interface you need to add the following line to /boot/config.txt, before rebooting your Pi: dtoverlay=w1-gpio The Raspberry Pi supports one-wire on any GPIO pin, but the default is GPIO 4. One-wire is a single-wire communication bus typically used to connect sensors to the Pi.
