24 lines
No EOL
648 B
Python
24 lines
No EOL
648 B
Python
#!/usr/bin/env python3
|
|
import powermon as pm
|
|
from time import sleep
|
|
|
|
sensors = [
|
|
[0x40, 0x08B6], # pink/blue: Pi
|
|
[0x44, 0x0B60] # pink/pink: Solar panel
|
|
]
|
|
|
|
solarmon = pm.PowerMon(sensors)
|
|
powerData = None
|
|
|
|
while True:
|
|
data = solarmon.getData()
|
|
print("Raspberry Pi Power Consumption:")
|
|
print(f"Vbus:\t\t{powerData[0].voltage} V")
|
|
print(f"Current:\t{powerData[0].current} A")
|
|
print(f"Power:\t\t{powerData[0].power} W")
|
|
|
|
print("\nSolar Panel Power Production:")
|
|
print(f"Vbus:\t\t{powerData[1].voltage} V")
|
|
print(f"Current:\t{powerData[1].current} A")
|
|
print(f"Power:\t\t{powerData[1].power} W")
|
|
sleep(1) |