Friday, 13 July 2018

thevenin - measuring -3V with 3 resistors voltage divider


I know (or may be think) that I can scale the measurement of a 0 to -3.1V external battery to a analog pin ADC range of 0 to 3.3V, but I'm unable to calculate the resistors. I've been trying how to do this by thevenin, but with no luck...


The schema (I think) would be the following:


schematic


simulate this circuit – Schematic created using CircuitLab


I just want to know the resistor values to measure V1 (V2 have no effect here) but I'm unable of calculating resistor values... Any help?



Answer




As Elliot correctly said, you can't do this passively and expect the whole 0 to 3.3V range on the output.


However, if you can survive with a reduced voltage range (and thus lower resolution, if you can't affect VREF), you can use a simple two-resistor divider out of the R1 and R2 as pictured in the question. Omit R3.


Another annoying thing of this method is that it'll be referenced to the 3.3V rail, not ground. Anyway, to get to the values:




Mark \$R_1\$ as a resistor between \$V_{cc}\$ and \$V_{out}\$, and \$R_2\$ as the one between \$V_{out}\$ and \$V_{in}\$.


Let \$I\$ be the current passing through the resistor divider: \$I = \frac{V_{cc}-V_{in}}{R_1 + R_2}\$.


These should be quite obvious now:


\$V_{R_2} = I\cdot R_2\$


\$V_{R_1} + V_{R_2} = V_{cc} - V_{in}\$


\$V_{out} = V_{in} + V_{R_2} = V_{in} + R_2 \cdot \frac{V_{cc}-V_{in}}{R_1 + R_2} = V_{in} + \frac{R_2}{R_1+R_2}\cdot (V_{cc} - V_{in})\$





Anyway, plugging your numbers in for a bit, you first look at the case when \$V_{out}\$ is \$0 \mathrm V\$ and \$V_{in}\$ is the most negative, that is \$-3.1 \mathrm V\$.


From \$V_{out} = V_{in} + \frac{R_2}{R_1+R_2}\cdot (V_{cc} - V_{in})\$ you get:


\$ 0 \mathrm V = -3.1 \mathrm V + \frac{R_2}{R_1+R_2} \cdot (+6.4 \mathrm V)\$, that is


\$ \frac{3.1}{6.4} = \frac{R_2}{R_1+R_2}\$, which is your resistor ratio for your divider.


You can now take R1 = 3.3k, and make R2 = 3.1k, for a quick experiment or simulation.




To find out what your maximum output voltage would be, just plug in more numbers, now knowing what the resistor ratio is, and plug in \$V_{in} = 0\$.


Plugging in the numbers into \$V_{out} = V_{in} + \frac{R_2}{R_1+R_2}\cdot (V_{cc} - V_{in})\$ again you get:


\$V_{out} = 0 \mathrm V + \frac{3.1}{6.4} \cdot (+3.3 \mathrm V)\$, which turns out to be about \$ 1.6 \mathrm V\$, as my quick simulation also confirms.





Practical considerations:




  • You'd also want to protect the microcontroller/ADC against too much negative voltage coming to its input in case the 3.3V rail is off – attaching a diode clamp going between the ground and the input should be sufficient for short periods.




  • Do add in some margin considering the highest voltage the battery can get to. 3.1V sounds odd, could be fine for a lithium primary? Point is, you don't want the ADC input pin going negative, which it would with higher-than-designed-for voltage here. Do your research on the maximum voltage the battery can get, no load, absolutely fresh/fully charged, and then add 5-10% in for a good measure.







I encourage anyone with more math/TeX skillage to edit my answer, it is fairly naive in places and it likely could be shown much clearer.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...