Hello!
I got two Wemos s2 mini, and now I am creating a multiple Moisture sensor for the garden powered by two 18650 bateries (4.2v max) in parallel which are rechargables by a mini Solar Panel. I followed this tutorial https://randomnerdtutorials.com/power-esp32-esp8266-solar-panels-battery-level-monitoring/ with all the same components.
In the pin 2,3 and 4 I have the three moisture sensor which works as I expected, in the pin 1 (adc1) I connected by following the tutorial the same pin from the circuit including two resistors 27k and 100kohm. If I measure the wire with my multitester when is full charge corresponds to 3.2v and when is discharged is around 2.38v.
While I am using the device I can see the battery is discharging, having for example 3.8v, and the wire conencted to the pin 1 around 2.91v. The problem is then in ESPHOME readings, always I have a fix value of 2.62733v. I tried to change the GPIO pins and same error. WIth the moisture sensor no problem.
My yaml config is:
substitutions:
display_name: garden
update_fq: 120s
battery_full: '3.20'
battery_empty: '2.382'
battery_diff: ${battery_full}-${battery_empty}
dry01: '2.10859' #1.44
wet01: '0.68' # 0.64
dry02: '2.12758'
wet02: '0.734'
dry03: '2.084'
wet03: '0.537'
#ivolt: '1' #'3.32
utime: '120' #se
esphome:
name: wemos-s2-01
friendly_name: wemos-s2-01
# esp32:
# board: lolin_s2_mini
# framework:
# type: arduino
esp32:
board: lolin_s2_mini
variant: esp32s2
framework:
type: arduino
# version: 2.0.3
# platform_version: 4.4.0
sensor:
#MOISTURE SENSOR
- platform: adc
pin: GPIO2
attenuation: auto
name: "Soil Moisture W01"
id: soil_moisture_01
unit_of_measurement: "%"
device_class: humidity
icon: "mdi:watering-can"
filters:
- calibrate_linear:
- ${dry01} -> 0.00
- ${wet01} -> 100.00
- lambda: |
if (x < 0) return 0;
else if (x > 100) return 100;
else return (x);
update_interval: ${utime}s
accuracy_decimals: 1
- platform: adc
pin: GPIO2
attenuation: auto
name: "Soil Voltage W01"
unit_of_measurement: "V"
device_class: voltage
update_interval: ${utime}s
accuracy_decimals: 2
########
#Battery tracking
- platform: adc
pin: GPIO1
attenuation: auto
name: '${display_name} Battery Voltage'
unit_of_measurement: "V"
device_class: voltage
update_interval: ${update_fq}
accuracy_decimals: 2
- platform: adc
pin: GPIO1
name: '${display_name} Battery charge'
attenuation: auto #11db
unit_of_measurement: '%'
filters:
- calibrate_linear:
- ${battery_empty} -> 0.00
- ${battery_full} -> 100.00
- lambda: |
if (x < 0) return 0;
else if (x > 100) return 100;
else return (x);
As example I just wrote one moisture sensor, also, you can see I tried to define different boards.
What I am doing wrong?
Thank you!