Im trying to create a circuit so that I can monitor the voltage drop on my battery and send an message when the voltage drop reaches the drop out. But I'm having some problems with my voltage divisions.
I created this circuit to enable a flow so that it does not flow (drain the battery) while not necessary. But as I understand it analog input must not be above 1 volts.
The +3.3V represent the MCU (ESP-12, arduino with wifi) turning the circuit on, letting battery flow to the analog input (red circled ground). However, at analog input, the volt is 2,24V, which is more than the 1V it should be. Do I just divide it again? If I divide it again ill be at 1,12 so I need to divide it yet again. I don't think Im doing it right.
The maximum voltage of the analog pin on the ESP-12 is 1V. How can I get there?
1 Answer 1
Firstly, if I understand your schematic right, you're not "dividing" anything there. If the ringed red symbol is where you are connecting the ADC then either you will see near 4V on there (if it's only connected to the ADC), or 0V (if it's connected to ground).
You should be connecting the ADC between the resistors to get a reading.
Secondly, you should be using a P-channel MOSFET, not a PNP transistor. You can use a PNP transistor, but you will have to subtract the voltage drop imposed by the transistor from your calculations to get any meaningful reading. With a P-channel MOSFET, the on-resistance would be (or should be if you choose a sensible one) negligible compared to the resistance of the voltage divider.
You are right that you can't exceed 1V on the ADC, so you will have to size your resistors accordingly. You aren't restricted to just using a pair of 10K resistors - you can choose any values you like that yield the correct result.
schematic
simulate this circuit – Schematic created using CircuitLab
In this example, 10K and 2.2K give you no more than 0.9V from a 5V input. (Tip: choose an input voltage slightly higher than you expect to give a small safety margin).
I calculated those by:
- Use the voltage divider formula
R2 = ×ばつ(1/((VIN/VOUT)-1))
to calculate the lower resistor (2500Ω). - Choose the next lowest "common" resitor (2200Ω)
- Re-calculate the new output using the chosen resistor values using
VOUT = (R2/(R1+R2))×ばつVIN
(0.9V)
-
For something like lithium, I'd suggest doing some sort of basic calibration after building the circuit, as the discharge curve for lithium (and maybe a few others) is relatively flat, and a small change in voltage could mean a large change in state of charge. This could be as simple as taking a multimeter to get a better resistance ratio ( < ±1% for even a cheap meter vs. ±5-10% for the stated resistor values). If you wanna go all out, you could go so far as to find a few different stable voltage references and build a mapping function of adc output to actual voltage.Aaron– Aaron2018年07月05日 15:57:14 +00:00Commented Jul 5, 2018 at 15:57
-
1For lithium using a proper fuel gauge chip would be a better option.Majenko– Majenko2018年07月05日 15:58:42 +00:00Commented Jul 5, 2018 at 15:58
ADC_MODE(ADC_VCC)
andESP.getVcc()
? (Source) This eliminates all additional hardware, and doesn't sink any extra current.