FireBeetle2 Deep Sleep Battery Consumption Issues

Hey all,
I have a pretty basic script to sense when a door opens using a FireBeetle 2 (ESP32). The script works well but the battery lasts at most around two days. I really cannot figure it out and have tried removing the HA API and instead using MQTT which I have read may have better battery.

Any help would really be appreciated if anyone has had similar troubles.

Thanks!

esphome:
  name: shed-door-sensor
  friendly_name: shed-door-sensor

esp32:
  board: firebeetle32
  framework:
    type: arduino

logger:
  level: INFO

ota:
  password: "XXXXX"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: true
  ap:
    ssid: "Shed-Door-Sensor"
    password: "XXXXXX"

switch:
  - platform: shutdown
    name: "Shutdown"
    id: shutdown_switch
    internal: True

binary_sensor:
  - platform: gpio
    id: door_trigger
    internal: True
    pin:
      number: GPIO25
      mode: INPUT_PULLUP
      inverted: False
      allow_other_uses: true
    publish_initial_state: True
    on_state:
      then:
        - lambda: |-
            if (id(door_trigger).state) {
              id(shed_door).publish_state(true);
            } else {
              id(shed_door).publish_state(false);
            }
  - platform: template
    id: shed_door
    name: "Shed Door"
    device_class: door
    retain: True

sensor:
  - platform: wifi_signal
    name: "WiFi Signal"
    update_interval: 10s
  - platform: adc
    name: "Battery Voltage"
    id: battery_voltage
    pin: GPIO34
    accuracy_decimals: 2
    update_interval: 10s
    attenuation: 11dB
    filters:
      - multiply: 2.0
    on_value_range:
      below: 3.00
      then:
        - switch.turn_on:
            id: shutdown_switch
  - platform: template
    name: "Battery Percentage"
    device_class: "battery"
    id: "battery_percentage"
    accuracy_decimals: 1
    update_interval: 10s
    unit_of_measurement: '%'
    lambda: |-
      return ((id(battery_voltage).state - 3.5) / 0.7 * 100.00);
    filters:
      - lambda: |-
          if (x < 0) return 0; 
          else if (x > 100) return 100;
          else return (x);

deep_sleep:
  id: deep_sleep_1
  run_duration: 5s
  sleep_duration: 360min
  wakeup_pin:
    number: GPIO25
    allow_other_uses: true
  wakeup_pin_mode: INVERT_WAKEUP

mqtt:
  broker: 192.168.1.35
  username: !secret mqtt_user
  password: !secret mqtt_pass
  on_message:
    - topic: "shed-door-sensor/ota_mode"
      payload: 'ON'
      then:
        - deep_sleep.prevent: deep_sleep_1
        - mqtt.publish: 
            topic: "shed-door-sensor/state"
            payload: "ota_mode"
    - topic: "shed-door-sensor/ota_mode"
      payload: 'OFF'
      then:
        - deep_sleep.allow: deep_sleep_1
    - topic: "shed-door-sensor/sleep_now"
      payload: 'ON'
      then:
        - deep_sleep.enter: deep_sleep_1

Snipping/crushing LEDs can really help on some boards.

I think some sensors can still draw power in deep sleep, so it may be worth looking into that too.

Hello, I had reviewed those threads and did some research on some of these boards. This board (Along with the Feather) is supposed to have some of the lowest power draw and no LEDs light up from what I can tell or have programmed. Let me continue to research, thanks for the response!

1 Like

I reckon it’s worth unhooking all of your sensors and seeing how long you get with just the esp waking and sleeping.

I am currently using a Firebeetle 2 to log temperature information.

Four DS18B20 sensors, logged every 15 minutes and saved to an SD card twice a day.
The battery is a single 500mAh LiPo.
I tested this earlier last year over 3 weeks and estimated the battery should be good for at least 6 months.

I left it logging at the end of October last year and will be able to access it again at the beginning of March this year. (Just over 4 months). At that time, I’ll know if the battery lasted for that period or exactly how long it did last.
I’ll post the info in Mahko_Mahko thread, when it’s available.

Did you cut that little jumper on the board?

1 Like

Firmware is not ESPHome I take it? (I believe ESPHome doesn’t have support for this).

Interested anyway.

Does it connect to WiFi?

I’ve found finding and implementing low power projects is trickier than you might initially think.

You are correct that it isn’t ESP Home based.
Just programmed it with Arduino IDE.
There is no wifi to connect to in the location it is in.

The SD card is the biggest current drain.
It takes 90mA for nearly a second to write the data.
I forgot. It also has a DS3231 RTC module, but that has it’s own CR2032 battery and should last years.

We’ll see in in March.
:slight_smile:

1 Like

Yes, it does connect to Wi-Fi and I am sure that that is one of the bigger drains. I do use fast connect and I do use every low power option I could find as noted in the above sketch. It is ESP home.

Do people tend to utilize MQTT or the supposedly more efficient Home Assistant API for providing updates?

I probably missed the memo, but I’m not sure what jumper might give me the additional battery life and why.

It was in the link you referred to and in Firebeetle docs.
Here:

1 Like

The advice I got on this topic from one of the devs is that if your mdns is working as it should then API is better these days.

1 Like