12V (or higher) voltage divider for ESP32 S2 Mini

On the solar system I'm working for plants irrigation I would like to measure the Voltage to have an approximation idea about how much battery is left so I can decide if it would better to postpone irrigation to next day.

This is the idea I have in mind (controlling ground / open circuit with Transistor IRLZ44N):

I'm testing the circuit on falstad:


https://tinyurl.com/ylcbvkk2

However I realize when the Gate of the transistor is off (0V from Esp32 GPIO) the voltage divider is sohwing 23.6V (solar panel MPPT LOAD), however the voltmeter (Other Esp32 GPIO) is showing 40.6 mV.

I'm concerned about the high voltage as I know the tolerance range on ESP32 GPIO pin out is on the range 0-3.3V afaik.

My question is if it is safe for ESP32 doing like this or do you know if is there a better way?

When the mosfet is off, how are the grounds connected? Is difficult to see in the Fritzing, maybe a complete schematic would be better.

You are using the voltmeter like it was amp meter.
image

What kind of battery?

When the mosfet is off, the curcuit is open, so the idea is when the esp32 is in sleep mode all sensor ara disconnected and not spend energy, the first thing after wake up is turn on the pin which handle mosfet gate and give ground to all sensors (relay, bme280, hx711, etc)

The battery is a built in BMS 3S 18650 (Max ~13v) but I'm still not sure if I take measurements on the BMS or the MPPT which is connected to 50W solar panel (Max 18V?), tha is the reason I'm supposing the divisor should be able to divide at less 24V to have a margin and prevent ESP22 gpio is above 3V :sweat_smile:

May you concrete? Did you say so because the Resistor are too high? Or because it is connected to ground?
Sorry I didn't get what you mean :sweat_smile:

You should use falstad volt meter like in my post. Like you use physical volt meter. Not in series.

If you want to know the battery voltage , I would imagine that you would want to measure the output of the BMS but you need to make sure the battery is not being charged.
A simple divide by 4 voltage divider with a 3.3V 2% zener diode for protection

1 Like

Determining battery life depends on the battery chemistry. For lead-acid and similar types, you can estimate it using voltage. However, for lithium batteries, which have a very flat discharge curve, voltage is not a good indicator of remaining capacity. In that case, you’ll need a coulomb counter.

1 Like

Falstad shows 23.954V when the circuito is open, does someone can tell me if this is an error on simulation or it would happen in real life? As far as I know when the transistor is off the circuit should be oppen and the voltmeter should read 0V, doesn't work like this?:


https://tinyurl.com/27ab2yto

It will happen

Ok, it seems there was something I don't know about open circuits, so I changed my approach and decided to read the voltage on the source, but now the problem is the voltage drops under expected results should be 2.181V but is dropping until 1.392, I guess the Transistor has some voltage drops. Does someone knows how can I solve this to read the expected voltage?

That configuration also will not work. The gate voltage of the MOSFET need to be much higher than source and the 100K prevents that from happening.

When using a voltmeter one end should be connected to ground.

See post #9

I can guess the function of capacitor is to limit the current reducing the consumption, or?
However what is the mission of the schottky diode on the circuit? to protect Esp32 shouldn't it be connected to ESP direclty instead of 3.3V source?

To filter out noise.

However what is the mission of the schottky diode on the circuit?

To protect the ESP. It is connected to the 3.3V pin on the ESP32 board.
If the voltage at A0 should spike above 3.3V, the diode will clamp it to 3.3V.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.