==== 1wire bus ====
{{:interfaces:1wire.jpg?100}}
\\ \\
{{:interfaces:1wire-2.jpg?100}}
\\ \\
{{:interfaces:keyes.jpg?100}}
The 1wire bus supports various low speed digital devices and is supported in Linux on the Raspberry Pi.
NB All DS18B20 thermometer ICs from non-reputable dealers are fake.
=== Raspberry Pi ===
Edit boot/config.txt to assign gpio4 for 1wire.
dtoverlay=w1-gpio,gpiopin=4
Reboot and after load driver.
modprobe w1_gpio
These are the GPIO header pin assignments for the 1 wire bus.
^Pin ^Name ^Function |
| 1 | 3V3 | POWER|
| 6 | GND| GROUND |
| 7 | GPIO4 | DATA|
The relevant pins on the Pi header are as follows.
+---P1---+
3V3 01 02 5V
GPIO0/GPIO2 03 A/A+ 04 5V
GPIO1/GPIO3 05 B/B+ 06 GND
GPIO4 07 2 08 GPIO14/TX
.. ..
NB. The 1 wire data line must pulled high via 4K7 to 3V3 power.
=== DS18B20 thermometer ===
{{:interfaces:ds18b20.jpg?50}}
TO-92
+-------+
| 1 2 3 |
+-------+
| | |
| | |
1 GROUND
2 DATA
3 POWER
ROM 28 FF D6 BD 60 14 04 95 (clone)
modprobe w1_therm
cat /sys/bus/w1/devices/28-041460bdd6ff/w1_slave
8f 01 55 00 7f ff 0c 10 a0 : crc=a0 YES
8f 01 55 00 7f ff 0c 10 a0 t=24937
=== DS18B20 water-proof thermometer ===
{{interfaces:tempprobe.jpg?50}}
BLACK GROUND
YELLOW DATA
RED POWER
ROM 28 FF CB AA 72 15 02 A7 (clone)
=== KEYES KY-001 DS18B20 thermometer module ===
{{:interfaces:keyes2.jpg?50}}
This module re-orders the pins so beware.
+-------+
|DS18B20|
| |
+-G R Y-+
| | |
G GROUND
R POWER
Y DATA
ROM 28 FF 51 73 A8 15 03 12 (clone)
DATA is pulled up via a 4K7 resistor and an LED. The LED will flash
during communication with the chip.
=== DS2431 EEPROM ===
+-------+
| 1 2 3 |
+-------+
| | |
| | |
1 GROUND
2 DATA
3 NC
modprobe w1_ds2431
echo "hello world" > /sys/bus/w1/devices/2d-00000de5d608/eeprom
cat /sys/bus/w1/devices/2d-00000de5d608/eeprom
hello world
=== Resources ===
[[https://datasheets.maximintegrated.com/en/ds/DS18B20.pdf|DS18B20 thermometer data-sheet]]
[[https://datasheets.maximintegrated.com/en/ds/DS2431.pdf|DS2431 EEPROM data-sheet]]
[[https://github.com/cpetrich/counterfeit_DS18B20|Fake DS18B20]]