Jump to content

APC UPS CS 650 - "Dumb" to "Smart"

Well, i'm kind of bored at work so i did this:

Pi4 with docker (influxdb + grafana) with exposed ports for both.

Pi Zero W connected to an UPS (APC CS 650) 400W (you need the USB -> RJ45 that came with the UPS or you can buy one online, they're pretty cheap).

 

My set up:

Pi Zero W collecting the metrics with telegraf and posting them to my influxdb on pi 4 and showing them in grafana, also on pi 4. This could be done just by using a single pi 4. But by the sake of madness, a zero w was also installed.

 

Now, on the pi connected to the ups:

sude apt-get update
sudo apt-get install apcupsd
 
Change the apcupsd config file to adjust to this properties:
sudo nano /etc/apcupsd/apcupsd.conf
#
#UPSCABLE smart
UPSCABLE usb

#UPSTYPE apcsmart
#DEVICE /dev/ttyS0
UPSTYPE usb
 
Start apcupsd:
sudo service apcupsd start
 
Test the setup with the command:
apcaccess (ups stats should be displayed)
 
Now install telegraf (influxdb repo needs to be added in order to install it like this)
sudo apt-get install telegraf
 
Edit telegraf file:
sudo nano /etc/telegraf/telegraf.conf
 
And add this to the bottom:
[[inputs.apcupsd]]
#   # A list of running apcupsd server to connect to.
#   # If not provided will default to tcp://127.0.0.1:3551
#   servers = ["tcp://127.0.0.1:3551"]
#
#   ## Timeout for dialing server.
#   timeout = "5s"

Search for this line:

[[outputs.influxdb]]

and uncomment / edit in accordance

urls = ["http://192.168.1.118:8086"] --> this is is my docker IP for the influx DB. you can point it to localhost:8086 if you have influx on the same machine without docker.

 

Check the status:

sudo systemctl status telegraf (use start instead of status in order to start it)

 

Now, grafana side. I won't get into the details of installing grafana, but feel free to ask for help if you need.

Create the data source. For minimal config just set the data source name and HTTP URL.

imagem.thumb.png.0ccc10f02d0c22a95ef0c5b298c63422.png

 

So, cool side, click on the PLUS ( + ) sign of grafana and select "Import"

Add the ID 10835 (https://grafana.com/grafana/dashboards/10835) and name it accordingly, setting the newly created upsdb data source.

And you're pretty much done. Go check your new dashboard, you little rascal!!

I've made a few changes to mine, so it has the 400W value, the price per kWh, set the graphs to euros and a couple more things i cannot recall but will gladly post my JSON file.

This is the final look:

imagem.thumb.png.47f4b3ab429ada21876c03b87bfed4ce.png

And the end part:

imagem.thumb.png.9b35586cf6e7c12a16775b8af9ff9503.png

 

Truth be told, my pi zero w only increased the load value by 3W :D so it's pretty neat! This dash was not originally created by me, i just added / altered some of the graphs and Grafana Variables so it would suit my needs. I already had a TIG stack running on pi 4 (Telegraf + InfluxDB + Grafana) for monitoring purposes, i just added another dash to my grafana so i can monitor my UPS stuff on the other room. Pretty cheat, pretty cool, pretty easy!

Feel free to ask any questions!

Sharing the good vibes around!

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×