Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 9,513
» Latest member: tucanbakery
» Forum threads: 4,182
» Forum posts: 20,778

Full Statistics

Online Users
There are currently 29 online users.
» 0 Member(s) | 18 Guest(s)
Amazonbot, Applebot, Baidu, Crawl, PetalBot, Scrapy, bot

Latest Threads
KC868-A32 Malfunction Aft...
Forum: KC868-A32/A32 Pro
Last Post: sson6203
4 minutes ago
» Replies: 2
» Views: 36
KinCony F8 + ESPHome: Una...
Forum: F8
Last Post: admin
08-02-2026, 11:00 PM
» Replies: 2
» Views: 10
F8 ESPHome yaml for home ...
Forum: F8
Last Post: admin
08-02-2026, 11:00 PM
» Replies: 0
» Views: 5
Schema A16V3 for Research...
Forum: KC868-A16v3
Last Post: hamzachaouri
08-02-2026, 10:34 PM
» Replies: 2
» Views: 24
B8 ADS1115 current inputs
Forum: B8
Last Post: admin
07-29-2026, 09:47 PM
» Replies: 6
» Views: 57
KINCONY IN KSA
Forum: DIY Project
Last Post: admin
07-29-2026, 10:43 AM
» Replies: 14
» Views: 1,764
A32 Pro ESPHome yaml for ...
Forum: KC868-A32/A32 Pro
Last Post: admin
07-27-2026, 06:25 AM
» Replies: 1
» Views: 1,204
E8v3 E16v3 E24v3 relay mo...
Forum: Extender module
Last Post: admin
07-27-2026, 01:00 AM
» Replies: 0
» Views: 47
KC868-H32B V5.08 firmware
Forum: News
Last Post: admin
07-25-2026, 11:53 PM
» Replies: 23
» Views: 7,795
[arduino code examples fo...
Forum: B2
Last Post: admin
07-25-2026, 06:40 AM
» Replies: 0
» Views: 42

  [Arduino source code for KC868-M16]-03 -ETHERNET_code
Posted by: KinCony Support - 05-06-2023, 01:02 AM - Forum: KC868-M16 / M1 / MB / M30 - No Replies

[Arduino source code for KC868-M16]-03 -ETHERNET_code

Code:
#include <ETH.h>
#include <WiFiUdp.h>

#define ETH_ADDR        0
#define ETH_POWER_PIN  -1
#define ETH_MDC_PIN    23
#define ETH_MDIO_PIN   18
#define ETH_TYPE       ETH_PHY_LAN8720
#define ETH_CLK_MODE   ETH_CLOCK_GPIO17_OUT

WiFiUDP Udp;                      //Create UDP object
unsigned int localUdpPort = 4196; //local port
IPAddress local_ip(192, 168, 1, 200);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);
IPAddress dns(192, 168, 1, 1);

void setup()
{
  Serial.begin(115200);
  Serial.println();
   
  ETH.begin(ETH_ADDR, ETH_POWER_PIN, ETH_MDC_PIN, ETH_MDIO_PIN, ETH_TYPE, ETH_CLK_MODE); //start with ETH
  if (ETH.config(local_ip, gateway, subnet, dns, dns) == false) {
    Serial.println("LAN8720 Configuration failed.");
  }else{Serial.println("LAN8720 Configuration success.");}
  Serial.println("Connected");
  Serial.print("IP Address:");
  Serial.println(ETH.localIP());

  Udp.begin(localUdpPort);
}

void loop()
{
  int packetSize = Udp.parsePacket(); //get package size
  if (packetSize)                     //if have received data
  {
    char buf[packetSize];
    Udp.read(buf, packetSize); //read current data

    Serial.println();
    Serial.print("Received: ");
    Serial.println(buf);
    Serial.print("From IP: ");
    Serial.println(Udp.remoteIP());
    Serial.print("From Port: ");
    Serial.println(Udp.remotePort());

    Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()); //ready to send data
    Udp.print("Received: ");   
    Udp.write((const uint8_t*)buf, packetSize); //copy data to sender buffer
    Udp.endPacket();            //send data
  }
}



Attached Files
.zip   KC868-M16-LAN8720.zip (Size: 1 KB / Downloads: 814)
Print this item

  [Arduino source code for KC868-M16]-02 -ADC_code
Posted by: KinCony Support - 05-06-2023, 01:01 AM - Forum: KC868-M16 / M1 / MB / M30 - No Replies

[Arduino source code for KC868-M16]-02 -ADC_code

Code:
/*KC868-M16 Read A1 A2 A4 input*/

#include "Arduino.h"
#include "PCF8574.h"         

#define ANALOG_A1   36       
#define ANALOG_A2   34     
#define ANALOG_A4   39     


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

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

void loop()
{
  if(analogRead(ANALOG_A1)!=0){
    Serial.printf("Current Reading A1 on Pin(%d)=%d\n",ANALOG_A1,analogRead(ANALOG_A1));
  }
   if(analogRead(ANALOG_A2)!=0){
    Serial.printf("Current Reading A2 on Pin(%d)=%d\n",ANALOG_A2,analogRead(ANALOG_A2));
   }
   if(analogRead(ANALOG_A4)!=0){
    Serial.printf("Current Reading A4 on Pin(%d)=%d\n",ANALOG_A4,analogRead(ANALOG_A4));
   }
   delay(100);
 
}



Attached Files
.zip   KC868-M16-ADC.zip (Size: 631 bytes / Downloads: 743)
Print this item

  [Arduino source code for KC868-M16]-01 - Read 16 input channels
Posted by: KinCony Support - 05-06-2023, 12:57 AM - Forum: KC868-M16 / M1 / MB / M30 - No Replies

[Arduino source code for KC868-M16]-01 - Read 16 input channels

Code:
/*KC868-M16 read 16 channels*/
#include "Arduino.h"

#define SDA 4
#define SCL 5
#define a 50
#define s0 32
#define s1 33
#define s2 13
#define s3 16
#define IN3 35

void setup()
{
  Serial.begin(115200);
  pinMode(s0,OUTPUT);
  pinMode(s1,OUTPUT);
  pinMode(s2,OUTPUT);
  pinMode(s3,OUTPUT);
  pinMode(IN3,INPUT);

 
}
void loop()
{

  for(int j=1;j<17;j++){
     if(j==1){
         truth_table01();
         if(analogRead(IN3)!=0){
            Serial.printf("A3 on CH1=%d\n",analogRead(IN3));
         }
     }
    if(j==2){
         truth_table02();
         if(analogRead(IN3)!=0){
            Serial.printf("A3 on CH2=%d\n",analogRead(IN3));
         }
    }
    if(j==3){
          truth_table03();
         if(analogRead(IN3)!=0){
            Serial.printf("A3 on CH3=%d\n",analogRead(IN3));
         }
    }
    if(j==4){
         truth_table04();
         if(analogRead(IN3)!=0){
            Serial.printf("A3 on CH4=%d\n",analogRead(IN3));
         }
    }
    if(j==5){
         truth_table05();
         if(analogRead(IN3)!=0){
            Serial.printf("A3 on CH5=%d\n",analogRead(IN3));
         }
    }
    if(j==6){
          truth_table06();
         if(analogRead(IN3)!=0){
            Serial.printf("A3 on CH6=%d\n",analogRead(IN3));
         }
    }
    if(j==7){
          truth_table07();
         if(analogRead(IN3)!=0){
            Serial.printf("A3 on CH7=%d\n",analogRead(IN3));
         }
    }
    if(j==8){
          truth_table08();
         if(analogRead(IN3)!=0){
            Serial.printf("A3 on CH8=%d\n",analogRead(IN3));
         }
    }
    if(j==9){
          truth_table09();
         if(analogRead(IN3)!=0){
            Serial.printf("A3 on CH9=%d\n",analogRead(IN3));
         }
    }
    if(j==10){
          truth_table10();
         if(analogRead(IN3)!=0){
            Serial.printf("A3 on CH10=%d\n",analogRead(IN3));
         }
    }
    if(j==11){
          truth_table11();
         if(analogRead(IN3)!=0){
            Serial.printf("A3 on CH11=%d\n",analogRead(IN3));
         }
    }
    if(j==12){
          truth_table12();
         if(analogRead(IN3)!=0){
            Serial.printf("A3 on CH12=%d\n",analogRead(IN3));
         }
    }
    if(j==13){
          truth_table13();
         if(analogRead(IN3)!=0){
            Serial.printf("A3 on CH13=%d\n",analogRead(IN3));
         }
    }
    if(j==14){
          truth_table14();
         if(analogRead(IN3)!=0){
            Serial.printf("A3 on CH14=%d\n",analogRead(IN3));
         }
    }
    if(j==15){
          truth_table15();
         if(analogRead(IN3)!=0){
            Serial.printf("A3 on CH15=%d\n",analogRead(IN3));
         }
    }
    if(j==16){
          truth_table16();
         if(analogRead(IN3)!=0){
            Serial.printf("A3 on CH16=%d\n",analogRead(IN3));
         }
    }
    delay(20);
  }
  //}
 
}
void truth_table01()
{
  digitalWrite(s0,LOW);
  digitalWrite(s1,LOW);
  digitalWrite(s2,LOW);
  digitalWrite(s3,LOW);
}
void truth_table02()
{

  digitalWrite(s0,HIGH);
  digitalWrite(s1,LOW);
  digitalWrite(s2,LOW);
  digitalWrite(s3,LOW);
}
void truth_table03()
{

  digitalWrite(s0,LOW);
  digitalWrite(s1,HIGH);
  digitalWrite(s2,LOW);
  digitalWrite(s3,LOW);
}
void truth_table04()
{
  digitalWrite(s0,HIGH);
  digitalWrite(s1,HIGH);
  digitalWrite(s2,LOW);
  digitalWrite(s3,LOW);
}
void truth_table05()
{
  digitalWrite(s0,LOW);
  digitalWrite(s1,LOW);
  digitalWrite(s2,HIGH);
  digitalWrite(s3,LOW);
}
void truth_table06()
{
  digitalWrite(s0,HIGH);
  digitalWrite(s1,LOW);
  digitalWrite(s2,HIGH);
  digitalWrite(s3,LOW);
}
void truth_table07()
{
  digitalWrite(s0,LOW);
  digitalWrite(s1,HIGH);
  digitalWrite(s2,HIGH);
  digitalWrite(s3,LOW);
}
void truth_table08()
{
  digitalWrite(s0,HIGH);
  digitalWrite(s1,HIGH);
  digitalWrite(s2,HIGH);
  digitalWrite(s3,LOW);
}
void truth_table09()
{
  digitalWrite(s0,LOW);
  digitalWrite(s1,LOW);
  digitalWrite(s2,LOW);
  digitalWrite(s3,HIGH);
}
void truth_table10()
{
  digitalWrite(s0,HIGH);
  digitalWrite(s1,LOW);
  digitalWrite(s2,LOW);
  digitalWrite(s3,HIGH);
}
void truth_table11()
{
  digitalWrite(s0,LOW);
  digitalWrite(s1,HIGH);
  digitalWrite(s2,LOW);
  digitalWrite(s3,HIGH);
}
void truth_table12()
{
  digitalWrite(s0,HIGH);
  digitalWrite(s1,HIGH);
  digitalWrite(s2,LOW);
  digitalWrite(s3,HIGH);
}
void truth_table13()
{
  digitalWrite(s0,LOW);
  digitalWrite(s1,LOW);
  digitalWrite(s2,HIGH);
  digitalWrite(s3,HIGH);
}
void truth_table14()
{
  digitalWrite(s0,HIGH);
  digitalWrite(s1,LOW);
  digitalWrite(s2,HIGH);
  digitalWrite(s3,HIGH);
}
void truth_table15()
{
  digitalWrite(s0,LOW);
  digitalWrite(s1,HIGH);
  digitalWrite(s2,HIGH);
  digitalWrite(s3,HIGH);
}
void truth_table16()
{
  digitalWrite(s0,HIGH);
  digitalWrite(s1,HIGH);
  digitalWrite(s2,HIGH);
  digitalWrite(s3,HIGH);
}

   



Attached Files
.zip   KC868-M16_ Read_16_input_channels.zip (Size: 1.04 KB / Downloads: 833)
Print this item

  3kw heater control
Posted by: ColEng55 - 05-05-2023, 05:04 PM - Forum: KC868-A16 - Replies (3)

I have a KC868-A16 and trying to get slow pwm or sigma delta running.

Im running home assistant so esp32 maybe would be the tightest integration.

Planning on controlling 3kw heaters via a SSR using one of the above techniques to regulate apparent power.

Thanks

Print this item

  Are output relay  of kc868-E16S  dry contact use for 12V DC or 220 volt AC?
Posted by: engmohades - 05-05-2023, 04:38 PM - Forum: KC868-E16S/E16P - Replies (3)

Are output relay  of kc868-E16S  dry contact use for 12V DC or 220 volt AC?

I see relay 30v DC or 220v AC

Print this item

  4-20ma Pressure
Posted by: lori72 - 05-05-2023, 09:49 AM - Forum: "KCS" v2 firmware system - Replies (1)

Hi, how do I convert the signal of a 4-20ma pressure switch into Bar?



Attached Files Thumbnail(s)
   
Print this item

  Free Sample request
Posted by: ollie.maller@gmail.com - 05-05-2023, 04:26 AM - Forum: Apply for free sample product - No Replies

Hi i Am requesting a free sample for https://www.kincony.com/tuya-electronic-...kc101.html To use at my school and teach some people about tuya.

Print this item

  how to see ESPHome logs from PC serial port by command line
Posted by: admin - 05-05-2023, 02:36 AM - Forum: KC868-A series and Uair Smart Controller - No Replies

command line (if use COM10): 
esphome logs config.yaml --device COM10

Print this item

  KC868-Server work with KinCony energy meter by RS485
Posted by: admin - 05-05-2023, 12:28 AM - Forum: KC868-Server Raspberry Pi4 local server - Replies (1)

   
   

Print this item

  [Arduino source code for KC868-M16]-04 -Read / Write SD card arduino source code
Posted by: admin - 05-04-2023, 06:14 AM - Forum: KC868-M16 / M1 / MB / M30 - No Replies

Code:
#include "FS.h"
#include "SD.h"
#include "SD_MMC.h"
#define BOARD_HAS_1BIT_SDMMC
void WriteFile(fs::FS &fs, const char *path, uint8_t *buf, int len)
{
  //unsigned long start_time = millis();
  Serial.printf("write [%s]...\n", path);

  File file = fs.open(path, FILE_WRITE);
  if (!file) {
    Serial.println("Failed to open file for writing");
    return;
  }
 
  if (!file.write(buf, len)) {
      Serial.println("Write failed");
      return;
    }

  file.flush();
  file.close();

  Serial.printf("Write [%s] Complete", path);
}

void ReadFile(fs::FS &fs, const char *path, uint8_t *buf, int len)
{
  Serial.printf("read [%s]...\n", path);

  File file = fs.open(path);
  if (!file) {
    Serial.println("Failed to open file for reading");
    return;
  }

  if (!file.read(buf, len)) {
      Serial.println("Read failed");
      return;
  }
 
  file.close();

  Serial.printf("Read [%s] Complete: %s", path, buf);
}

void testIO(fs::FS &fs)
{
  char buf[] = "hello world";

  WriteFile(fs, "/test.txt", (uint8_t *)buf, strlen(buf));
  ReadFile(fs, "/test.txt", (uint8_t *)buf, strlen(buf));
}

void setup() {
  pinMode(2,INPUT_PULLUP);
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("Please insert SD card");
  delay(1000);
 
  /* SD_MMC 1-bit Mode */
  if (!SD_MMC.begin("/cdcard", true)) {
    Serial.println("Card Mount Failed");
    return;
  }
  testIO(SD_MMC);
  SD_MMC.end(); // cancel SD card mount
}
void loop() {
}
   
after program running, we will find "hello word" have wrote to txt file and saved SD card.
SD card use by "1BIT_SDMMC" work mode.

Print this item