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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 8,310
» Latest member: biofrankpharma
» Forum threads: 3,629
» Forum posts: 18,735

Full Statistics

Online Users
There are currently 68 online users.
» 0 Member(s) | 46 Guest(s)
AhrefsBot, Amazonbot, Bing, Bytespider, Google, PetalBot, Semrush, Yandex, bot

Latest Threads
KC868-M16v2 configure yam...
Forum: KC868-M16 / M1 / MB / M30
Last Post: cmeyer5
6 hours ago
» Replies: 119
» Views: 25,166
Replacing ESP32 with Kinc...
Forum: KC868-A16
Last Post: admin
10 hours ago
» Replies: 1
» Views: 7
N30 Energy entry not work...
Forum: N30
Last Post: admin
10 hours ago
» Replies: 11
» Views: 72
KC868-Server ESP32 Ethern...
Forum: KC868-Server Raspberry Pi4 local server
Last Post: admin
10 hours ago
» Replies: 7
» Views: 65
Single Moment switch
Forum: DIY Project
Last Post: admin
10 hours ago
» Replies: 1
» Views: 12
Help with Product Slectio...
Forum: Suggestions and feedback on KinCony's products
Last Post: admin
Yesterday, 12:06 AM
» Replies: 5
» Views: 58
Loxone RS485
Forum: KinCony integrate with Loxone home automation
Last Post: admin
Yesterday, 12:03 AM
» Replies: 9
» Views: 1,119
adaptor V2 and KC868 h32b...
Forum: KC868-ATC / Tuya adapter V2
Last Post: admin
12-23-2025, 01:19 AM
» Replies: 1
» Views: 18
KC868-A6 - how to connect...
Forum: KC868-A6
Last Post: admin
12-23-2025, 01:18 AM
» Replies: 1
» Views: 16
easy way to export/import...
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
12-23-2025, 01:09 AM
» Replies: 7
» Views: 5,639

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