Posts: 16
Threads: 2
Joined: Feb 2024
Reputation:
0
hi,
i have a pressure trasducer that works 4 - 20ma for 0 - 10 Bar, it support supply until 24v, now i'm using the same of the board, 12vdc. it have only two wires one for the power that is connected at 12 vdc and the other the output that i connect at the a3 of the board a k868 a8m.
i'm using with esphome with this configuration:
sensor:
- platform: adc
pin: 39
name: "A8S A4 Pressure"
update_interval: 2s
unit_of_measurement: "bar"
attenuation: 11db
filters:
- multiply: 6.66666666
- lambda: |-
// Valore di corrente in mA (4-20 mA)
if (x < 4.0) {
return 0.0;
} else if (x > 20.0) {
return 10.0;
} else {
return (x - 4.0) * (10.0 / 16.0);
}
i'm receiving this output:
INFO ESPHome 2024.8.3
WARNING `attenuation: 11db` is deprecated, use `attenuation: 12db` instead
[08:24:32][C][logger:185]: Logger:
[08:24:32][C][logger:186]: Level: DEBUG
[08:24:32][C][logger:188]: Log Baud Rate: 115200
[08:24:32][C][logger:189]: Hardware UART: UART0
[08:24:32][C][adc:097]: ADC Sensor 'A8S A4 Pressure'
[08:24:32][C][adc:097]: Device Class: 'voltage'
[08:24:32][C][adc:097]: State Class: 'measurement'
[08:24:32][C][adc:097]: Unit of Measurement: 'bar'
[08:24:32][C][adc:097]: Accuracy Decimals: 2
[08:24:32][C][adc:107]: Pin: GPIO39
[08:24:32][C][adc:122]: Attenuation: 12db
[08:24:32][C][adc:141]: Samples: 1
[08:24:32][C][adc:142]: Update Interval: 2.0s
[08:24:32][C][captive_portal:088]: Captive Portal:
[08:24:32][C][mdns:116]: mDNS:
[08:24:32][C][mdns:117]: Hostname: energy
[08:24:32][C][esphome.ota:073]: Over-The-Air updates:
[08:24:32][C][esphome.ota:074]: Address: 192.168.1.20:3232
[08:24:32][C][esphome.ota:075]: Version: 2
[08:24:32][C][esphome.ota:078]: Password configured
[08:24:32][C][safe_mode:018]: Safe Mode:
[08:24:32][C][safe_mode:020]: Boot considered successful after 60 seconds
[08:24:32][C][safe_mode:021]: Invoke after 10 boot attempts
[08:24:32][C][safe_mode:023]: Remain in safe mode for 300 seconds
[08:24:32][C][api:139]: API Server:
[08:24:32][C][api:140]: Address: 192.168.1.20:6053
[08:24:32][C][api:142]: Using noise encryption: YES
[08:24:33][D][sensor:094]: 'A8S A4 Pressure': Sending state 3.35833 bar with 2 decimals of accuracy
[08:24:35][D][sensor:094]: 'A8S A4 Pressure': Sending state 2.93333 bar with 2 decimals of accuracy
[08:24:37][D][sensor:094]: 'A8S A4 Pressure': Sending state 3.00000 bar with 2 decimals of accuracy
[08:24:39][D][sensor:094]: 'A8S A4 Pressure': Sending state 3.12083 bar with 2 decimals of accuracy
[08:24:41][D][sensor:094]: 'A8S A4 Pressure': Sending state 3.23750 bar with 2 decimals of accuracy
[08:24:43][D][sensor:094]: 'A8S A4 Pressure': Sending state 10.00000 bar with 2 decimals of accuracy
[08:24:45][D][sensor:094]: 'A8S A4 Pressure': Sending state 3.05000 bar with 2 decimals of accuracy
[08:24:47][D][sensor:094]: 'A8S A4 Pressure': Sending state 2.82917 bar with 2 decimals of accuracy
[08:24:49][D][sensor:094]: 'A8S A4 Pressure': Sending state 3.00000 bar with 2 decimals of accuracy
[08:24:51][D][sensor:094]: 'A8S A4 Pressure': Sending state 2.77917 bar with 2 decimals of accuracy
[08:24:53][D][sensor:094]: 'A8S A4 Pressure': Sending state 10.00000 bar with 2 decimals of accuracy
i don't understand why the value change, the water is closed. and sometimes the state goes to 10 bar.
can you help me?
thanks
Posts: 6,320
Threads: 808
Joined: Oct 2020
Reputation:
155
It's better to use an oscilloscope to check if the actual signal output by the sensor is normal.