I have a need to measure the voltage of a Lithium battery cell from a CPU running from the cell itself.
A few parameters for the design - cell voltage 2.8v to 4.35v range, need reading scale of 0.01V (or better). I’d like to keep parts cost low and cheap as I need to build several of these units.
What I’ve got so far may be to over complicating things!
I’m using an ATTINY85/V processor chip along with a fixed 2.5V voltage source (MCP1525) and a LM358AN op-amp.
I’m driving all the above from the cell voltage as VCC.
The cell voltage is fed into the Op-amp in a unity-gain circuit (10k resistors all around) into the non-inverting (pin 3) of the LM358 and the MCP1525 voltage regulator into PIN 2 (inverting) - this then subtracts 2.5V from the VCC voltage - theoretically giving me a range of 0.3V to 1.85V. I then feed this into the ATTINY 10 bit ADC pin to take readings using the internal 2.56V reference source.
Each 1 bit of the ADC is now 0.0025V - although I could boost the output using some gain on the opamp to get a larger scale filling the 2.56V range. This may also fix another problem I’ve got in that I’m hitting the lower limits of the LM358 which won’t go below 0.6V output - so may need another opamp !!
Somethings I’ve ruled out so far:
Using the ADC differential input - I need the other ATTINY pins to do other work!
Resistor divider - this doesn’t give me the stability or scale
The circuit mentioned works (but the readings won’t go below 3.1V given the limits of the existing OPAMP)
Can I do it simpler and still give me a decent reading scale ?
A circuit diagram and some clarification is needed!
Does your Tiny use VCC or an internal band-gap device as its ADC reference? If it’s using the supply, then the ADC scale depends on that.
According to the data sheet, the common-mode input range of the LM358 is only to VCC - 1.5 V, so that ought to be a problem. (Fig.10 on the data sheet.)
The way I’d look at it is to use another band-gap device to do the subtraction, rather than the op-amp. That is, hang the reference diode down from VCC and measure the voltage at the bottom with the ADC input. You’d have the stability that would be in the same order as the reference that the Tiny’s internal reference has, and maybe even better knowledge of its initial value, if the ATMega is anything to go by. And the scaling would be 1 V/V.
For the simplest solution, I’d be looking at a negative voltage regulator - which will give you a fixed voltage below VCC. Adjustable ones go down to about 1.25 V, so if you set it to 2.0 V, your cell voltage would appear at the ADC input as 0.8 - 2.35 V, which is inside your ADC range.
[If you can’t get your head around it, its input will be your GND, its common your VCC, and its output will be referenced to your VCC.]
You could do it with a zener diode, 3 silicon diodes in series (maybe 4, 3 is a bit low), or even a transistor in “amplified Vbe” configuration, if you feed them with a constant current and your temperature range is limited.
@Robert.Wall I’ve been researching the range of negative regulators, the LT1964 appears to fit the usage I have, however the cost is higher than the opamp and CPU combination I’m already using!!
Did you have a particular component model in mind?
Well I’ve scuppered my plans, the negative regulator worked as @Robert.Wall suggested (never had a doubt!) however I forgot that the ATTINY85/V needs a min of 3.00V for the internal 2.56V regulator to work.
So I don’t think my experiments are going to work this way around, I’m probably better off running a fixed voltage LDO (perhaps 2.5V) to power the ATTINY and then using a resister divider on the input voltage and use the internal 1.1V reference.