From 75d230b447857d566f1653152b2b7e1e6b58115f Mon Sep 17 00:00:00 2001 From: webeling67 <61348455+webeling67@users.noreply.github.com> Date: Mon, 22 Mar 2021 11:24:51 +0100 Subject: [PATCH] Update enable_i2c.md (#17005) Co-authored-by: Stefan Agner Co-authored-by: Franck Nijhof --- source/_includes/common-tasks/enable_i2c.md | 25 ++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/source/_includes/common-tasks/enable_i2c.md b/source/_includes/common-tasks/enable_i2c.md index 24f69bec34c..252aca836d9 100644 --- a/source/_includes/common-tasks/enable_i2c.md +++ b/source/_includes/common-tasks/enable_i2c.md @@ -1,23 +1,24 @@ ## Enable I2C -Home Assistant using the Home Assistant Operating System is a managed environment, which means you can't use existing methods to enable the I2C bus on a Raspberry Pi. +Home Assistant using the Home Assistant Operating System which is a managed environment, which means you can't use existing methods to enable the I2C bus on a Raspberry Pi. In order to use I2C devices you will have to +- Enable I2C for the Home Assistant Operating System +- Setup I2C devices e.g. sensors -### Step by step instructions +### Enable I2C with an SD card reader + +#### Access the boot partition You will need: - - SD card reader - SD card with Home Assistant Operating System flashed on it -#### Step 1 - Access the Home Assistant Operating System boot partition - Shutdown/turn-off your Home Assistant installation and unplug the SD card. Plug the SD card into an SD card reader and find a drive/file system named `hassos-boot`. The file system might be shown/mounted automatically. If not, use your operating systems disk management utility to find the SD card reader and make sure the first partition is available. -#### Step 2 - Add files to enable I2C +#### Add files to enable I2C - In the root of the `hassos-boot` partition, add a new folder called `CONFIG`. - In the `CONFIG` folder, add another new folder called `modules`. @@ -32,7 +33,7 @@ and make sure the first partition is available. dtparam=i2c_arm=on ``` -#### Step 3 - Start with the new configuration +#### Start with the new OS configuration - Insert the SD card back into your Raspberry Pi. - On startup, the `hassos-config.service` will automatically pickup the new @@ -40,9 +41,7 @@ and make sure the first partition is available. - Another reboot might be necessary to make sure the just imported `rpi-i2c.conf` is present at boot time. -The I2C devices should now be present under /dev. - -### From Home Assistant Operating System Terminal +### Enable I2C via Home Assistant Operating System Terminal Alternatively, by attaching a keyboard and screen to your device, you can access the physical terminal to the Home Assistant Operating System. @@ -62,3 +61,9 @@ You can enable i2c via this terminal: sync reboot ``` +### Troubleshooting + +After rebooting the host there should be `i2c-0` and similar device files in `/dev`. If such device files are missing, enabling I2C failed for some reason. You can check the status of I2C kernel modules by using `lsmod | grep i2c` in the terminal. If they are loaded, you should find at least the entry `i2c_dev`. Active usage of the modules is indicated by a number, e.g. `i2c_dev 20480 2` would indicate two active I2C device files. + +An active I2C can also be check with a multi meter showing 3.3 V on the I2C pins GPIO2 and GPIO3. +