diff options
| author | Paul Oliver <contact@pauloliver.dev> | 2025-12-12 17:17:36 +0000 |
|---|---|---|
| committer | Paul Oliver <contact@pauloliver.dev> | 2025-12-12 17:17:36 +0000 |
| commit | 459d2c5630e1296807bbf23fd4360fb4d4f5bbe7 (patch) | |
| tree | d0bfcacdf976f65ac091714e4203e2db231ff156 /README.md | |
| parent | 76435516f5784124f3aa8cd540f9e7ab0047882d (diff) | |
Adds basic I2C config and documentation
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 45 |
1 files changed, 45 insertions, 0 deletions
@@ -71,6 +71,51 @@ References: - [RPi Kernel Issue #6983](https://github.com/raspberrypi/linux/issues/6983) - [Libcamera Installation Guide](https://blog.jirkabalhar.cz/2024/02/raspberry-camera-on-archlinux-arm-in-2024/) +## I2C Setup: +The provided `config.txt` exposes `/dev/i2c-0` on GPIO pins 0 (SDA) and 1 (SCL). +Ensure your user has I2C permissions: +```console +user@alarm$ sudo usermod ${USER} -aG i2c +``` + +Verify the interface works. Expected output (no devices yet): +```console +user@alarm$ sudo i2cdetect -y 0 + 0 1 2 3 4 5 6 7 8 9 a b c d e f +00: -- -- -- -- -- -- -- -- +10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +70: -- -- -- -- -- -- -- -- +``` + +## Battery Monitoring with INA226 +This repository includes INA226 voltage/current sensing via I2C. +For battery-powered operation: + +### Hardware Connections +1. Battery terminals: V+/V- on INA226 +2. Load current path (Pi + motor controllers): I+/I- on INA226 +3. I2C lines: SDA/SCL (GPIO 0/1) +4. 3V3 power and GND + +The INA226 should appear at address `0x40`: +```console +user@alarm$ sudo i2cdetect -y 0 + 0 1 2 3 4 5 6 7 8 9 a b c d e f +00: -- -- -- -- -- -- -- -- +10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +70: -- -- -- -- -- -- -- -- +``` + ## Build Instructions: 1. Install [`stack`](https://docs.haskellstack.org/en/stable/). It’s recommended to use [`ghcup`](https://www.haskell.org/ghcup/) for |
