Estimating SOC using coulomb counting with DSP
As mentioned in the comments, trying to estimate the SOC with only a current-based method is not going to be precise since there are other variables you're not accounting for.
Coulomb counting relies on integration  and that is its main drawback -- any measurement offset, error, or otherwise uncertainty grows without bounds over time until you reset the estimate.
Your basic equation is correct but imagine what happens if the current measurement device has an offset (e.g \$I_{\text{OFFSET}}\$):
Your equation now becomes:
$$ \text{SOC[n]} = \text{SOC[n-1]}-\dfrac{I_{\text{BAT}}+I_{\text{OFFSET}}}{Q}\Delta T $$
$$ \text{SOC[n]} = \text{SOC[n-1]}-\dfrac{I_{\text{BAT}}}{Q}\Delta T +\epsilon $$
Where
$$\epsilon= -\dfrac{I_{\text{OFFSET}}}{Q}\Delta T$$
You can see how this error term propagates through each SOC estimate and in fact, for \$n\$ measurements, the cumulative error is
$$\text{Error[n] = }n\cdot \epsilon$$
The source of the error could be one thing or a combination of many other effects such as model error, measurement error, uncertainty, etc. I don't know the specifics of your model but for this method to work better, you need to somehow take them into account and &quot;reset&quot; the integral error that will continue to grow to such a point that the true and the estimate diverge significantly.