Using OS- tools can more or less give accurate information about the energy consumption by the operating system and the CPU. In any general device, this could be sufficient as in such devices as the most energy supply Is used by CPU computation.
But in cases of SBCs like Raspberry Pi, Nvidia Jetson Boards this is not sufficient as there are other factors as well which consume energy comparable to that of CPU computation. Eg.Energy consumption by networking components like Ethernet, GPIO, UART, etc.
To overcome this problem and to get the complete power consumption, an external power meter needs to be integrated into the SBC
For this we would be using Tasmota EU plug V2 by Athom . This is based on tasmota-HLW8032 , providing control using MQTT,Web UI , HTTP.
- Go compiler
- Configured PowerMeter (Tasmotta-HLW8032)
open up a terminal
-
Clone the repo ,go in the folder
-
Run using go compiler
sudo go run cmd/main.go
powertop requires sudo permission to access the system stats -
Bare prometheus metrics can be seen using
curl 0.0.0.0:8881/metrics
docker run -d -p 8888:8881 sibseh/powermeter:v4
- Bare prometheus metrics can be seen using
curl 0.0.0.0:8888/metrics |grep current_count|voltage_count
These can be run with graphana and prometheus easily with the docker compose file
-
Open up a terminal in the same directory
docker-compose up
-
Open your favourite brower with localhost:3000 , it will open up Graphana, login with username and password both as
admin
-
Go to configuration ->Data sources -> Add Prometheus -> set Http as
http://prometheus:9090
-
Go to create -> Dashboard -> Select one
-
Add current_count , voltage_count
6 . Now you can see clearly the parameters of your system calculated !!
The final set up should look like this
Viewing voltage_count variation