https://github.com/sndnvaps/ups_monitor-go
cmd shell ups monitor by Raspberry Pi I2C interface (https://www.waveshare.net/wiki/UPS_HAT)
https://github.com/sndnvaps/ups_monitor-go
golang ina219 raspberry-pi ups
Last synced: 3 months ago
JSON representation
cmd shell ups monitor by Raspberry Pi I2C interface (https://www.waveshare.net/wiki/UPS_HAT)
- Host: GitHub
- URL: https://github.com/sndnvaps/ups_monitor-go
- Owner: sndnvaps
- License: agpl-3.0
- Created: 2022-07-14T11:15:08.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-10T15:29:08.000Z (almost 4 years ago)
- Last Synced: 2025-01-08T17:53:01.886Z (over 1 year ago)
- Topics: golang, ina219, raspberry-pi, ups
- Language: Go
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ups monitor
ups status monitor for Raspberry Pi Openwrt
# 图片

# connect (openwrt raspbeery pi需要先安装i2c内核驱动的支持)
Raspberry Pi I2C interface
# hack (如果获取ups连接到树莓派后,用的是哪个地址)
```bash
opkg install i2c-tools
i2cdetect -y 1
```

默认设置的地址为 0x42(需要修改 [/ina219.go#L44](/ina219.go#L44))
```go
// create the sensor Opts
sensorOpts := ina219.Opts{
Address: 0x42, // ina219 ic2 address
SenseResistor: 100 * physic.MilliOhm, // 0.1Ohm
MaxCurrent: 1000 * physic.MilliAmpere, //1A
}
```
# depend
# how to build
## Install golang in the host (the host system must by Linux or Mac)
## just run make to build the ups_monitor
```bash
make
```
# Install ups_monitor to Raspbery Pi
192.168.xx.xx is the ip of you RPI
```bash
scp ups_monitor root@192.168.xx.xx:/tmp
```
# Run ups_monitor on Raspberry Pi
connect RPI with ssh
```bash
cd /tmp
mv /tmp/ups_monitor /usr/bin/ups_monitor
ups_monitor
```
# wiki
## ups-hat介绍文档
https://www.waveshare.net/wiki/UPS_HAT
## Raspberry Pi OpenWRT打开 I2C支持
https://www.icode9.com/content-4-1367375.html
# python support from waveshare
https://www.waveshare.net/w/upload/d/d9/UPS_HAT.7z
# 声明
此代码,目前只测试于 微雪的UPS_HAT
编译的时候,需要go支持