Dallas 1-Wire Support

You have to check /etc/modprobe.d/w1_gpio.conf file to enable the 1-wire driver.







Default GPIO for 1-Wire is Pin #7 (GPIOX.BIT21)

Pin 1 (Left): Ground (-)

Pin 2 (Middle): Pin #7 C2 (GPIOX.BIT21)

Pin 3 (Right): VCC (3.3V)

You also need to add a resistor from 4.7k to 10k between pin 2.

Pin 1 (Left): Ground (-)

Pin 2 (Middle): Pin #7 C2 (GPIOX.BIT21)

Pin 3 (Right): Ground (-)

You also need to add a resistor from 4.7k to 10k between pin 2.

As you can see my sensor is detected as 10-000802f38c57, each sensor has a different id. So yours will be different.

odroid@odroid64:/sys/bus/w1/devices$ cd 10-000802f38c57
odroid@odroid64:/sys/bus/w1/devices/10-000802f38c57# cat w1_slave
33 00 4b 46 ff ff 03 10 30 : crc=30 YES
33 00 4b 46 ff ff 03 10 30 t=25562
odroid@odroid64:/sys/bus/w1/devices/10-000802f38c57#

Temperature is t=25562 or 25.562 degree's Celsius.

Multiple sensors can be connected on the same line as the draw below.

odroid@odroid64:/sys/bus/w1/devices# ls
10-000802f38c57  10-000802f41d67  w1_bus_master1

Two sensors in parallel.

Change the Default GPIO pin for 1-Wire interface

Ex) Default GPIO pin change to GPIOX.BIT19
Please refer to below links for details related to gpio mapping in the device-tree.
C2 gpio mapping in the device-tree

odroid@odroid64:~$ sudo apt-get install device-tree-compiler
odroid@odroid64:~$ fdtget /media/boot/meson64_odroidc2.dtb /onewire gpios
18 113 0
odroid@odroid64:~$ fdtput /media/boot/meson64_odroidc2.dtb /onewire gpios 18 111 0
odroid@odroid64:~$ fdtget /media/boot/meson64_odroidc2.dtb /onewire gpios
18 111 0
odroid@odroid64:~$ sudo reboot

If the reboot doesn't affect the dtb update, you need a hard reset(power off/on).

Use the first number in the fdtget command output when you run fdtput command. For example, 18(0x12) is the GPIO group number.

DS1820 is connected to Pin #11

Pin 1 (Left): Ground (-)

Pin 2 (Middle): Pin #11 C2 (GPIOX.BIT19)

Pin 3 (Right): Ground (-)