ups status monitor for Raspberry Pi Openwrt
Raspberry Pi I2C interface
opkg install i2c-tools
i2cdetect -y 1
默认设置的地址为 0x42(需要修改 /ina219.go#L44)
// create the sensor Opts
sensorOpts := ina219.Opts{
Address: 0x42, // ina219 ic2 address
SenseResistor: 100 * physic.MilliOhm, // 0.1Ohm
MaxCurrent: 1000 * physic.MilliAmpere, //1A
}
make
192.168.xx.xx is the ip of you RPI
scp ups_monitor root@192.168.xx.xx:/tmp
connect RPI with ssh
cd /tmp
mv /tmp/ups_monitor /usr/bin/ups_monitor
ups_monitor
https://www.waveshare.net/wiki/UPS_HAT
https://www.icode9.com/content-4-1367375.html
https://www.waveshare.net/w/upload/d/d9/UPS_HAT.7z
此代码,目前只测试于 微雪的UPS_HAT
编译的时候,需要go支持