Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Arduino IDE demo source code for KC868-A16]--#04-ADC INPUT
#1
Rainbow 
Code 3: //The demo code is ADC INPUT    You can copy the code to your Arduino IDE

Code:
#include "Arduino.h"

#define ANALOG_A1   36
#define ANALOG_A2   34
#define ANALOG_A1   35
#define ANALOG_A2   39

void setup()
{
    Serial.begin(115200);
    delay(1000);

  pinMode(ANALOG_A1,INPUT);
  pinMode(ANALOG_A2,INPUT);
  pinMode(ANALOG_A3,INPUT);
  pinMode(ANALOG_A4,INPUT);
}

void loop()
{
  delay(500);
  Serial.printf("Current Reading A1 on Pin(%d)=%d\n",ANALOG_A1,analogRead(ANALOG_A1));
  Serial.printf("Current Reading A2 on Pin(%d)=%d\n",ANALOG_A2,analogRead(ANALOG_A2));
  Serial.printf("Current Reading A1 on Pin(%d)=%d\n",ANALOG_A3,analogRead(ANALOG_A3));
  Serial.printf("Current Reading A2 on Pin(%d)=%d\n",ANALOG_A4,analogRead(ANALOG_A4));
}
Reply
#2
I just want to confirm which ports are 4mA-20mA and which are 0-5V.. according to description in here https://www.kincony.com/arduino-esp32-16...ule-2.html analog input port 1 (pin36)&2(pin34) are 4mA-20mA.. and 3(pin 35)&4(pin 39) are 0-5V.., correct? At the same time in the schematic drawings https://www.kincony.com/download/KC868-A...ematic.pdf all analog input ports are marked as 0-5V which makes me confused. 

The background of the question is that I'm trying to connect temperature sensor from Danfoss which operates in a range of 9-32VDC power supply and 4mA-20mA as a output signal. I connected one wire from sensor to +12VDC & the other one to port 1 (pin 36) and readings of sensor is around 950 out of 1023 (10 bits resolution) for 30C which is obviously way to much (sensor range is 0-200C so I'm expecting something around ~300). Any ideas what might be wrong?
Reply
#3
now the default 4 CH all are 0-5v.  but you can replace two resistance switch to 4-20mA signal.
   
here are two diagram, left is KC868-A16, right is KC868-A4, you can replace 510R with 0R, 1002 with 150R, so that can use 4-20mA sensor.
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)