Skip to content

Instantly share code, notes, and snippets.

View frankgould's full-sized avatar

Frank Gould frankgould

  • Orlando, Florida
View GitHub Profile
@frankgould
frankgould / smartups3.py
Created August 25, 2020 14:25
Geekworm UPS3 RPi HAT Modified Example Code
import os, smbus, time, logging, atexit
from datetime import datetime
log_file = '/home/rover_logs/rover-battery-log-' + datetime.now().strftime('%m-%d-%y') + '.txt'
logging.basicConfig(filename=log_file,level=logging.DEBUG)
logging.info('==================== Rover UPS3 Battery Capacity Communications Client Logging Started ' + datetime.now().strftime('%m-%d-%y %H:%M:%S'))
BYTE_CONV_ADC_START = 0b10011101
BYTE_CONV_ADC_STOP = 0b00011101
BYTE_WATCHDOG_STOP = 0b10001101 #Stop Watchdog timer
@frankgould
frankgould / battery_log.txt
Created August 25, 2020 14:28
Geekworm UPS3 RPi HAT Battery Status Log
INFO:root:==================== Rover UPS3 Battery Capacity Communications Client Logging Started 08-25-20 08:30:13
INFO:root:08:30:15 - Input: Connected, State: Charging, Voltage: 4.20, Capacity: 100%. Value max17048_soc = 50.39453125
INFO:root:08:30:22 - Input: Connected, State: Charging, Voltage: 4.20, Capacity: 100%. Value max17048_soc = 50.77734375
INFO:root:08:30:28 - Input: Connected, State: Charging, Voltage: 4.20, Capacity: 100%. Value max17048_soc = 50.77734375
INFO:root:08:30:34 - Input: Connected, State: Charging, Voltage: 4.20, Capacity: 100%. Value max17048_soc = 51.16015625
INFO:root:08:30:40 - Input: Connected, State: Charging, Voltage: 4.20, Capacity: 100%. Value max17048_soc = 51.16015625
INFO:root:08:30:46 - Input: Connected, State: Charging, Voltage: 3.80, Capacity: 44%. Value max17048_soc = 51.546875
INFO:root:***** Battery at 41%. Power Disconnected, system will shutdown in 31 minutes!
INFO:root:08:30:53 - Input: Disconnected, State: Discharging, Voltage: 3.78, max17048_soc: 51.546875, Ti