User Tools

Site Tools


doc:appunti:hardware:ups_apc

Using APC UPS on Debian GNU/Linux

My home-server system is powered through an UPS unit, the system is composed of the following:

  • A Dell PowerEdge T110 with two 4 Tb hard disks, running Debian GNU/Linux.
  • A DSL router.
  • An 8 ports switch.

All the equipments drawn about 62 W during daily operation. In several years I tested the following two APC UPSs:

  • In 2006 I purchased an APC Smart-UPS 750 USB.
  • In 2022 I purchased an APC Back-UPS CS 500.

Both units support monitoring through an USB cable and the apcupsd program, it seems that the Back-UPS CS 500 does not support the periodic self-test.

The APC Back-UPS CS 500 should be able to supply power for about 30 minutes to the above system (which the USP itself senses as a 16% load); doing battery calibration with the apctest tool, it took about 10 minutes to drop from 100% battery charge to 70%.

APC Smart-UPS 750 USB

L'apparato ha dimensioni 14 x 36 x 16 cm (larghezza, profondità, altezza) ed è equipaggato con due batterie sostituibili dall'utente di dimensioni 151 x 65 x 97.5 mm, capacità di 12 v 7.0 Ah e attacchi Faston F2 (6.35 mm).

Installare il pacchetto apcupsd. Per visualizzare convenientemente lo stato dell'UPS si può usare l'interfaccia web fornita dal pacchetto apcupsd-cgi oppure l'interfaccia gtk di gapcmon.

Il kernel dovrebbe riconoscere il device appena collegato il cavo USB:

usb 1-2: new low speed USB device using uhci_hcd and address 3
usb 1-2: configuration #1 chosen from 1 choice
usbcore: registered new interface driver hiddev
hiddev96: USB HID v1.10 Device [American Power Conversion Smart-UPS 750 FW:651.13.I USB FW:7.3] on usb-0000:00:1d.0-2
usbcore: registered new interface driver usbhid
drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver

Il device dovrebbe essere /dev/usb/hiddev0 (con un kernel 2.6).

Per debug controllare

cat /proc/bus/usb/devices
ls -l /sys/bus/usb/drivers/
ls -la /dev/usb/hiddev0

Se si è installato il pacchetto apcupsd-cgi si può puntare il browser su http://localhost/cgi-bin/apcupsd/multimon.cgi.

Configurazione di apcupsd

Editare opportunamente il file /etc/apcupsd/apcupsd.conf, si specifica il tipo di cavo, il protocollo e si chiede di fare l'autodetect del device:

UPSCABLE usb
UPSTYPE usb
DEVICE

Per i vecchi sistemi basati sugli initscript sysv bisogna editare anche il file /etc/default/apcupsd, mettendo:

ISCONFIGURED=yes

Gli altri parametri importanti sono le soglie a cui iniziare lo shutdown in caso di mancanza di tensione di rete. Si indica quando iniziare lo spengimento in termini di percentuale di carica residua della batteria o di autonomia in minuti (delle due condizioni, quella che si verifica prima):

BATTERYLEVEL 40
MINUTES 8

Monitoraggio

Se si ha il server web attivo si può puntare il browser su http://localhost/cgi-bin/apcupsd/multimon.cgi.

Altrimenti si esegue il programma gapcmon.

apcaccess e apctest

Con apcaccess è possibile interrogare da riga di comando lo stato dell'UPS, anche remoto:

apcaccess status
apcaccess status host:3552

Il programma apctest consente di dialogare con l'UPS e permette di eseguire numerose operazioni, molto utile è impostare la data di installazione delle batterie:

1)  Test kill UPS power
2)  Perform self-test
3)  Read last self-test result
4)  Change battery date
5)  View battery date
6)  View manufacturing date
7)  Set alarm behavior
8)  Set sensitivity
9)  Set low transfer voltage
10) Set high transfer voltage
11) Quit
New battery date MM/DD/YYYY
08/31/2006
11/15/2008
09/15/2010
09/15/2012
01/30/2016
10/23/2018
05/29/2021
10/20/2022

APC Back-UPS CS 500

The UPS system was configured on a Debian 11 Bullseye, it is equipped with a single user-replaceable battery sized 151 x 65 x 97.5 mm, terminals are Faston F2 type (6.35 mm), the battery is rated 12 volt 7.0 Ah,

Install the apcupsd Debian package. Once connected to the USB port, the GNU/Linux kernel 5.15 will log the following (through dmesg):

usb 1-6: new low-speed USB device number 14 using xhci_hcd
usb 1-6: New USB device found, idVendor=051d, idProduct=0002, bcdDevice= 0.06
usb 1-6: New USB device strings: Mfr=3, Product=1, SerialNumber=2
usb 1-6: Product: Back-UPS CS 500 FW:808.q14 .I USB FW:q14 
usb 1-6: Manufacturer: American Power Conversion
usb 1-6: SerialNumber: 4B2214P31216  
hid-generic 0003:051D:0002.0005: hiddev1,hidraw4: USB HID v1.10 Device
            [American Power Conversion Back-UPS CS 500 FW:808.q14 .I USB FW:q14 ]
            on usb-0000:00:15.0-6/input0

When the service apcupsd.service is running it is possibile to execute the apcaccess tool:

apcaccess status

the output will show the following:

APC      : 001,045,1048
DATE     : 2022-10-26 21:12:53 +0200  
HOSTNAME : ithaca
VERSION  : 3.14.14 (31 May 2016) debian
UPSNAME  : ithaca
CABLE    : USB Cable
DRIVER   : USB UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2022-10-26 21:12:51 +0200  
MODEL    : Back-UPS CS 500 
STATUS   : ONLINE 
LINEV    : 228.0 Volts
LOADPCT  : 0.0 Percent
BCHARGE  : 89.0 Percent
TIMELEFT : 188.3 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME  : 0 Seconds
OUTPUTV  : 230.0 Volts
SENSE    : Medium
DWAKE    : 0 Seconds
DSHUTD   : 180 Seconds
LOTRANS  : 180.0 Volts
HITRANS  : 266.0 Volts
RETPCT   : 0.0 Percent
ITEMP    : 29.2 C
ALARMDEL : 30 Seconds
BATTV    : 13.5 Volts
LINEFREQ : 50.0 Hz
LASTXFER : No transfers since turnon
NUMXFERS : 0
TONBATT  : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STESTI   : None
STATFLAG : 0x05000008
MANDATE  : 2022-04-10
SERIALNO : 4B2214P31216  
BATTDATE : 2022-04-10
NOMOUTV  : 230 Volts
NOMINV   : 230 Volts
NOMBATTV : 12.0 Volts
NOMPOWER : 300 Watts
FIRMWARE : 808.q14 .I USB FW:q
END APC  : 2022-10-26 21:12:54 +0200

When the service is stopped, it is possible to configure the UPS using the command apctest:

systemctl stop apcupsd.service
apctest
Checking configuration ...
sharenet.type = Network & ShareUPS Disabled
cable.type = USB Cable
mode.type = USB UPS Driver
Setting up the port ...
Doing prep_device() ...

You are using a USB cable type, so I'm entering USB test mode
Hello, this is the apcupsd Cable Test program.
This part of apctest is for testing USB UPSes.

Getting UPS capabilities...SUCCESS

Please select the function you want to perform.

1)  Test kill UPS power
2)  Perform self-test
3)  Read last self-test result
4)  View/Change battery date
5)  View manufacturing date
6)  View/Change alarm behavior
7)  View/Change sensitivity
8)  View/Change low transfer voltage
9)  View/Change high transfer voltage
10) Perform battery calibration
11) Test alarm
12) View/Change self-test interval
 Q) Quit

Select function number: 

The two most important functions are the #10 battery calibration and the #12 self-test interval. Battery calibration must be initiated with a fully charged battery and the normal load (it should be above 10%); it will end when battery drops below about 25%.

Unfortunately it seems that the Back-UPS CS 500 model does not support the configuration of the periodic self-test; chosing option #12 results always in self-test interval None. I asked the APC support about the self-test on model CS 500: a technician answered me in a few days, saying that that model does a self test on power-on and once every two weeks, but only if it is operated by the PowerChute sofware, which is non-free and proprietary software and it does not run on GNU/Linux. One alternative could be to create a cronjob script which stops the apcupsd service, run the apctest utility calling option #2 Perform self-test and then restart the apcupsd service.

New battery date (MM/DD/YYYY)
04/10/2022

Voltaggio batterie

L'UPS ospita due batterie di dimensioni 15.1 x 6.5 x 9.5 cm (larghezza, profondità, altezza terminali esclusi), i terminali faston sono di tipo F2 cioè da 6.35 mm (0.25 pollici). In questo formati si trovano batterie di capacità da 7.2, 8.4 oppure 9 Ah.

Le batterie in questo UPS sono di tipo VRLA (valve regulated lead–acid), realizzate normalmente con tecnologia gel oppure AGM (absorbent glass mat). La tensione di queste batterie rispetto al livello di carica è riportata nella tabella a fianco.

Generalmente la corrente in standy-by (float voltage, cioè la tensione a cui viene mantenuta in carica la batteria senza produzione di gas nell'elettrolita) e la corrente di ricarica (boost voltage, la tensione a cui viene ricaricata la batteria dopo che è stata scaricata) deve essere la seguente:

Float voltage 13.50 - 13.80 V
Boost voltage for cyclic use 14.40 - 15.00 V
doc/appunti/hardware/ups_apc.txt · Last modified: 2022/11/02 17:49 by niccolo