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

Haven’t opened box up since set it out in March. Never tried to measure current but will give it a go when it dies and have to open it to charge.

Box has limited space for solar panel. Could get a same size but better power. Perhaps a mono-crystaline panel. Considered removing LED on the wemos but never saw it light when tested before setting outside. Getting good wifi -54dB.

I expect a lot of power wasting in your setup.

Your battery circuit uses some components to boost the output to 5v so that your d1 mini just waste more power to drop it with it’s ldo to 3.3V

The Wemos may run off the 3V. The 3V is regulated. LDO for the 3V might waste just as much I worry. Battery Voltage goes up to 4.2V when fully charged so bit risky to connect directly to Wemos without regulator. Will reduce WIFI power down few milliwatts when take it in. Will adjust it to take fewer reading by increasing sleep time when battery lower. Looking for any ideas so thanks @orange-assistant

Another (software only) idea to improve the run duration a little bit is to send the device directly to sleep after it delivered it’s values over mqtt. Might save a second or two…

But in your setup I’m quite confident the “standby” current draw is mainly in charge for draining the battery and not really the run time of the esp.

A video tip: Cheap and simple Solar Power for our small Projects (ESP32, ESP8266, Arduino)

Yeah, have that setup in MQTT.

esphome:
  name: outsidetemp
  platform: ESP8266
  board: d1_mini_pro

wifi:
  ssid: "Redacted"
  password: "Redacted"
  manual_ip:
    static_ip: 192.168.81.59
    gateway: 192.168.81.1
    subnet: 255.255.255.0
    dns1: 192.168.81.115
    dns2: 8.8.8.8
  output_power: 19dB
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Outsidetemp Fallback Hotspot"
    password: "Redacted"
    ap_timeout: 15min
captive_portal:

# Enable logging
logger:
  level: INFO

# Enable Home Assistant API
#api:

ota:


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

i2c:
    sda: D1
    scl: D2
    scan: false


sensor:
  - platform: bmp280
    address: 0x76
    update_interval: 30s 
    temperature:
      name: Outside Temp
    pressure:
      name: Outside Pres
 
     
    
    
  - platform: adc
    pin: A0
    name: Outside Battery
    accuracy_decimals: 3
    update_interval: 60s
    filters:
      - multiply: 5.1817
      
  - platform: wifi_signal
    name: "Outside WiFi Signal"
    update_interval: 60s

switch:
  - platform: shutdown
    name: "Outside Temp Shutdown"
  - platform: restart
    name: "Outside Temp Restart"

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

There’s the whole code. I agree it’s the standby draining most current but it may be the price of doing business on this hardware. I noticed when I updated HA the voltage would drop when HA came up again. Device may not have gone into deep sleep when MQTT offline.

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