Help on STC3100 calculations

voltage

I would rephrase my question:

What I'm trying to do is to measure the battery voltage. Based on STC3100 datasheet, the battery voltage value is located on address 0x08 and 0x09 where the value 0x00E6 was read from.

The actual value of the voltage based on the datasheet is voltage(mV)=Voltage_code * 2.44

With this equation, i presumed that voltage(mV) = 230 * 2.44 which results to 561.2mV which is very low compared to the actual reading from the multi-tester.

So my question is how should I calculate the value that was read from the STC3100 (location 0x08 and 0x09) ic so that I can get the voltage?

Here's the schematic diagram of what I'm doing:

enter image description here

I hope I made my question a little bit clearer now. 🙂


I have a question regarding the voltage calculation.

How should I calculate the voltage that was pulled from the STC3100? I pulled the following value:

REG_VOLTAGE_LOW = 0XE6

REG_VOLTAGE_HIGH = 0X00

When I tried to calculate it using the formula: voltage(mV) = Voltage_code * 2.44, I get a result of 561.2 which is very low compared to the actual reading from the multi-tester.

I know I missed something with the calculation and I hope you can guide me to the right direction.

Thanks!

Best Answer

SOLVED (probably :-) ).

Adding at top and not (yet) gross editing as this appears to be the answer to the reported problem. Will (probably) edit heavily in due course if this works.

  • Summary: Vin MUST be <= Vcc or "there will be trouble.

You advise that your circuit is -

enter image description here

Based on the datasheet specifications, this circuit violates allowable operating conditions for Vbattery = Vin > 3.3V. As a Lithium Ion battery will be > 3.3 V for a substantial portion of it's operating range you can expect this to "cause problems" and it may damage the IC. There is almost certainly be a usually reverse biased intrinsic body diode from Vin to Vcc internally and this will begin to get substantially forward biased at about Vin = 3.7V with Vcc = 3.3V as shown here. You report measuring Vin = 3.76V using a meter which sounds suspiciously close to the 3.7V figure. It's possible that your battery is being clamped to the 3.3V supply - although any LiIon battery worth its salt might be expected to incinerate the body diode for the fun of it. You (or the IC) may have had a lucky escape. Or not.

The issue is that Vin is the input to an on chip ADC whose input is required to lie within the range 0 to Vcc. The assumption is that Vin will usually be at the same voltage as Vcc - the two pins are split ostensibly mainly to allow noise filtering on the ADC input.

Running Vcc at < Vcc seems liable to be legal. (There is always some slight doubt in cases like this that the makers have so focused on vc = Vin thta they have cut some unseen corner, but the datasheet clearly says it's OK)>

As Vbattery can be as high as ~ 4.2V if using a standard LiIon cell you could scale the battery voltage down by no less than 3.3/4.2 = 0.7857. The ADC input impedance is said in Application note AN3064 bottom of page 3/15 to be about 500 k ohm. If you don't want the divider to create appreciable error then it needs to be low value so the portion to ground needs to be low value (about 4X larger)(3.657...) and the divider drains battery current.

For say 1 bit error in 8 bits (and I know you have > 8 bits) with 500k input to ADC then R divider ~~~= 500k/2^8 = 1.95K. This is the parallel value of the two divider R's which are in a ~ 4:1 ratio so using say 2k2 and 8.045 k would give the correct division ratio to make 4.32V = full scale and about 4.2/(2.2+8.045) =~ 0.4 mA of divider current. That's not vast but an annoying waste.

You can have Vin max at less than Vcc. eg with a say

  • Vbattery - 10k - Vin - 2k2 - Ground

divider you get about 5.55:1 division or about 13.5 mV/bit and about 350 uA divider drain.

At 20 mA / bit and 8.2:1 divide (15.8k:2k2) you get about 240 UA divider current.

You could easily switch Vin to the divider as required to minimise effect of divider current drain.

There are various ways of overcoming the divider drain and accuracy problems but I'll stop at this point.

End of August 3rd addition - will edit this out in due course.


I'm adding this "answer" here as it was given to what was deemed a duplicate version slightly before the "duplicate" was closed and there is some useful material here which is otherwise effectively lost. If anyone has a problem with this duplication of answers then the version attached to the closed "duplicate" could be deleted or edited. I'd like to see how this got resolved as there is obviously 'summat aglae' that needs fixing.


This is not so much an answer as advice on asking the question. It belongs here rather than in the question. I may modify it and delete parts as/if you answer usefully.

How does your circuit diagram differ from the diagram below?

  • Do you have a sense resistor connected?

  • If so, what value. If not, is CG grounded (as it should be).?

  • Is Vin connected to the battery (as it should be) with a resistor as shown or directly (specify).

  • Is Vcc connected. Presumably yes :-).

Lack of Vin connection will make your readings rubbish.

Lack of CG connection to ground either via a sense resistor or directly may make your readings rubbish.

enter image description here

The above diagram is from this STC3100 datasheet


Giving people all available data and data in its purest form will most help them to answer well.

This time and last time you used numbers of the form oxnnnn. The results are in two registers of 8 bits each. It is advisable to do as little "processing" of data when asking a question. Better to say Address 08 = yy and 09 = zz etc. Also giving several results and the external voltmeter reading MAY allow someone to spot what is happening.

Also, showing us your ACTUAL circuit diagram or pointing to a circuit diagram that is EXACTLY what you are using would be very helpful.

I have some idea what you are doing from the prior question BUT at present to the uninitiated your question reads something like "I am reading data from the correct locations, combining unstated values in an unstated manner and using an unstated circuit. What's wrong?".

Helping others to see everything as you see it will greatly help people answer well.

Related Topic