amadeuspzs / esp8266-temperature-humidity

Low power MQTT temperature and humidity sensor
https://amadeuspzs.github.io/esp8266-temperature-humidity/
21 stars 3 forks source link

Current consumption in idle mode #6

Open Portia-Lin opened 1 year ago

Portia-Lin commented 1 year ago

You get great battery life from a single charge. I am also working on a similar device and I have my own implementation ideas for this. I looked through your code and didn't see a command to put the esp8266 to deepsleep mode. Maybe I was careless. How did you manage to get the esp8266 to work for so long from battery? Maybe I would still ask your advice. I have several sensors on the I2C line and a flash card on the SPI line. I am going to use the esp8266 deepsleep mode and turn off all devices when the esp8266 sleeps. I want to use a mosfet, but what is better to cut, VCC or GND? P-channel or N-channel mosfet to precisely avoid current leakage, for example on the I2C line.

Portia-Lin commented 1 year ago

I realized. I was just looking at the wrong code, now I see the deepsleep call. After the experiments, I had another question. I'm using an ESP-12F and it draws 120μA at 3.3V after going to sleep. This is after the voltage stabilizer. Why such a big value? I don't use anything else. Only ESP-12F module The datasheet indicates a consumption of 20 μA.

amadeuspzs commented 1 year ago

What voltage stabilizer are you using? It will have a latent draw itself.

Also what are you using to measure current? At these ranges current measurement can be a little inaccurate.

Portia-Lin commented 1 year ago

I use an AMS1117 stabilizer, but I measure the current consumption after it. After the power stabilizer, a 100 ohm resistor is placed in the power circuit gap. When starting the esp8266 I short the resistor. After switching to sleep mode, I remove the jumper from the resistor and measure the voltage drop across it. I calculate current consumption according to Ohm's law. Yesterday I picked up another ESP12F instead of the previous one. Its consumption in sleep mode during this experiment was calculated at 17 μA. IMG_20230606_112742.jpg

amadeuspzs commented 1 year ago

With a 100R current sense resistor you're going to have a 33mA load from the resistor itself?

I would use a high accuracy and much smaller resistor: https://components101.com/articles/what-is-current-sense-resistors-types-specifications-and-selection

For this project I used a https://lowpowerlab.com/guide/currentranger/ which handled all this for me.

Do you want to measure power consumption after the regulator? In my case I was interested in battery life, so I measured power consumption before the regulator as that is what was being drawn from the battery.

Also, I have found that energy usage does depend on distance to wifi access point - the further away/weaker the signal, the higher the energy usage.

Portia-Lin commented 1 year ago

No, the current will not be 33mA. According to Kirchhoff's law, the current in a series power supply chain flows uniformly. I got a voltage drop of 12mV on the shunt resistor. According to Ohm's law: I = U / R = 0.012 / 100 = 120 μA. My voltage regulator is not suitable for battery power, it has a large voltage drop. I'm waiting for the MCP1700-3302 to arrive. I don't have them yet, so I measure after the stabilizer. Although according to Kirchhoff's law, the current in the series circuit is the same, as I said, so maybe my voltage regulator is introducing inaccuracies? But when using another ESP12 module in the same circuit, the discharged current is 16 μA. After searching the internet, I noticed that some users also encountered high current consumption of the ESP8266 in deep sleep mode. But unfortunately, no one could solve this problem...