Detect new battery

Third party OS images and hardware mods
Post Reply
shon242
Posts: 3
Joined: Thu Jul 14, 2022 2:54 pm
languages_spoken: english
ODROIDs: odroid go super
Has thanked: 2 times
Been thanked: 0
Contact:

Detect new battery

Post by shon242 »

Hi all,

I'm modding the Odroid go super so that it can hold a 10000 mah battery. What I think is happening is when I connect the battery to the odroid, it does not recognize the new battery size. It still says capacity = 4000000. It also drains pretty normal until it's gets to 6% and stays there for a few hours.

Is there anyway I can get the odroid to see the new battery size?

I'm using Batocera.

User avatar
odroid
Site Admin
Posts: 39381
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 2617 times
Been thanked: 1430 times
Contact:

Re: Detect new battery

Post by odroid »

The value of battery capacity is hard coded in the boot loader and Linux kernel drivers.
Therefore, you need to modify the Batocera source code and compile & build it by yourself.
These users thanked the author odroid for the post:
shon242 (Thu Jul 14, 2022 3:32 pm)

shon242
Posts: 3
Joined: Thu Jul 14, 2022 2:54 pm
languages_spoken: english
ODROIDs: odroid go super
Has thanked: 2 times
Been thanked: 0
Contact:

Re: Detect new battery

Post by shon242 »

Well shucks,

I'm not that skilled. Thanks anyway

User avatar
mctom
Posts: 1773
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1
Location: Gdansk, Poland
Has thanked: 200 times
Been thanked: 234 times
Contact:

Re: Detect new battery

Post by mctom »

Just to add, there is absolutely no way any chip would automatically detect a capacity of a 2-wired battery. This is why the value is hard coded.
Some fuel gauges do, but only after a full charge and discharge cycle, and only if the battery chemistry is known.

That is a difference between a battery as an electronic component, and a "battery" as a consumer product, such as a laptop battery, which houses some electronics in it as well.

Also, if you bought a battery with similar physical dimensions and much larger capacity, it's most likely fake, but I'm not familiar with a scope of your mod.
These users thanked the author mctom for the post:
shon242 (Fri Jul 15, 2022 7:40 am)
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

shon242
Posts: 3
Joined: Thu Jul 14, 2022 2:54 pm
languages_spoken: english
ODROIDs: odroid go super
Has thanked: 2 times
Been thanked: 0
Contact:

Re: Detect new battery

Post by shon242 »

mctom wrote:
Thu Jul 14, 2022 6:18 pm
Just to add, there is absolutely no way any chip would automatically detect a capacity of a 2-wired battery. This is why the value is hard coded.
Some fuel gauges do, but only after a full charge and discharge cycle, and only if the battery chemistry is known.

That is a difference between a battery as an electronic component, and a "battery" as a consumer product, such as a laptop battery, which houses some electronics in it as well.

Also, if you bought a battery with similar physical dimensions and much larger capacity, it's most likely fake, but I'm not familiar with a scope of your mod.
That explains a ton, especially the different types of batteries. Thanks

The battery is literally two 5000 mah lipo batteries smushed in parallel in the standard package: Just by taking a quick glance, and running the odroid for over 23 hours.

It is considerably larger than the standard battery. I have to mod the shell so it fits (wont be pretty). But there are times when I am not near solar or 120v or even 12v for days on end.

User avatar
mad_ady
Posts: 10739
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4 (HC1, HC2), C1+, C2, C4 (HC4), N1, N2, H2, Go, Go Advance, M1
Location: Bucharest, Romania
Has thanked: 647 times
Been thanked: 935 times
Contact:

Re: Detect new battery

Post by mad_ady »

I remember there is an entry somewhere in /sys that exposes the battery capacity. Not sure if it gets set from the dtb or not, but it can be overridden by loop-mounting a file with the new capacity over it. That should cause linux userspace to better estimate charge percentage.

User avatar
mctom
Posts: 1773
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1
Location: Gdansk, Poland
Has thanked: 200 times
Been thanked: 234 times
Contact:

Re: Detect new battery

Post by mctom »

mad_ady wrote:
Fri Jul 15, 2022 3:24 pm
I remember there is an entry somewhere in /sys that exposes the battery capacity. Not sure if it gets set from the dtb or not, but it can be overridden by loop-mounting a file with the new capacity over it. That should cause linux userspace to better estimate charge percentage.
I can't tell how this specific hardware works, but usually the "fuel gauge" chips have got to be configured with this information first, so they could report battery status. Writing that value into a /sys file probably won't achieve that..
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

User avatar
mad_ady
Posts: 10739
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4 (HC1, HC2), C1+, C2, C4 (HC4), N1, N2, H2, Go, Go Advance, M1
Location: Bucharest, Romania
Has thanked: 647 times
Been thanked: 935 times
Contact:

Re: Detect new battery

Post by mad_ady »

On my laptop, under linux, the battery capacity gets exposed here:

Code: Select all

 adrianp  ~  $  cat /sys/class/power_supply/CMB1/charge_full_design
5600000
 adrianp  ~  $  cat /sys/class/power_supply/CMB1/charge_full
1054000
 adrianp  ~  $  cat /sys/class/power_supply/CMB1/charge_now
1001000
As you can see, my battery is severely degraded. Probably the readings come from the chip, but one can fake them (for userspace) with:

Code: Select all

 adrianp  ~  $  echo 5600000 > charge_full 
 adrianp  ~  $  sudo mount -o bind charge_full /sys/class/power_supply/CMB1/charge_full
 adrianp  ~  $  cat /sys/class/power_supply/CMB1/charge_full
5600000
It should be enough to trick userspace apps that read the battery level (presuming they read it from that node).

User avatar
mctom
Posts: 1773
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1
Location: Gdansk, Poland
Has thanked: 200 times
Been thanked: 234 times
Contact:

Re: Detect new battery

Post by mctom »

The question is, where the software displaying the battery charge in % gets that data from... If I were to do this hack I'd start from there. Perhaps it reads that data from the chip directly? Who knows.
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

Post Reply

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 1 guest