This is an old revision of the document!
1-wire Bus
To provide 1-Wire Bus Connections between various 1-Wire- and Hostdevices different connection methods can be used. They can be connected to a Host using a bus converter. USB, RS-232 serial port interfaces are popular solutions for connecting 1-Wire Devices to the Hostdevice. But 1-Wire devices can also be interfaced directly to Controllers from various vendors using a GPIO Pin.
This guide will only cover 1-Wire Bus Connections because (as of Sep 13, 2019) it is the latest stable release available to Openwrt systems. The Device which got tested was a OrangePI PC+ running OpenWrt v18.06.4.
Installation
e.g. for using B18S20 Sensors
opkg update opkg install kmod-w1 kmod-w1-master-gpio kmod-w1-gpio-custom kmod-w1-slave-therm
Configuration
Configure the GPIO pin connected to the data line of the sensor. The Section “Software” in this howto describes how to determine the GPIO.
Create/Edit /etc/modules.d/55-w1-gpio-custom, replace 19 with the GPIO which you determined in the last step. You can have a maximum of 4 busses with a maximum of 64 slaves (each? untested!).
echo "w1-gpio-custom bus0=0,19,0" > /etc/modules.d/55-w1-gpio-custom
In case, it is a Sunxi Device and you like to connect e.g. Pin 29 (=PA7) Sunxi says:
(position of letter in alphabet - 1) * 32 + pin number
so the GPIO for PA7 would be ( 1 - 1) * 32 + 7 = 0 + 7 = 7 (since 'a' is the first letter). This results in the following configuration
echo "w1-gpio-custom bus0=0,7,0" > /etc/modules.d/55-w1-gpio-custom
...to be continued...