Skip to content

eddieogola/BatteryApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BatteryApp

A Windows battery monitoring application that plays an audio alert when your laptop battery reaches 11% charge while connected to AC power. This helps prevent overcharging and extends battery lifespan.

Features

  • Real-time Battery Monitoring: Continuously checks battery status every 500ms
  • Audio Alerts: Plays alert.wav sound when conditions are met
  • Configurable Thresholds: Battery percentage limit set to 11% (can be modified in source)
  • Low Resource Usage: Lightweight background application with minimal system impact
  • No GUI: Runs silently in the background

Technical Details

  • Language: C++
  • Platform: Windows (uses Windows API)
  • Dependencies:
    • windows.h for system power status
    • mmsystem.h for audio playback
  • Alert Conditions: Triggers when:
    • Device is connected to AC power (charging)
    • Battery percentage is ≥ 11%
  • Alert Interval: 1 second between repeated alerts

Usage

  1. Double-click BatteryApp.exe to start the application
  2. No user interface will appear - the program runs silently in the background
  3. To verify it's running:
    • Open Task Manager (Ctrl + Shift + Esc)
    • Look for "BatteryApp (32 bit)" in the process list
  4. The program will play an alert sound when your battery reaches the threshold while charging

Installation & Removal

To use: Simply double-click the BatteryApp.exe file

To uninstall: Delete the BatteryApp folder

Auto-Start on Boot (Optional)

To automatically start BatteryApp when Windows boots:

  1. Press Win + R to open the Run dialog
  2. Type %ProgramData% and click OK
  3. Navigate to: Microsoft → Windows → Start Menu → Programs
  4. Copy the BatteryApp folder into the Programs folder
  5. The program will now start automatically on every boot

Building from Source

If you want to modify or compile the application:

  1. Requirements:

    • Windows development environment
    • C++ compiler with Windows SDK support
    • Link against winmm.lib for audio functionality
  2. Compilation:

    g++ -o BatteryApp.exe main.cpp -lwinmm
  3. Customization:

    • Modify batteryPercentageLimit (line 14) to change alert threshold
    • Adjust alertInterval (line 9) to change time between alerts
    • Change sleepInterval (line 11) to modify monitoring frequency

File Structure

BatteryApp/
├── main.cpp           # Source code
├── BatteryApp.exe     # Compiled executable
├── alert.wav          # Audio file for alerts
└── README.md          # This file

Notes

  • Ensure alert.wav is in the same directory as the executable
  • The application will continue running until manually terminated
  • Battery percentage threshold is currently set to 11% (not 98% as originally stated)
  • Works only on Windows systems with battery support

About

This is a lightweight Windows system service written in C++ that implements battery health monitoring through continuous polling of the Windows Power Management API (`GetSystemPowerStatus()`). The application utilizes a non-blocking event loop with configurable thresholds.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages