05-27-2025, 06:39 AM
this is analog input code for ESPHome:
Code:
sensor:
- platform: adc
pin: 39
name: "A128 A1 Voltage"
update_interval: 5s
attenuation: 11db
filters:
- lambda:
if (x >= 3.11) {
return x * 1.60256;
} else if (x <= 0.15) {
return 0;
} else {
return x * 1.51;
}
- platform: adc
pin: 34
name: "A128 A2 Voltage"
update_interval: 5s
attenuation: 11db
filters:
# - multiply: 1.51515
- lambda:
if (x >= 3.11) {
return x * 1.60256;
} else if (x <= 0.15) {
return 0;
} else {
return x * 1.51;
}
- platform: adc
pin: 36
name: "A128 A3 Current"
update_interval: 5s
unit_of_measurement: mA
attenuation: 11db
filters:
- multiply: 6.66666666
- platform: adc
pin: 35
name: "A128 A4 Current"
update_interval: 5s
unit_of_measurement: mA
attenuation: 11db
filters:
- multiply: 6.66666666
YouTube: https://www.youtube.com/c/KinCony
Online Store: https://shop.kincony.com
Alibaba Store: https://kincony.en.alibaba.com/
Online Store: https://shop.kincony.com
Alibaba Store: https://kincony.en.alibaba.com/

