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 | |
| parent | 76435516f5784124f3aa8cd540f9e7ab0047882d (diff) | |
Adds basic I2C config and documentation
| -rw-r--r-- | README.md | 45 | ||||
| -rw-r--r-- | sysconf/config.txt | 3 |
2 files changed, 47 insertions, 1 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 diff --git a/sysconf/config.txt b/sysconf/config.txt index f9ff6db..b2fdbc7 100644 --- a/sysconf/config.txt +++ b/sysconf/config.txt @@ -44,7 +44,7 @@ dtoverlay=disable-bt # Run as fast as firmware / board allows arm_boost=1 -# Set GPIO pins to output / low state on boot +# Set GPIO pins to output/low state gpio=0-27=op,dl [cm4] @@ -58,3 +58,4 @@ dtoverlay=dwc2,dr_mode=host [all] dtoverlay=pwm-2chan +dtoverlay=i2c0-pi5 |
