05-02-2024, 07:36 PM
Hi. Sorting out analog inputs using esp32home. Thank you for any response, board working well.
Using this right now..
- platform: adc
pin: 36
name: "ADC-IN1"
update_interval: 5s
attenuation: 11db
filters:
- lambda: if (x <= 0.15) { return 0; } return x * 1.51;
Several questions:
(1) I saw some example code posted to this forum where about x of 3.1 it used a higher multiplier. Why? This code is going to cause a large increase in output value at 3.111 x. Would a better approach be to read ground and vcc to the esp, and then scale your input readings according to those two readings using those values as 0 and 100% of input span? (0-3.3 after the voltage divider, or 0-5v at the input terminal).
(2) If I want to read a 10k ntc thermistor, it looks like a voltage divider, of 5.1k/10k is already there on the input... so if I power a 10k ntc thermistor with 3.3 volts, wouldn't I be essentially just adding the resistance value of my thermistor onto the 5.1k on-board resistor? (Allowing me to subtract 5.1k from the read value, and then normalizing my reading using the on-board code). My voltage isn't what I expect if this were true. (I am not an expert on the electronics side). Just enough to be dangerous.
Code was here.
https://www.kincony.com/forum/showthread...hlight=adc
sensor:
- platform: adc
pin: 36
name: "A8S 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;
}
Using this right now..
- platform: adc
pin: 36
name: "ADC-IN1"
update_interval: 5s
attenuation: 11db
filters:
- lambda: if (x <= 0.15) { return 0; } return x * 1.51;
Several questions:
(1) I saw some example code posted to this forum where about x of 3.1 it used a higher multiplier. Why? This code is going to cause a large increase in output value at 3.111 x. Would a better approach be to read ground and vcc to the esp, and then scale your input readings according to those two readings using those values as 0 and 100% of input span? (0-3.3 after the voltage divider, or 0-5v at the input terminal).
(2) If I want to read a 10k ntc thermistor, it looks like a voltage divider, of 5.1k/10k is already there on the input... so if I power a 10k ntc thermistor with 3.3 volts, wouldn't I be essentially just adding the resistance value of my thermistor onto the 5.1k on-board resistor? (Allowing me to subtract 5.1k from the read value, and then normalizing my reading using the on-board code). My voltage isn't what I expect if this were true. (I am not an expert on the electronics side). Just enough to be dangerous.
Code was here.
https://www.kincony.com/forum/showthread...hlight=adc
sensor:
- platform: adc
pin: 36
name: "A8S 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;
}