What is the shortest meaningful run_duration you got to work for deep sleep? Any tips to improve?

I don’t see any deep_sleep.enter action in your code so the runtime will always be the configured 10 seconds even if your device does all it’s work in 6 seconds for example

So if add on this bit to end of mqtt and move whole section to near the bottom will this enter deep sleep sooner. Don’t want to update Wemos unless I on the right track.

mqtt:
  broker: 192.168.81.107
  username: redacted
  password: redacted
  birth_message:
    topic: solarsensor/birthdisable
    payload: disable
  will_message:
    topic: solarsensor/willdisable
    payload: disable
  discovery: true
  discovery_retain: true

  on_message:
    - topic: outside/ota_mode
      payload: 'ON'
      then:
        - logger.log: 'OTA Mode ON - Deep sleep DISABLED'
        - deep_sleep.prevent: deep_sleep_1
    - topic: outside/ota_mode
      payload: 'OFF'
      then:
        - logger.log: 'OTA Mode OFF - Deep sleep ENABLED'
        - deep_sleep.enter: deep_sleep_1

     - topic: outsidetemp/sensor/outside_pres
       then:
        - logger.log: 'Sensors sent - Deep sleep ENABLED Early'
        - deep_sleep.enter: deep_sleep_1   


deep_sleep:
  id: deep_sleep_1
  run_duration: 10s
  sleep_duration: 5min      

I have put no payload in for deep sleep early on last sensor sending. Do I need one?

Check the example and explanation here: ESP32 Battery Powered Temperature/Humidity/AtmosphericPressure | ESPHome-Devices

1 Like

Cheers. I will try that.

… and check out the video tip of @orange-assistant above. That guy from Switzerland has released a bunch of really good videos about your subject (see YouTube). He measures and compares deep sleep current of several boards, identifies energy wasting components on the boards and removes them if possible. Really helpful.

fast_connect should help also, no? It says it skips the WiFi scan and just connects immediately

1 Like

Big fan of Andreas Spiess videos. I picked the battery charger after watching his review.

2 Likes

Use fast connect on most of my ESP32s. Doesn’t work as well on this project due to placement of my WIFI access points, I suspect. Perhaps it has improved in recent versions of ESPhome. Will give it a try. Thanks for reminding me.

Early update. Even with just few hours weak sunlight over last 3 days the voltage seems to be on the way up.

[22:25:11][I][mqtt:214]: MQTT Connected!
[22:25:11][I][app:060]: setup() finished successfully!
[22:25:11][I][app:099]: ESPHome version 2021.11.1 compiled on Nov 25 2021, 22:14:52
[22:25:21][I][deep_sleep:072]: Beginning Deep Sleep
[22:34:52][I][mqtt:214]: MQTT Connected!
[22:34:52][I][app:060]: setup() finished successfully!
[22:34:52][I][app:099]: ESPHome version 2021.11.1 compiled on Nov 25 2021, 22:14:52
[22:34:52][I][deep_sleep:072]: Beginning Deep Sleep

You can see from esphome log the previous setting of run for 10 seconds then sleep. I turned on the automation to send mqtt message to wemos as provided on early sleep and then it turns of all in the same second. I’ve noticed that it still sometimes takes the 10 seconds. Max time possibly saved of runtime is 24 mins a day. Might just be enough saving on battery to get me through the winter.
I have sent off for a similar sized solar panel but monocrystaline which should have at least a 25% greater power to charge.

2 Likes

Have build a second battery powered espboard with temp and pressure sensor. The outside battery is still connected to solar panel but no sunshine in over a week. Slower reduction in voltage but it may be just because battery is around the 3.7v.

New esp12f is just a bare esp12F on adapter board with few pullup/down resistors and no capacitor across the vcc/ground. It is connected to 3.3v connection on the 18650 battery shield. I broke the charge usb port off the shield. Good smooth readings from the BMP280. Tried to connect outside battery to the wemos D1 by 3.3v but a lot of jitters in the temp graph and possible board restarts. Might try it again later with a capacitor across vcc/ground. Suspect it’s the wifi that causes the spikes in power upsetting the readings.

This is the circuit diagram for new weather station. The cost of doing business has gone down since I used the 3.3V output from the Battery shield regulator compared the 5V output. No jitter on the temp and pressure as seen when tried to run Wemos D1 mini from 3.3V.

Just one little hint:
The Wemos D1 mini already contains an internal voltage divider with 220k and 100k behind its A0 pin. If you want to increase the max input voltage you can do that with a single resistor in front of the A0 pin. This adds to the 220k resistor. In your case (4:1 divider for voltages up to 5V) you would simply put 180k in front of A0, so your resulting voltage divider would be (180k+220k) : 100k = 4 : 1.

With your circuit you will actually not get a 4:1 divider because the internal sum of 320k lies in parallel to your 110k and pulls it down more than you expected.

Yes, on my original board I had a single 220K resister with the Wemos. ESP12F didn’t so I had to supply the extra resistor. The 110K is just 2 220K in parallel. With 2 220k in series before it.

This board is running off the 5V.
The multiplication factor for wemos was 5.1817 to get peak voltage to 4.2V
and 4.8208 for ESP12F ( although this may have to be increased a little when I check it again).
Current draw should be very small to A0. Battery shield and voltage check is still probably biggest drain as @orange-assistant suggested , but I think this will be enough in these dark latitudes to carry me though a whole year. I have got the wifi output_power: 14dB and still getting good signal.

1 Like

Been running current setup for 8 weeks with no problem. Went up by 400mV in 3 weeks in the dark days of January.

Voltage has kept fairly constant now for weeks. Mostly the solar panel gets some sun from 10:30 and usually within an hour the voltage hits the point where overcharge protection kicks in. The overcharge protection then stops it charging for several hours. Once that maximum spike settles the voltage drops about 30mV over the next 20 or so hours. I think ditching the Wemos board with all its extra hardware probably made the most gains.

I think I have picked satisfactory values for my voltage divider of 440K and 110K. I have read around the subject of Resistors in voltage divider as I know the lower values you use then more current is used by the battery monitor on A0. I thought then, why not use resistors in the Mega Ohm range. The disadvantage of using high value resistors in a voltage divider is it makes the output impedance higher and the output voltage more sensitive to loading. Here you can see a small amount of jitter to 3 decimal places.

Load Resistance
Also found out why the voltage you measure is not the same as you would predict from a voltage divider calculator. It’s because the ESP12F with my A0 is providing some resistance in parallel with the lower value resistor in the divider. Well that’s my understanding of it.

2 Likes

Just updating. For over 1 year this external Temp/pressure sensor has been out side without any intervention( been tempted to open the box). Running on solar Voltage hasn’t dropped below 4V with sun at times not getting above 12.5 degrees above the horizon and many days on end without direct sunlight. The 18650 battery has done well , although external temp hasn’t dropped lower than -6 C
.

2 Likes

I built a second smaller outdoor weather station based on a 420 mAh cell(built in battery protection) with an MCP73871 battery charger board(no built in battery protection).
I use a smaller circular solar panel about 1cm larger diameter than the case.

The MCP73871 has a power path. This has 2 advantages.

  1. If sun is shining then It can supply power directly to the ESP12F without taking from battery first so less charge discharge cycles.
  2. If battery goes flat and then sun comes out the ESP12F can wake up without putting a demand for power from the cell which will only be charging at low current at its low voltage.
    Andreas Spiess describes this problem with the old 18650 battery shield V3 on his channel .i.e. Chip never works and battery will never charge.

It all ran well until Dec 2023 when we got almost no sun shine for next 6 weeks. Lots of rain though. The sensor BMP280 began to glitch. It would read same temp on graph for hours at a time.
When I examined it the cover on the senor had come loose as silicone sealant came off. I replaced the rusty BMP280 and resealed it. Temp and pressure still didn’t read right and Logs often showed BMP sensor not found.
The cell then just seemed to discharge fully over few hours until battery protection kicked in. Next day with just few minutes of direct sun the device would come back to life for up to 18 hours before shutting down
but sensor would read as not connected in logs.
I took it all apart and decided to power the BMP from an output pin rather than VCC. Problem here was to get the output pin to run high before the I2C was loaded.

Thanks to @tiimsvk I got this running. Delayed initialization I2C bus

esphome:
  name: weathersmall
  platform: ESP8266
  board: esp01_1m

  on_boot:
    priority: 1000
    then:
      - lambda: |-
          pinMode(13, OUTPUT);
          digitalWrite(13, HIGH);

I use an automation to send the ESP to deep sleep as soon as HA gets the battery voltage. The senor seems to work better if it goes to sleep and wake again rather than leaving deep sleep inactive to test multiple readings.
There is the advantages of not only slightly lower power consumption of BMP in deep sleep but also the reduced chance of BMP coming out of I2C mode and slipping into SPI mode which I have seen happen after few months needing a hard reset.

2 Likes

just a tip for better measurement outdoors. bmp sensor does not include a heater. Therefore, it shows 100% humidity during rain. I recommend using sht sensors with this function.

Thanks, I had considered buying SHT next time. When I bought the sensor I thought I was buying a BME280 which has humidity. I use a 433mhz digoo sensor out the back which has humidity and it reads 99% when it rains. The digoo has run for years on 2 AA cells. It would make sense to just use them rather than more expensive setup with wifi/lithium cells/battery management, if cost was just the goal. Thank god my small weather ESP broke or I would have had nothing to tinker with and learned nothing new.

This is graf SHT vs BME installed on weather station

1 Like

Been using the SHT sensor for a month now and no problem with Temp readings. More stable than the BMP280.

1 Like