Idea: Battery charge level indicator card

My XPS 13 has a little battery charge level indicator on the side. You press a little button and 1 to 5 LEDs light up to indicate the battery level - e.g. the below shows that the pictured laptop has about 40% charge:

(Image sourced from Dell XPS 13 9370 Review: Dell's Lucky Thirteen! - TechPP, 2018)

This is a really neat feature - you don’t need to open the laptop lid to check the battery level and it even works when the XPS is off.

I figure it might be possible to make an expansion card that does this. Unfortunately I know absolutely nothing about hardware in this context.

I imagine this can probably be done over USB, but I’m guessing that in order for something like this to work with the Framework powered off etc it would need to talk to the BIOS? I’m assuming that’s not possible.

I also figure it might be possible to have the expansion card have a pass-through charging USB-C port alongside the battery indicator, so the card could be used as a sort of dedicated charging port. But I’ve seen the insides of some custom expansion cards and I can see that there’s not much space.

Anyone with more knowledge than me on this, might you be able to advise on whether this is remotely possible? How would you go about starting to implement this?

3 Likes

I don’t think it’s possible for it to work the way most people would want.

This would be the problem. If you suspend your laptop, USB should be turned off and the expansion card would have no way of getting updated battery status.

Best you could probably do is have the card remember the level from the last time the computer was on. It could display it with a button press while the laptop is off by having a tiny battery. You could probably estimate how long the laptop battery should last while suspended and have the card display a level based on that. That could be good enough.

Now the Embedded Controller in the Framework has been open sourced iirc. Someone with enough knowledge of it could maybe mod the firmware so that, while the laptop is suspended the EC periodically powers up USB just long enough to update the card with new battery status. I don’t know if this would even be worth it, over just using an estimated battery level.

3 Likes

Also I’m unsure if USB will share the battery level.

I was just thinking of having a helper app supply information to the card.

The whole OS would need to power on to send an update to the card over normal USB, which is not ideal (who’s to say that Windows/Linux will actually reliably power down again?).

However, the EC is also able to output debug information via UART over the SBU channel on at least one of the USB ports. That could be parsed by a microcontroller on the expansion card to update the battery indicator status. That data even already includes battery level changes (though I’m not sure if they’ll be output when the system is off).

You can read more about the EC debug capabilities here: "EC Card 2", a closed-case debugging (CCD) Expansion Card for the Framework Laptop :: HowettNET

2 Likes

I checked with @DHowett and no, the EC does not send battery info over the debug connector (USB-C) “when it’s powered, it doesn’t know anything about USB unfortunately. The only comms interface with the outside world (apart from the lid switch, power buttons) is the CCD UART, and that has a bunch of log information going over it”

1 Like

According to the blog post I linked, “VBUS is not provided by the laptop before poweron”. If there’s no way around this, it isn’t going to be possible to make an expansion card that works while the laptop is off at all.

Probably the easiest way to achive it like dell, is to get something like this and directly connecting it to the battery.
If you really want it as a expansion card you could modify the chassis and add two pins to the back of the expansion card and chassis.
Kinda funky way though

This is a great idea.

If powering the indicator card is a problem, shouldn’t a small e-ink screen which remembers the last charge-level work?

Also, would it be possible to make this a dual function card, e.g. make it like a lid for a usb-port or put a receiver for a wireless mouse in there?

1 Like

Love this idea!

I really like the e-ink idea and did search around. Unfortunately I wasn’t same to find any screen small enough that it would fit. A 1" screen might just work, but only if it’s very wide.

1 Like

nice idea but should be implemented in the mainboard like add some more led to the power button , in middle green for power ON and around it in circle various colors for different battery levels more like clock
something like this

or

If I’m not mistaken, the limitation here is related to why we can’t have the laptop auto-power-on upon lid open, as a BIOS option (think this was also discussed in another thread awhile back). There’s no sufficient number of rails, and lack of certain data points.

1 Like

@Thijs_Marinussen
also just checked quickly. Didn’t find anythign either. With the small modules (even 0.5 inch), the panel size being a couple mm bigger than the screen size is a problem.

Maybe we could have a little screen sliding out of the card, (like an old sliding phone)?

What’s wrong wit a good old led bar graph?

Anyway, getting the battery status as an expansion card is probably the tricky bit here.

2 Likes

another thought,
for the matter of powering a LED while the laptop is off,
maybe a tiny battery could fit inside the expansion card?