Monitoring Voltage on ESP

I have a INA219 sensor in another project and I haven’t the ESP32 ground connected to ground of the device and when device not on it reads -0.001v which I suspect is due to slight differences in grounds. I could be wrong. I’m not an electrical engineer.

I use openwrt routers and when I turned of legacy compatibility my ESP32 and sonoff devices wifi didn’t work as well for range.

  • Volting sensor
    voltmeter sensor shows a value of 0.004V


    Nothing is connected to pin A0.
    It can be caused by:
    Is a 12V transformer close?
    The shield’s battery was immediately fitted.

  • Router
    I use xiaomi router ac2350 worked great. But a few days ago the electricity went out and since then there are still problems and outages.

Final version: Follow the instructions above.


Multiplier 9.6 at 650kOhm resistor.
obrázok

1 Like

Looks good.

I just followed this post and I kind of have it working but there’s one bit I don’t understand. I have mine wired up as per your diagram with the + of the battery going to A0 via a 220k resistor.

With an 18650 cell that is probably not 100% charged I’m getting 1v (without a multiplier). I’m not sure what that’s telling me though. Do I need to start with a fully charged battery, measure the voltage and use that as the multiplier? If I just leave it as it is, at what point will it stop reading 1v?

Hi
The A0 output needs the multiplier as the voltage divider only drops a voltage of 1V or possibly up to 1.1V across it. You then need to multiply it up to match what you can measure across the actual battery terminals with a multimeter ( if battery has 4.2V and your output from A0 is 1V then multiply factor is 4.2. The voltage you get isn’t exactly what you would calculate due to resistance of the load is in parallel with the 220K resistor so you may have to adjust the multiply factor a few times. Some people seem to run into a problem that no matter what the battery is it always reads the same value no matter what you read across the terminal with a multimeter.

1 Like

Great stuff. Thank you.

How do I make the voltage drop from 3.1V (with attenuation: 11db)? at the moment I have a real voltage of 6V and the sensor is already at maximum (3.1V). I’ve tried increasing the resistors, but it doesn’t change anything.

https://ohmslawcalculator.com/voltage-divider-calculator

6v - 10k - adc pin out 3v - 10k - gnd

2 Likes

I want to use this project for gas meter 30 m away from my home and no electricity there. What is the battery life? I will use wemos mini pro with antenna mod + 2x18650 Sanyo GA 3400 mAh + battery shield as posted above. I need deep sleep to be off when there is gas consumption and to be on when it is in idle. I will use reed switch for that readings.

for measuring gas using a battery, I recommend a combination:

  • Solar panel 5-6V
  • tp4056 charger
  • ht7833 ldo regulator
  • esp32 only module,
  • deep sleep with wake up pin.
  • reduced processor frequency,
  • 2x 18650 3000mAh battery.

an example for a water meter on the Czech forum with a code
https://www.homeassistant-cz.cz/viewtopic.php?p=4361&hilit=Vodomer#p4361

1 Like

Solar panel will be useless. Biggest usage of gas is during winter when there is no sun. How long will it work on these 2x18650?

I think picking the right board could be quite important. Andreas Spiess has a good spreadsheet for power consumption of boards.

Also I’m not sure but I think power consumption will be higher if you need the reed switch pin to remain active during deep sleep.

In one of his vids he links to a lifetime calculator based on wake/deep sleep current and duty cycle etc…

Edit:
I also just saw this from someone on Discord.

yes I agree. My water meter is already version 3 and the first winter. The solar charger hasn’t worked for me yet, so I can’t judge. But the remaining year without any problems. It’s about being tested.

Then there is also the option of taking a zigbee door sensor from Xiaomi.
For example, and connecting it to a solar drive. The rest have already been set in the HA and template sensor configuration.

6 months will be satisfing for me. Even 4 would be good. We will see. I will be testing Firebeetle 2 esp32 board with 2x18650. I will give it a try on esphome. There is around 500 wakeups a day avarage.

1 Like

Report back with results please!

1 Like