25
\$\begingroup\$

Laptop DC-DC regulator boards are somehow able to communicate with Windows to see how much battery power is left, but my research finds nothing.

Is there a data connection from the proprietary motherboards found in laptops which communicates this? If so, what kind of data connection is it and where does it actually connect? Is it just a PCI-E port with a ribbon cable?

\$\endgroup\$
  • 12
    \$\begingroup\$ It's not specific to Windows or even laptops, all tablets and smartphones, as well as digital cameras and all manner of battery-capable devices use the same concepts with slightly different implementations \$\endgroup\$ – cat Aug 3 '17 at 17:44
  • 1
    \$\begingroup\$ @cat I figured as much, but I asked for the closest implementation to my end goal. \$\endgroup\$ – Rob Aug 4 '17 at 13:09
49
\$\begingroup\$

The laptop contains a battery management chip with SMBus, such as a BQ24721C.
This chip sits at the interconnect with the battery, charger and the system voltage regulator.
It handles detection of the charger and then manages the charging rate via an incorporated DC-DC controller. It also controls various transistors to disable or enable power from or to the battery, or from AC to the system.
These chips have various means to communicate with the rest of the system.
It has IRQs (interrupt requests), analog outputs, a power good signal and SMbus.

If the battery is replaceable, it will also contain some intelligence to measure battery status, and protect it. This uses SMbus or something proprietary. An example is a Coulomb Counter that measures the charge going in and out of the battery (eg: LTC2943)

SMbus is built on I2C; it's the "System Management Bus". All important stuff connects to this. For example it's also available on the PCI connectors.
It's loaded with small devices like fan controllers, temperature and ambient light sensors or simple switches and LEDs, like wi-fi on-off or lid closed.

Then it is up to the operating system drivers to know the layout of this bus, and how the devices work. Some of it is somewhat standardized in ACPI.

\$\endgroup\$
  • \$\begingroup\$ Would it be fair to assume that only specially designed laptop boards would be capable of this, not off the shelf desktop motherboards? You did mantion that PCI connectors have this available - could a PCI card handle the SMbus functionality? \$\endgroup\$ – Rob Aug 7 '17 at 14:06
  • \$\begingroup\$ @Rob Desktop motherboards do not offer battery charge controllers, why would they? A UPS for desktops uses a USB HID Power Devices Classification for standardized ACPI enumeration to the operating system as a battery. \$\endgroup\$ – Jeroen3 Aug 7 '17 at 14:37
  • \$\begingroup\$ I didn't expect they would, but thought I might ask if anything on a commercial board could do the same. For future posterity, I looked up the specifications for USB HID Power Devices in case anyone needs them. \$\endgroup\$ – Rob Aug 7 '17 at 19:40
37
\$\begingroup\$

Check out the APM (Advanced Power Management) API and its successor ACPI (Advanced Configuration and Power Interface). Before APM these functions were handled by the BIOS.

For Windows 8 and later, Microsoft has these recommendations.

Hardware-wise it may be as simple as an I2C (two-wire) interface to a subsystem.

\$\endgroup\$
  • 19
    \$\begingroup\$ Including four links instead of one doesn't make this not a link-only answer. Consider adding the relevant content from the links in block quotes or summarizing it. \$\endgroup\$ – Todd Wilcox Aug 4 '17 at 3:09
16
\$\begingroup\$

Aside from things like simple voltage sensors, it's absolutely not uncommon that you get integrating power meters that monitor the net power flowing out of a battery.

The question how these sensors talk to the OS is a different one, and will differ from model to model.

However, usually, the firmware in your laptop will talk to your sensors, process these values, and present them over a proprietary or standard interface (e.g. ACPI) to your OS.

PCIe is almost certainly not involved as main link – that's way too expensive to get a few bits every minute across. Electrically, expect I²C, variants like SMBUS, plain SPI, 3.3V UARTs, possibly USB, and all other kind of things with which you could connect a platform controller (which really is just a MCU) with sensors.

\$\endgroup\$
3
\$\begingroup\$

In addition to the sensor type connections stated in other comments and answers standard computer chipsets include two signals that come from the mother board and report up through the chipset to the BIOS and/or operating system drivers. The two signals are called:

AC_PRES - This indicates the AC present. In the case of a laptop this will be active when the external brick power supply is plugged in. For a desktop this will be active when the main AC powered supply is active.

BATT_LOW - This indicates a battery low condition. Applicable to a laptop or tablet configuration only; this will indicate when the battery has discharged to a level beyond which there is only a short operational time remaining. (Note that this is not at all concerned with the real time clock battery).

It is common that the registers that are in the chipset that contain the status of these signals have been established as a legacy assignment and tend to stay the same across many generations of computer hardware.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.