Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| docs:techref:hardware:port.gpio:1-wire [2019/09/14 02:37] – [electrical Configuration] elux011 | docs:techref:hardware:port.gpio:1-wire [2024/09/18 09:35] (current) – [1-wire Bus] elux011 | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| But 1-Wire devices can also be interfaced directly to Controllers from various vendors using a GPIO Pin. | 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 | + | This guide will only cover 1-Wire Bus Connections |
| + | Therefore the Installation is a bit more extensive. | ||
| + | The Device which got tested was a **OrangePI PC+** (a different method is recommended for the Raspberry Pi!). | ||
| - | ===== Installation ===== | + | ===== Installation |
| - | In order to use a GPIO for the 1-Wire bus, e.g. for using [[https:// | + | In order to use a GPIO for the 1-Wire bus, i.e. for using [[https:// |
| < | < | ||
| Line 16: | Line 18: | ||
| - | ===== Configuration ===== | + | ===== Configuration |
| Configure the GPIO pin connected to the data line of the sensor. | Configure the GPIO pin connected to the data line of the sensor. | ||
| Line 30: | Line 32: | ||
| The last Zero of the sequence means "not open-drain" | The last Zero of the sequence means "not open-drain" | ||
| - | After modifying the file / | + | After modifying the file / |
| When the 1-Wire bus is successfully set up, you should see in / | When the 1-Wire bus is successfully set up, you should see in / | ||
| - | Within this directory you will find a number of files including " | + | Within this directory you will find a number of files including " |
| In case, it is a Sunxi Device and you like to connect e.g. Pin 29 (=PA7) [[https:// | In case, it is a Sunxi Device and you like to connect e.g. Pin 29 (=PA7) [[https:// | ||
| Line 41: | Line 43: | ||
| so the GPIO for PA7 would be ( 1 - 1) * 32 + 7 = 0 + 7 = 7 (since ' | so the GPIO for PA7 would be ( 1 - 1) * 32 + 7 = 0 + 7 = 7 (since ' | ||
| + | |||
| + | (Or you take a look with | ||
| + | < | ||
| + | cat / | ||
| + | </ | ||
| + | for the mappings...) | ||
| + | |||
| This results in the following configuration | This results in the following configuration | ||
| < | < | ||
| Line 46: | Line 55: | ||
| </ | </ | ||
| + | ===== Installation as of v21.02.0 ===== | ||
| + | There are several possible Ways to install. | ||
| + | The Way described here assumes, that an Image has been installed on a [[docs: | ||
| + | |||
| + | **This Description again refers to an Orange Pi PC+, Pin " | ||
| + | |||
| + | First install the necessary several additional packages: | ||
| + | |||
| + | < | ||
| + | opkg update | ||
| + | opkg install kmod-w1 kmod-w1-master-gpio kmod-w1-slave-therm | ||
| + | </ | ||
| + | |||
| + | As of v21.02.0 the Configuration of the Driver is done via the [[docs: | ||
| + | On your Computer you need a Device-Tree-Compiler installed. Several Linux Distributions have it available in the Repositys. | ||
| + | |||
| + | The Device Tree can be changed as follows: | ||
| + | * Connect the SD Card to your Computer and look at lsblk or dmesg to identify it. In most Cases, it would be something like /dev/sdX. | ||
| + | * Mount and open the " | ||
| + | * there are 3 Files in the Partition: boot.scr, dtb, uImage | ||
| + | * Copy the File " | ||
| + | * decompile | ||
| + | |||
| + | < | ||
| + | dtc dtb -O dts -I dtb -o OPi.dts | ||
| + | </ | ||
| + | |||
| + | * You get a File named " | ||
| + | * Inside the Section " | ||
| + | |||
| + | < | ||
| + | pins = " | ||
| + | function = " | ||
| + | phandle = < | ||
| + | }; | ||
| + | </ | ||
| + | |||
| + | and at the end of the file (**but before the last bracket!**) add: | ||
| + | | ||
| + | < | ||
| + | w1-gpio { | ||
| + | compatible = " | ||
| + | label = " | ||
| + | pinctrl-names = " | ||
| + | pinctrl-0 = < | ||
| + | gpios = <0xa 0x0 0x3 0x6>; | ||
| + | status = " | ||
| + | }; | ||
| + | </ | ||
| + | Notice: | ||
| + | - phandle: you have to use a hex number following the highest number of phandle used in the file. | ||
| + | - gpios: the " | ||
| + | |||
| + | * compile | ||
| + | |||
| + | < | ||
| + | dtc OPi.dts | ||
| + | </ | ||
| + | |||
| + | * copy the new " | ||
| + | * Check the output of " | ||
| + | < | ||
| + | ... | ||
| + | kern.info kernel: [ 7.610839] Driver for 1-wire Dallas network protocol. | ||
| + | ... | ||
| + | kern.info kernel: [ 7.688174] w1_master_driver w1_bus_master1: | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | |||
| ===== electrical Configuration ===== | ===== electrical Configuration ===== | ||
| - | To connect | + | To connect 1Wire Devices |
| - | On the Internet, other values are given also, here it works well with 4.7kOhm. | + | On the Internet, other values are given also, here it works well with 4.7kOhm |
| - | {{http://r-ost.de/ | + | {{:media: |
| It is also possible to operate the 1-Wire Bus with just the Gnd and Bus Lines, with the Sensors deriving power " | It is also possible to operate the 1-Wire Bus with just the Gnd and Bus Lines, with the Sensors deriving power " | ||
| + | For longer cables, the use of an insulator such as ADUM1201 is recommended. | ||