Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to read data analog from 4-20mA port?
#1
Hi. I have already bought 6 units of KC868-A4 model on Ali Express Order ID: 8154057463938467. There are 2 ports for 4-20mA. I have a TDS sensor output 4-20mA range 0-4400 us/ms. 

Got 2 question.

1) Can you give a source code how to read from the 4-20mA port? 
2) If my sensor signal 4-20mA to 0-5v is using 250ohm right? Can you show the diagram how to connect. Thanks.

My TDS sensor have a 3 wire (+,  - & Signal (S1)).

       
Reply
#2
read 4-20mA or 0-5v sensor, use same arduino code, here is demo source code of ADC:
https://www.kincony.com/forum/showthread.php?tid=1644

if you using KC868-A4, you not need to convert 4-20mA to 0-5v signal, just series connection with your sensor and KC868-A4.
such as : power supply + --> your 4-20mA sensor --> output to KC868-A4's analog input+ --> KC868-A4's analog input- --> power supply GND
Reply
#3
(09-25-2022, 10:12 PM)admin Wrote: read 4-20mA or 0-5v sensor, use same arduino code, here is demo source code of ADC:
https://www.kincony.com/forum/showthread.php?tid=1644

if you using KC868-A4, you not need to convert 4-20mA to 0-5v signal, just series connection with your sensor and KC868-A4.
such as : power supply + --> your 4-20mA sensor --> output to KC868-A4's analog input+ --> KC868-A4's analog input- --> power supply GND

Can you draw the Diagram on KC868-A4? The wiring. Just simple draw. with 3 wire.
Reply
#4
here is diagram:
   
Reply
#5
(09-26-2022, 03:44 AM)admin Wrote: here is diagram:

Thanks for helping.
Reply
#6
you are welcome.
Reply
#7
Hi, I would like to plug Siemens mag5000 transmitter flow sensor on kc868-a4. This sensor have + and - 4-20ma output (powered by transmitter). Can you tell me how to plug it on it please ?

I think - to AGND and + to A1 but not sure.

regard


Damien

   
Reply
#8
(12-10-2022, 10:00 AM)Damienlannoy Wrote: Hi, I would like to plug Siemens mag5000 transmitter flow sensor on kc868-a4. This sensor have + and - 4-20ma output (powered by transmitter). Can you tell me how to plug it on it please ?

I think - to AGND and + to A1 but not sure.

regard


Damien

up thread's photo also is suitable for you.
Power+ --> sensor's + --> senor's -  --> KC868-A4's A1
Power - --> AGND
Reply
#9
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
Reply
#10
It's better to use an oscilloscope to check if the actual signal output by the sensor is normal.
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)