Skip to content

A modern, dependency-free application to monitor your APC UPS in real-time. View battery voltage, load, runtime, and AVR status in a clean overlay window

Notifications You must be signed in to change notification settings

diqezit/CustomUPC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

UPS Monitor

Platform Windows Language C++20 GUI ImGui Graphics DirectX 11 Status Active

Last commit Release Repo size

A lightweight, modern Windows application for real-time monitoring of APC UPS devices via USB HID protocol.
Designed for minimal resource usage with zero external dependencies.


πŸ“‹ Table of Contents


✨ Features

Core Monitoring

  • Battery Voltage: Real-time battery voltage with health indicators
  • Input/Output Voltage: Monitor AC input and regulated output
  • Load Percentage: Current power load on UPS
  • Charge Level: Battery charge percentage with visual progress bar
  • Runtime Estimate: Estimated remaining runtime on battery
  • AVR Status: Automatic Voltage Regulation mode (Boost/Trim/Normal)

Advanced Features

  • Modern UI: Clean, dark-themed interface built with Dear ImGui
  • Always-on-Top: Floating window stays visible over other applications
  • Draggable: Click and drag header to reposition
  • Health Indicators: Color-coded status (Green/Yellow/Red)
  • Device Info: Manufacturer, product name, and serial number
  • Extended Metrics: Frequency, sensitivity, beeper status

Technical Highlights

  • Zero Dependencies: Single executable, no installation required
  • Low Resource Usage: Minimal CPU and memory footprint
  • USB HID Protocol: Direct communication without drivers
  • Auto-Reconnect: Automatic device reconnection on disconnect

πŸ“Έ Screenshots

Main monitoring window showing real-time UPS status

Main Window Screenshot


πŸ”Œ Supported Devices

Confirmed Compatible

Vendor Models
APC Back-UPS, Back-UPS Pro, Smart-UPS series
MGE Ellipse, Protection Station
Belkin UPS devices with USB HID

Vendor IDs

  • APC: 0x051D
  • MGE: 0x0463
  • Belkin: 0x050D

Note: Any UPS device using standard USB HID Power Device class should work.


πŸ•΅οΈ Reverse Engineering

This project utilizes advanced reverse engineering techniques to ensure accurate data interpretation from the UPS HID interface.

  • Tools Used: IDA Pro was used extensively to analyze the official APC monitoring software (PowerChute).
  • Protocol Analysis: Decompiled routines helped uncover hidden HID report IDs and data scaling factors not publicly documented.
  • Accuracy: Thanks to this analysis, voltage readings and status flags (AVR Boost/Trim, Overload) are decoded with 100% accuracy matching official specifications.

πŸ”¨ Building from Source

Prerequisites

  • Visual Studio 2022 with C++ Desktop Development workload
  • CMake 3.20+
  • Windows SDK 10.0+

Required Libraries

The project includes header-only dependencies:

  • hidapi-win: HID API headers
  • imgui: Dear ImGui headers and backends

Build Steps

  1. Clone repository
  2. Create build directory
  3. Generate project files
  4. Build using CMake

CMake Configuration

  • Minimum Version: 3.20
  • Language: C++20
  • Standard Required: ON

πŸ—οΈ Architecture

Project Structure

  • src/main.cpp: Application entry point
  • src/core/: Core logic (State, Monitor, Device)
  • src/ui/: User Interface rendering
  • src/utils/: Utility functions (Logger, Utf8)
  • lib/: External libraries (hidapi, imgui)
  • res/: Windows resources

Module Responsibilities

Module Purpose
UpsState.h Pure data structures, enums, constants
UpsMonitor.h Data processing, validation, formatting
UpsDevice.h USB HID communication, device management
MainWindow.h UI rendering with ImGui/DirectX11

Data Flow

UpsDevice (HID Read) -> UpsMonitor (Process) -> UpsState (Data) -> MainWindow (Render)


πŸš€ Usage

Basic Operation

  1. Connect your UPS via USB cable
  2. Run UpsMonitor.exe
  3. Monitor real-time UPS status

Window Controls

  • Move window: Click and drag header area
  • Close: Click X button
  • Minimize: Not applicable (always visible)

Status Indicators

  • ONLINE: Normal operation on AC power
  • CHARGING: Battery charging
  • ON BATTERY: Running on battery power
  • AVR BOOST: Voltage regulation active (boosting)
  • AVR TRIM: Voltage regulation active (trimming)
  • OVERLOAD: UPS overloaded
  • REPLACE BATTERY: Battery needs replacement
  • DISCONNECTED: No UPS detected

Health Colors

  • Battery Voltage: > 11.5V (Good), 10.6-11.5V (Warning), < 10.6V (Critical)
  • Charge: > 50% (Good), 20-50% (Warning), < 20% (Critical)
  • Load: < 50% (Good), 50-80% (Warning), > 80% (Critical)
  • Runtime: > 15 min (Good), 5-15 min (Warning), < 5 min (Critical)

βš™οΈ Configuration

Thresholds

  • Battery Full: 13.20V
  • Battery Warning: 11.50V
  • Battery Critical: 10.60V
  • Charge Warning: 50%
  • Charge Critical: 20%
  • Load Warning: 50%
  • Load Critical: 80%
  • Runtime Warning: 15 min
  • Runtime Critical: 5 min

Logging

Logs are written to ups_monitor.log in the application directory.


πŸ”§ Troubleshooting

UPS Not Detected

  1. Check USB connection: Try different cable/port
  2. Verify device: Open Device Manager -> Human Interface Devices
  3. Check permissions: Run as Administrator
  4. Restart: Disconnect/reconnect UPS

Incorrect Readings

  1. Wait for calibration: Initial readings may take 5-10 seconds
  2. Check battery age: Old batteries may report inaccurate data
  3. Verify model: Some UPS models have limited HID support

Application Won't Start

  1. Install Visual C++ Runtime: Ensure VC++ Redistributable is installed
  2. Update DirectX: Ensure DirectX 11 is available
  3. Check antivirus: Add exception for UpsMonitor.exe

High CPU Usage

  1. Check GPU drivers: Update to latest version
  2. Verify DirectX: Run dxdiag to check status

πŸ“„ License

This project is provided as-is for educational and personal use.


πŸ™ Acknowledgments

  • Dear ImGui β€” Immediate mode GUI library
  • HIDAPI β€” Cross-platform HID library
  • APC β€” UPS HID protocol documentation

Made with ❀️ for UPS monitoring

Report Bug Β· Request Feature