Tesla Model 3 Battery Hacking

Topics concerning the Tesla front and rear drive unit drop-in board
retrEVnoc
Posts: 54
Joined: Sun Aug 11, 2019 8:22 pm
Location: CA & OR, USA
Has thanked: 3 times
Been thanked: 2 times

Re: Tesla Model 3 Battery Hacking

Post by retrEVnoc »

How is state of charge calculated in this firmware? I am noticing large swings in soc with small changes in pack voltage. Seems to be maybe dependent on deltaV (higher deltaV ==> lower soc) but not sure.

I got the following info from someone with a Model3, for reference: 78% @ 390V; 62% @ 373V; 37% @ 361V. Whereas in my pack I have seen 30-50% soc reported for voltages around 348-351V. So very different from what the tesla reports.

Since I am getting spot values from all 96 cells, would that suggest that not having all cells balancing simultaneously is a software issue rather than a hardware issue?

I also don't really understand how the BalVthres parameter works, so wondering if maybe it is to be expected that all 96 cells aren't balancing simultaneously. But I have noticed sometimes I only have 84 cells balancing, or 73 cells balancing for example, which would suggest one or both halves of a 23s module are not balancing.

The balancing is very slow, like a reduction in deltaV of 2-5 mV per day, but even a little bit of test driving or charging can increase deltaV by dozens of mV. So I need to be able to create and maintain cell balance in order for the vehicle to be roadworthy. Is "balanced" considered deltaV <20mV?
User avatar
tom91
Posts: 2962
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bicester, Oxfordshire
Has thanked: 328 times
Been thanked: 847 times

Re: Tesla Model 3 Battery Hacking

Post by tom91 »

retrEVnoc wrote: Tue Feb 24, 2026 10:03 pm The balancing is very slow, like a reduction in deltaV of 2-5 mV per day,
Yes the balancing current is like 40mA so very very slow.
retrEVnoc wrote: Tue Feb 24, 2026 10:03 pm How is state of charge calculated in this firmware?
It is not
retrEVnoc wrote: Tue Feb 24, 2026 10:03 pm Is "balanced" considered deltaV <20mV?
Depends on where in the voltage curve you are.
Creator of SimpBMS
Founder Volt Influx https://www.voltinflux.com/
Webstore: https://citini.com/
retrEVnoc
Posts: 54
Joined: Sun Aug 11, 2019 8:22 pm
Location: CA & OR, USA
Has thanked: 3 times
Been thanked: 2 times

Re: Tesla Model 3 Battery Hacking

Post by retrEVnoc »

tom91 wrote: Wed Feb 25, 2026 11:40 am Yes the balancing current is like 40mA so very very slow.



It is not



Depends on where in the voltage curve you are.
Thanks for the reply and info Tom! So does that mean soc is calculated by the BMB's and then reported to the BMS unit? How should the BalVthresh parameter be set or managed to ensure balancing at different States of Charge? My deltaV seems to be climbing rather than decreasing despite balance being toggled on.

When my modules were more balanced, I was around 350-351V and approx 50% soc, which is very different than what a stock tesla M3 reported. Any idea why the soc would seem so different relative to voltage between a stock Tesla Model 3 and the info I am seeing on my end (see attachments and see reference #s in previous post)?

I have watched soc and deltaV while charging and it seems like soc is somehow related to deltaV; as deltaV decreases, the reported soc will rapidly increase despite very small increase in udc.
Attachments
BMS 2-24-26.pdf
(807.86 KiB) Downloaded 7 times
BMS 2-25-26.pdf
(810.3 KiB) Downloaded 4 times
User avatar
tom91
Posts: 2962
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bicester, Oxfordshire
Has thanked: 328 times
Been thanked: 847 times

Re: Tesla Model 3 Battery Hacking

Post by tom91 »

IMO balancing should happen at top end of charge, so I usually only balance above 3.90V

SOC is not calculated by BMBs.

I believe currently its just a crude cell voltage to SOC straight line calculation between two points.
Creator of SimpBMS
Founder Volt Influx https://www.voltinflux.com/
Webstore: https://citini.com/
retrEVnoc
Posts: 54
Joined: Sun Aug 11, 2019 8:22 pm
Location: CA & OR, USA
Has thanked: 3 times
Been thanked: 2 times

Re: Tesla Model 3 Battery Hacking

Post by retrEVnoc »

Thanks for the Info Tom. Can you clarify about the SOC calculation? It seems like in your last 2 posts here you said the BMBs do not calculate SOC and also the firmware does not calculate SOC. I am guessing the SOC would be calculated like (udc-dischargeVlim)/ (chargeVlim- dischargeVlim), correct?

I have the following data points from a stock Model3 long range: 35% @ 358V, 37%@ 361VV, 62%@373V, 78%@390V.

I am trying to understand the discrepancy between these numbers and what i'm seeing with my 4 modules and the BMS controller which has been around ~50% at ~350V. Even when I was connecting the BMS controller to each module individually, each module was showing around 50% soc.

I have a separate but likely related problem. Apparently when I'm charging, I'm only charging cells u1-u12 out of all 96 cells. The attached readout shows that cells u1-u12 are much higher voltage than the rest; I was monitoring this while charging and the rest of the cell voltages didn't really increase at all while cells u1-u12 went from lower than the rest, to higher than the rest.

I'm guessing this is one half of one of the 23s modules. Is there any way to know which modules contain which cells u1-u96 on the UI? I haven't seen cellsbalancing spot value up at 96, it usually either says 84 or 73, which would correspond to one or both halves of a 23s module missing somehow.

Not sure how to begin troubleshooting this, whether it is more likely a HW or SW issue. Anyone have suggestions? Thanks!
Attachments
BMS 3.22.26.pdf
(807.39 KiB) Downloaded 10 times
retrEVnoc
Posts: 54
Joined: Sun Aug 11, 2019 8:22 pm
Location: CA & OR, USA
Has thanked: 3 times
Been thanked: 2 times

Re: Tesla Model 3 Battery Hacking

Post by retrEVnoc »

I made a quick chart of voltages u1-u96 to better visualize what's happening:
Attachments
chart.pdf
(31.52 KiB) Downloaded 11 times
retrEVnoc
Posts: 54
Joined: Sun Aug 11, 2019 8:22 pm
Location: CA & OR, USA
Has thanked: 3 times
Been thanked: 2 times

Re: Tesla Model 3 Battery Hacking

Post by retrEVnoc »

I noticed the software version on mine is a .07TA on this but the latest release I saw on the Github is 0.03. Is the newer version also posted somewhere?

Is there any other beta testing I can do, or troubleshooting to try and see if my balancing issue is a HW or SW issue? Thanks
User avatar
tom91
Posts: 2962
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bicester, Oxfordshire
Has thanked: 328 times
Been thanked: 847 times

Re: Tesla Model 3 Battery Hacking

Post by tom91 »

retrEVnoc wrote: Mon Mar 23, 2026 5:06 pm The attached readout shows that cells u1-u12 are much higher voltage than the rest;
Measure the corresponding module to check if the voltages are as they should be.

I would be surprised if the gap is really that big in voltages if the modules came from the same pack and you have not done anything to them.

Really need someone who can Code and is using M3 modules pick this up and work through it, there is only so much I can do on the bench.

Balancing is the number of cells being balanced, with the voltage readings it should not be anywhere near that number. So there can be an error in the code.

SOC is literally from cell voltages.

Code: Select all

void BMSUtil::UpdateSOC()
{
    TempSOC = Param::GetInt(Param::soc);

    if(ABS(Param::GetFloat(Param::idc)) < NoCurLim)
    {
        NoCurCounter++;
    }
    else
    {
        NoCurCounter=0;
    }

    if(NoCurCounter > NoCurRun)
    {
        TempSOC=EstimateSocFromVoltage();
    }
    else
    {
        TempSOC = TempSOC + (100 * asDiff / (3600 * Param::GetInt(Param::nomcap)));
    }

    Param::SetInt(Param::soc,TempSOC);
}

int BMSUtil::EstimateSocFromVoltage()
{
    float lowestVoltage = Param::GetFloat(Param::umin);
    int n = sizeof(voltageToSoc) / sizeof(voltageToSoc[0]);

    for (int i = 0; i < n; i++)
    {
        if (lowestVoltage < voltageToSoc[i])
        {
            if (i == 0) return 0;

            float soc = i * 10;
            float lutDiff = voltageToSoc[i] - voltageToSoc[i - 1];
            float valDiff = voltageToSoc[i] - lowestVoltage;
            //interpolate
            soc -= (valDiff / lutDiff) * 10;
            return soc;
        }
    }
    return 100;
}
As for balancing, you are trying to pull all cells down to your Umin of 3616 + 20mV (fixed hysteresis for now)
Which from your print screen seems like you are almost achieving accept the one module, no idea why the one module is unhappy and possibly not balancing.
Creator of SimpBMS
Founder Volt Influx https://www.voltinflux.com/
Webstore: https://citini.com/
retrEVnoc
Posts: 54
Joined: Sun Aug 11, 2019 8:22 pm
Location: CA & OR, USA
Has thanked: 3 times
Been thanked: 2 times

Re: Tesla Model 3 Battery Hacking

Post by retrEVnoc »

Thanks Tom. I do have a coder guy who has been helping me, but we only recently realized that things might nOt actually be as they seem with the BMS, so he hasnt really looked in to it yet. Is the code on the GitHub the most up to date for him to investigate? It looks like latest release .03 but somehow mine is 0.07, which i guess is one you had emailed me last yr.

How would I ID the corresponding module? Do the u1-u96 voltages populate in same order as module #s 1-4 ==> 23-25-25-23? Given that it is 12cells acting differently, seems like that could be a half of one of the 25s or 23s.

I am still confused that my battery voltage would suggest soc is quite a bit lower than 50% (based on #s from a stock Trsla) despite what the bms says.

Thank you for the insights and advice! We will try to work through your code and look for bugs if we can locate the latest release of it.
User avatar
tom91
Posts: 2962
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bicester, Oxfordshire
Has thanked: 328 times
Been thanked: 847 times

Re: Tesla Model 3 Battery Hacking

Post by tom91 »

retrEVnoc wrote: Mon Mar 30, 2026 6:42 am I am still confused that my battery voltage would suggest soc is quite a bit lower than 50% (based on #s from a stock Trsla) despite what the bms says.
It is HARD CODED based on nothing specific just a linear look line I made up...
Creator of SimpBMS
Founder Volt Influx https://www.voltinflux.com/
Webstore: https://citini.com/
User avatar
tom91
Posts: 2962
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bicester, Oxfordshire
Has thanked: 328 times
Been thanked: 847 times

Re: Tesla Model 3 Battery Hacking

Post by tom91 »

retrEVnoc wrote: Mon Mar 30, 2026 6:42 am Thank you for the insights and advice! We will try to work through your code and look for bugs if we can locate the latest release of it.
Not released, not got any means to test it fully. It is on github, even a later version as it also cover the MAX BMS functions.
image.png
image.png (6.51 KiB) Viewed 123 times
https://github.com/damienmaguire/Tesla- ... /tree/main
Creator of SimpBMS
Founder Volt Influx https://www.voltinflux.com/
Webstore: https://citini.com/
Post Reply