hey all, so i have a couple of questions…
ive got a few nodemcu’s that i want to use for sensors around the house, eg pir’s and temp/humidity sensors, ive been playing with deep sleep and what not but not seeing anything useful for long term usage on batteries, im using 2x 18650’s in series, as the nodemcu’s im using tolerate the higher voltage and the regulator only heats up after like 5 mins of normal use… so my 6 seconds run and 30 mins sleep seems to get about 3 days from a full charge using fast connect and low power wifi mode , using a voltage divider from the batteries to the adc i have a working battery level… but im also aware that my current setup of something like 2k and 1.7k resistors will be using more power than if i select alot higher resistances, and this is my first question, does a permanently connected voltage divider always draw power through the adc… or does it like disconnect when not taking a reading or when its sleeping? if not can i use a transistor or relay to only connect the pin for measurement then disconnect on sleep? or would this be pointless if im using a better voltage divider and get the consumption way down…
my second question is, is this even the thing i should be working on? or is the 6 seconds of wifi and mqtt likely to be using more power than the battery adc sensor
here is my current version of the temp/humidity sensor
esphome:
name: nodemcutwo
esp8266:
board: nodemcuv2
# Enable logging
logger:
# Enable Home Assistant API
#api:
ota:
password: !secret ota_password
id: my_ota
wifi:
power_save_mode: HIGH
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
manual_ip:
static_ip: 192.168.1.115
gateway: 192.168.1.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Nmcu2 Fallback Hotspot"
password: !secret fallbackappassword
web_server:
port: 80
auth:
username: admin
password: !secret webservpass
captive_portal:
deep_sleep:
run_duration: 4s
sleep_duration: 30min
id: battery_deep_sleep
mqtt:
broker: 192.168.1.117
username: !secret mqtt_username
password: !secret mqtt_password
birth_message:
topic: nodemcuv2/status
payload: ''
retain: true
will_message:
topic: nodemcuv2/status
payload: ''
retain: true
on_message:
- topic: deep_sleep/ota_mode
payload: 'ON'
then:
- deep_sleep.prevent: battery_deep_sleep
- topic: deep_sleep/ota_mode
payload: 'OFF'
then:
- mqtt.publish:
topic: deep_sleep/ota_mode
payload: 'PASS'
qos: 2
retain: true
- deep_sleep.enter: battery_deep_sleep
sensor:
- platform: wifi_signal
name: "nodemcutwo ssi"
update_interval: 1s
- platform: dht
pin: D7
temperature:
name: "nodemcutwo Temperature"
humidity:
name: "nodemcutwo Humidity"
update_interval: 3s
- platform: adc
pin: A0
retain: true
name: "nodemcutwo Battery"
update_interval: 1s
expire_after: 1860s
device_class: battery
unit_of_measurement: "%"
accuracy_decimals: 1
filters:
- multiply: 7.959902632416832
- calibrate_linear:
- 8.2 -> 100
- 3 -> 0
text_sensor:
- platform: wifi_info
ip_address:
name: nodemcutwo IP Address
ssid:
name: nodemcutwo Connected SSID
bssid:
name: nodemcutwo Connected BSSID
mac_address:
name: nodemcutwo Mac Wifi Address
scan_results:
name: nodemcutwo Latest Scan Results