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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 4,982
» Latest member: kamermcw
» Forum threads: 2,429
» Forum posts: 12,559

Full Statistics

Online Users
There are currently 42 online users.
» 0 Member(s) | 27 Guest(s)
Baidu, Bing, Bytespider, Crawl, Google, PetalBot, Yandex, bot, owler

Latest Threads
Submit your suggestions a...
Forum: Suggestions and feedback on KinCony's products
Last Post: kamermcw
3 hours ago
» Replies: 7
» Views: 3,462
Help whit update Cold CPU...
Forum: KC868-HxB series Smart Controller
Last Post: itzek
6 hours ago
» Replies: 0
» Views: 4
KC868-AIO connecting to E...
Forum: KC868-AIO
Last Post: slava
8 hours ago
» Replies: 0
» Views: 0
DI8
Forum: Development
Last Post: Vaughan2024
Yesterday, 10:24 PM
» Replies: 0
» Views: 14
Clarification on CT Clamp...
Forum: KC868-M16 / M1 / MB / M30
Last Post: ironbill
Yesterday, 09:27 PM
» Replies: 0
» Views: 10
AS ESPHome yaml for home ...
Forum: KinCony AS
Last Post: admin
Yesterday, 12:29 PM
» Replies: 4
» Views: 277
KCS firmware - MQTT LWT?
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
Yesterday, 12:02 PM
» Replies: 34
» Views: 3,310
H32W Firmware
Forum: KC868-HxB series Smart Controller
Last Post: admin
Yesterday, 10:32 AM
» Replies: 5
» Views: 1,607
"KCS" v3.0.2 firmware for...
Forum: "KCS" firmware system
Last Post: admin
Yesterday, 12:00 AM
» Replies: 0
» Views: 40
What makes the ESP32 chip...
Forum: KC868-A series and Uair Smart Controller
Last Post: alice_amira
11-08-2024, 04:38 PM
» Replies: 0
» Views: 4

  [Arduino source code for KC868-A32M]-03_LAN8720_UDP
Posted by: KinCony Support - 05-06-2023, 01:12 AM - Forum: KC868-A32M - No Replies

[Arduino source code for KC868-A32M]-03_LAN8720_UDP

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

  // write confir for static IP, gateway,subnet,dns1,dns2
  if (ETH.config(local_ip, gateway, subnet, dns, dns) == false) {
    Serial.println("LAN8720 Configuration failed.");
  }else{Serial.println("LAN8720 Configuration success.");}
 
/* while(!((uint32_t)ETH.localIP())) //wait for IP
  {

  }*/
  Serial.println("Connected");
  Serial.print("IP Address:");
  Serial.println(ETH.localIP());

  Udp.begin(localUdpPort); //begin UDP listener
}

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-A32M_LAN8720_UDP.zip (Size: 1.11 KB / Downloads: 163)
Print this item

  [Arduino source code for KC868-A32M]-02_IR_receive_code
Posted by: KinCony Support - 05-06-2023, 01:11 AM - Forum: KC868-A32M - No Replies

[Arduino source code for KC868-A32M]-02_IR_receive_code

Code:
#include <IRremote.h>
IRrecv irrecv_16(16);// set ir_receive pin IO16
void setup() {

  Serial.begin(115200);
  irrecv_16.enableIRIn();
}

void loop() {
    if (irrecv_16.decode()) {
      if(irrecv_16.decodedIRData.decodedRawData!=(0)){
        Serial.print("irCode address: ");           
        Serial.println(irrecv_16.decodedIRData.address,HEX);
        Serial.print("irCode command: ");           
        Serial.println(irrecv_16.decodedIRData.command,HEX);
        Serial.print("irCode decodedRawData: ");           
        Serial.println(irrecv_16.decodedIRData.decodedRawData,HEX);
      }
      IrReceiver.resume();
    }
}
   



Attached Files
.zip   KC868-A32M_IR_receive_code.zip (Size: 673 bytes / Downloads: 165)
Print this item

  [Arduino source code for KC868-A32M]-01_DS3231_RTC
Posted by: KinCony Support - 05-06-2023, 01:09 AM - Forum: KC868-A32M - No Replies

[Arduino source code for KC868-A32M]-01_DS3231_RTC

Code:
// KC868-A32M  RTC CODE DS3231

#include <Wire.h>
#include "RTClib.h"

#define SDA 4
#define SCL 5
RTC_DS3231 myRTC;

void setup () {
    Serial.begin(115200);
    Wire.begin(SDA,SCL);
    delay(500);
    myRTC.begin();
    myRTC.adjust(DateTime(F(__DATE__), F(__TIME__)));
}

void loop () {
     
    DateTime now = myRTC.now();
    Serial.printf("%02d/%02d/%02d  %02d:%02d:%02d\n",
                                          now.year(),
                                          now.month(),
                                          now.day(),
                                          now.hour(),
                                          now.minute(),
                                          now.second());
   delay(1000);
   

   
}



Attached Files
.zip   KC868-A32M_DS3231_RTC.zip (Size: 689 bytes / Downloads: 181)
Print this item

  [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: 231)
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: 183)
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: 234)
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" 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