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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 10,320
» Latest member: sunshiene
» Forum threads: 4,290
» Forum posts: 21,232

Full Statistics

Online Users
There are currently 726 online users.
» 0 Member(s) | 697 Guest(s)
AhrefsBot, Amazonbot, Applebot, Baidu, Bing, Bytespider, Crawl, Facebook, Google, HeadlessChrome, PetalBot, Semrush, Twitter, bot, facebookexternalhit

Latest Threads
KC868-HAv2: TS sensor on ...
Forum: KC868-HA /HA v2
Last Post: swisstmack25
5 hours ago
» Replies: 5
» Views: 141
CT Clamp Compatibility
Forum: KC868-M16 / M1 / MB / M30
Last Post: Stanb
9 hours ago
» Replies: 13
» Views: 3,264
N30 most recent ESPhome
Forum: N30
Last Post: admin
Yesterday, 11:14 PM
» Replies: 1
» Views: 39
[Bug] A16v3 KCS 3.27.2 - ...
Forum: "KCS" v3 firmware
Last Post: admin
Yesterday, 03:53 AM
» Replies: 2
» Views: 135
KC868-A128 Arduino Demo: ...
Forum: KC868-A128
Last Post: admin
Yesterday, 03:24 AM
» Replies: 0
» Views: 57
KC868-A128 Arduino Chasin...
Forum: KC868-A128
Last Post: admin
Yesterday, 03:23 AM
» Replies: 0
» Views: 34
KC868-AP – max current pe...
Forum: KC868-AP / ADR
Last Post: admin
Yesterday, 01:01 AM
» Replies: 4
» Views: 118
[Arduino source code for ...
Forum: KC868-A2
Last Post: admin
Yesterday, 12:57 AM
» Replies: 2
» Views: 1,613
KC868-A8v3 ModBus Temp. S...
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
Yesterday, 12:56 AM
» Replies: 3
» Views: 1,306
Which KinCony board for a...
Forum: DIY Project
Last Post: admin
10-21-2026, 06:26 AM
» Replies: 3
» Views: 120

  [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: 991)
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

  New house iot project
Posted by: Horlagold - 05-03-2023, 09:19 PM - Forum: DIY Project - Replies (9)

Please help me choose and recommend devices for my home automations

Six water leak sensor
Two Humidity sensor
Two temperature sensor

A device that can control 
three way or four way light switch
One doorbell chime
One energy meter

Print this item

  KC868-M16 16CH CT Clamp Energy Monitor Board Released
Posted by: admin - 05-03-2023, 11:52 AM - Forum: News - No Replies

We have designed KC868-M16 (ESP32 16 Channel CT Clamp Energy Monitor) for home automation DIYer. it can easy integrate to home assistant by ESPHome. the hardware have 16CH CT Clamp sensor INPUT ports + 3CH analog input + Ethernet + WiFi + Bluetooth + DS3231 RTC module + SSD1306 I2C LCD display + SD card.
 
[Image: KC868-M16-1_01.jpg]
[Image: KC868-M16-1_02.jpg]
[Image: KC868-M16-1_03.jpg]
[Image: KC868-M16-1_04.jpg]

Print this item