Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Which circuitry in laptop is responsible for showing the battery status/charging etc in a laptop? My intension is to hack such a circuit inch a desktop to show the status of a standalone UPS.

I am not sure if such a hack is possible, but there is no harm is trying :)


share|improve this question
up vote 3 down vote accepted

It varies from battery to battery how this works, but here is a brief overview.

As a battery dies its voltage decreases. Your laptop (or other battery powered device) has a safe range of voltages it will operate at. Too high and it gets fried, too low and the capacitors cannot maintain a charge so it looses power (which can actually be more damaging then too high of a voltage).

So the way a laptop determines how much juice is left is by checking the voltage that the battery is putting out. Of course it is significantly more complicated then that.

A "battery" is actually a collection of cells. For example a 1.5v AAA is a single cell, but a 9v is actually a battery containing Six 1.5v AAAA (slightly smaller then a AAA). 6 x 1.5 = 9V. So a laptop battery is a collection of multiple cells. Most laptop batteries have circuitry internally to monitor and regulate each individual cell. The long charge life and number of recharges from a modern battery comes from both the chemical material (metals and acids usually) in the individual cells and the circuitry that regulates it all. Some laptop batteries even have built in charge meters.

If you look at a laptop battery you will see it has multiple metal connectors on it. Typically one is positive, one is negative, one is neutral, and then the remaining ones are used to communicate charge information to the computer. Thanks to all of this circuitry it actually maintains a fairly even voltage throughout the lifetime of the battery. When it finally is not able to maintain voltage it signals the laptop to shut off.

Now your battery can only say how much juice it has left. The computer on the other hand can take that information and look at how long it has been operating on that battery and possibly what the current power consumption profile is to extrapolate the how much time is left in the battery. This of course can change if you start burning a DVD or adjust your LCD brightness.

So what about hacking this to do it with a UPS? Well, most UPS's actually have a pretty simple battery similar to what you would find in a car, but much smaller (depending on the UPS). The UPS itself has the circuitry to transform that voltage (usually 12v) to what you computer is taking (usually 110v) and then kill the power when it is no longer able to maintain appropriate voltage.

Most higher quality UPSs have a serial or USB connector that you can run into your computer. Since about Windows 98 the OS has had a built in indicator to handle the information provided by the UPS.

As far as hacking this, assuming your UPS does not have any reporting connector then you could rig up your own volt meter that samples the battery at regular intervals (each sample will use up some juice, so don't sample too often!) You would need to run your computer off the UPS and monitor the battery's voltage to see what is its safe range. Once you have that, then you can feed that information to your computer. Serial is a pretty simple protocol, or you might be able to use X10 or some other instrumentation monitoring hardware. Your software could then use the base line you established earlier to see how long until your battery drops below the safe voltage and the UPS cuts power.

Sounds like a fun project. Here is an outline on what you need:

  1. Periodic sampling voltmeter
  2. Ability to report readings to computer (serial or USB most likely)
  3. Software to monitor reported information.
  4. Baseline of what your safe voltage is on your battery.
  5. A bonus would be to determine the current power profile and consumption to adjust the estimates.
  6. Some way to display the estimated time remaining to the user.

Good luck! Let us know how it goes. For practicality you might find it better to upgrade to a UPS that has a status port. But that wouldn't be near as much fun now would it!

share|improve this answer
Thank for the detailed answer. Laptop batteries already seems to do all these and have a consistent interface to OS/BIOS. If my UPS can report that info via ACPI it would be great! I am also looking for how laptop batteries report it's status. – Rajkumar S Jul 25 '09 at 6:43

I actually have written a program BatteryBar that keeps battery stats for Windows.

Every laptop battery has a 'smart chip' that's responsible for providing data to the laptop. The BIOS is responsible for providing the data to the OS. So, as mentioned in the other answer, you'd definitely need to come up with your own interface as there's really no way that you could implement it through ACPI by yourself.

share|improve this answer
Any further information about the "smart chip", google query strings would be fine :) – Rajkumar S Jul 25 '09 at 6:37

it's built into windows if your UPS has a USB connection windows should show you the status of the UPS battery without installing any additional software

share|improve this answer
I think the OP's intent is to do this with a physical circuit, probably for fun. – jtbandes Jul 25 '09 at 5:51
How does this work? I am asking from the point of view of say writing a driver for this functionality under linux? (okay, I may not be writing a drive, but that's the info I am looking for) – Rajkumar S Sep 14 '09 at 13:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .