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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 4,503
» Latest member: sabrinahaven
» Forum threads: 2,287
» Forum posts: 11,895

Full Statistics

Online Users
There are currently 36 online users.
» 2 Member(s) | 23 Guest(s)
Bytespider, Go-http-client, Google, PetalBot, bot, theuscp

Latest Threads
PWM support?
Forum: KC868-A16
Last Post: luis15pt
1 hour ago
» Replies: 6
» Views: 33
KC868 A32 Firmware 2.2.4 ...
Forum: KC868-A32/A32 Pro
Last Post: iozzi_giorgio
7 hours ago
» Replies: 2
» Views: 27
[arduino code examples fo...
Forum: KC868-A32/A32 Pro
Last Post: admin
Today, 05:12 AM
» Replies: 0
» Views: 3
USB ports
Forum: KinCony Server-Mini / Server-16 Raspberry Pi4 relay module
Last Post: BaconRanch
Today, 02:47 AM
» Replies: 2
» Views: 7
Lesson23- How to connect ...
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
Yesterday, 10:11 AM
» Replies: 10
» Views: 7,157
KC868-AG RF - sending rep...
Forum: KC868-A series and Uair Smart Controller
Last Post: PhilW
Yesterday, 07:46 AM
» Replies: 3
» Views: 10
Usar entradas y oled i2c ...
Forum: KC868-A6
Last Post: sistemasyusa
Yesterday, 03:16 AM
» Replies: 4
» Views: 17
a16 as basis for a securi...
Forum: KC868-A16
Last Post: admin
09-18-2024, 11:58 PM
» Replies: 8
» Views: 55
GSM CALL RELAY
Forum: KC868-A2
Last Post: admin
09-18-2024, 11:53 PM
» Replies: 9
» Views: 4,109
KC868-A16S or KC868-A8S
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
09-18-2024, 11:51 PM
» Replies: 3
» Views: 39

  [Arduino source code for KC868-A4S]-06 LAN8720
Posted by: KinCony Support - 03-02-2023, 05:29 AM - Forum: KC868-A4S - No Replies

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

// Set it based on the IP address of the router
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   A4S_Lan8720.zip (Size: 1.07 KB / Downloads: 201)
Print this item

  [Arduino source code for KC868-A4S]-05 DS18B20
Posted by: KinCony Support - 03-02-2023, 05:29 AM - Forum: KC868-A4S - No Replies

Code:
/*KC868-A4S DS18B20 CODE*/
#include <DS18B20.h>
DS18B20 ds1(5);  //channel-1-DS18b20
DS18B20 ds2(14);  //channel-2-DS18b20

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

void loop()
{
  Serial.print("Temperature1:");
  Serial.print(ds1.getTempC());
  Serial.println(" C /");
  delay(100);
  Serial.print("Temperature2:");
  Serial.print(ds2.getTempC());
  Serial.println(" C /\n");
  delay(100); 
}



Attached Files
.zip   A4S_DS18B20.zip (Size: 529 bytes / Downloads: 211)
Print this item

  [Arduino source code for KC868-A4S]-04 DO
Posted by: KinCony Support - 03-02-2023, 05:28 AM - Forum: KC868-A4S - No Replies

Code:
#include "Arduino.h"
#include "PCF8574.h"


#define A4S_SDA 4
#define A4S_SCL 16
TwoWire I2Cone = TwoWire(0);
TwoWire I2Ctwo = TwoWire(1);

PCF8574 pcf8574_RE1(&I2Cone,0x24,A4S_SDA,A4S_SCL);//DO
/*PCF8574 pcf8574_RE2(&I2Cone,0x21,A4S_SDA,A4S_SCL);//DO
PCF8574 pcf8574_IN1(&I2Ctwo,0x22,A4S_SDA,A4S_SCL);//DI
PCF8574 pcf8574_IN2(&I2Ctwo,0x24,A4S_SDA,A4S_SCL);//DI*/


void setup()
{
    Serial.begin(115200);
    pcf8574_RE1.pinMode(P0, OUTPUT);
    pcf8574_RE1.pinMode(P1, OUTPUT);
    pcf8574_RE1.pinMode(P2, OUTPUT);
    pcf8574_RE1.pinMode(P3, OUTPUT);
   
    pcf8574_RE1.pinMode(P4, INPUT);
    pcf8574_RE1.pinMode(P5, INPUT);
    pcf8574_RE1.pinMode(P6, INPUT);
    pcf8574_RE1.pinMode(P7, INPUT);
    pcf8574_RE1.begin();
}

void loop()
{
/* pcf8574_RE1.digitalWrite(P0, HIGH);delay(1000);
  pcf8574_RE1.digitalWrite(P1, HIGH);delay(1000);
  pcf8574_RE1.digitalWrite(P2, HIGH);delay(1000);
  pcf8574_RE1.digitalWrite(P3, HIGH);delay(1000);
 
  pcf8574_RE1.digitalWrite(P0, LOW);delay(1000);
  pcf8574_RE1.digitalWrite(P1, LOW);delay(1000);
  pcf8574_RE1.digitalWrite(P2, LOW);delay(1000);
  pcf8574_RE1.digitalWrite(P3, LOW);delay(1000);*/
 
  if(pcf8574_RE1.digitalRead(P4)==LOW)
  {
    Serial.println("D09 PRESSED");
    pcf8574_RE1.digitalWrite(P0, LOW);
    }else pcf8574_RE1.digitalWrite(P0, HIGH);
    delay (100);
  if(pcf8574_RE1.digitalRead(P5)==LOW)
  {
    Serial.println("D10 PRESSED");
    pcf8574_RE1.digitalWrite(P1, LOW);
    }else pcf8574_RE1.digitalWrite(P1, HIGH);
    delay (100);
  if(pcf8574_RE1.digitalRead(P6)==LOW)
  {
    Serial.println("D11 PRESSED");
    pcf8574_RE1.digitalWrite(P2, LOW);
    }else pcf8574_RE1.digitalWrite(P2, HIGH);
    delay (100);
  if(pcf8574_RE1.digitalRead(P7)==LOW)
  {
    Serial.println("D12 PRESSED");
    pcf8574_RE1.digitalWrite(P3, LOW);
    }else pcf8574_RE1.digitalWrite(P3, HIGH);
    delay (100);
  delay(20);


}



Attached Files
.zip   A4S_DO.zip (Size: 737 bytes / Downloads: 193)
Print this item

  [Arduino source code for KC868-A4S]-03 DI
Posted by: KinCony Support - 03-02-2023, 05:27 AM - Forum: KC868-A4S - No Replies

Code:
#include "Arduino.h"
#include "PCF8574.h"

// Set i2c address
PCF8574 pcf8574_IN1(0x22,4,16);
unsigned long timeElapsed;
void setup()
{
    Serial.begin(115200);
    delay(1000);

pcf8574_IN1.pinMode(P0, INPUT);
pcf8574_IN1.pinMode(P1, INPUT);
pcf8574_IN1.pinMode(P2, INPUT);
pcf8574_IN1.pinMode(P3, INPUT);
pcf8574_IN1.pinMode(P4, INPUT);
pcf8574_IN1.pinMode(P5, INPUT);
pcf8574_IN1.pinMode(P6, INPUT);
pcf8574_IN1.pinMode(P7, INPUT);
pcf8574_IN1.begin();
}

void loop()
{
uint8_t val1 = pcf8574_IN1.digitalRead(P0);
uint8_t val2 = pcf8574_IN1.digitalRead(P1);
uint8_t val3 = pcf8574_IN1.digitalRead(P2);
uint8_t val4 = pcf8574_IN1.digitalRead(P3);
uint8_t val5 = pcf8574_IN1.digitalRead(P4);
uint8_t val6 = pcf8574_IN1.digitalRead(P5);
uint8_t val7 = pcf8574_IN1.digitalRead(P6);
uint8_t val8 = pcf8574_IN1.digitalRead(P7);
if (val1==LOW) {Serial.println("Key1 Pressed");}
if (val2==LOW) {Serial.println("Key2 Pressed");}
if (val3==LOW) {Serial.println("Key3 Pressed");}
if (val4==LOW) {Serial.println("Key4 Pressed");}
if (val5==LOW) {Serial.println("Key5 Pressed");}
if (val6==LOW) {Serial.println("Key6 Pressed");}
if (val7==LOW) {Serial.println("Key7 Pressed");}
if (val8==LOW) {Serial.println("Key8 Pressed");}

delay(20);
}



Attached Files
.zip   A4S_DI.zip (Size: 651 bytes / Downloads: 174)
Print this item

  [Arduino source code for KC868-A4S]-02 ADC
Posted by: KinCony Support - 03-02-2023, 05:25 AM - Forum: KC868-A4S - No Replies

Code:
#include "Arduino.h"

#define ANALOG_A1   36        // IO36 
#define ANALOG_A2   39        // IO39   
#define ANALOG_A3   34        // IO34   
#define ANALOG_A4   35        // IO35

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 A3 on Pin(%d)=%d\n",ANALOG_A3,analogRead(ANALOG_A3));
  Serial.printf("Current Reading A4 on Pin(%d)=%d\n",ANALOG_A4,analogRead(ANALOG_A4));
}



Attached Files
.zip   A4S_ADC.zip (Size: 567 bytes / Downloads: 169)
Print this item

  [Arduino source code for KC868-A4S]-01 RS485
Posted by: KinCony Support - 03-02-2023, 05:23 AM - Forum: KC868-A4S - No Replies

Code:
/*********************************
**********************************/
#define A4S_RS485_RX 33
#define A4S_RS485_TX 32
void setup() {
  Serial.begin(115200);
  pinMode(0,INPUT);
  Serial2.begin(115200,SERIAL_8N1,A4S_RS485_RX,A4S_RS485_TX);//A4S
  Serial2.println("A4S  485 TEST");
}

void loop() {
   if(digitalRead(0)==LOW)
  {
    delay(20);
     if(digitalRead(0)==LOW)
  {
    Serial2.println("Download key ok");
  }
  }
 
  while(Serial2.available()>0)
   {
    Serial2.print((char)Serial2.read());//print rs485 receive
   }
  delay(200);

}



Attached Files
.zip   A4S_485.zip (Size: 582 bytes / Downloads: 189)
Print this item

  A32 Input voltage range
Posted by: Shaps77 - 03-02-2023, 05:16 AM - Forum: KC868-A32/A32 Pro - Replies (5)

What is the acceptable tolerance of the input voltage for the KC868-A32?

Print this item

  lesson34 - how to install Zigbee 3.0 gateway to home assistant
Posted by: admin - 03-02-2023, 02:25 AM - Forum: Home automation training courses - Replies (5)


1. install zigbee2mqtt
https://github.com/zigbee2mqtt/hassio-zigbee2mqtt

2. add config zigbee2mqtt
   
serial:
  port: tcp://192.168.1.201:6638
  adapter: ezsp

3. config (Zigbee Home Automation) ZHA

socket://192.168.1.201:6638
band: 115200
   
   

Print this item

Sad upgrade firmware v1.39 kc868-h32bs
Posted by: mutaz - 03-01-2023, 08:00 AM - Forum: KC868-HxB series Smart Controller - Replies (3)

hi

i have kc868-h32bs v1.39 . 
i'm trying to upgrade the firmware . 
i downloaded KC868 Controller Bootloader and used serial to usb cable to upgrade but every time i run it i get error 
is there a way to upgrade using ethernet? if not what's the solution



Attached Files Thumbnail(s)
   
Print this item

  KC868-A4S 4G esp32 arduino relay board Released
Posted by: admin - 03-01-2023, 06:15 AM - Forum: News - No Replies

KC868-A4S esp32 arduino board based on ESP32 wifi chip, many hardware resource for you to use. it support GSM module for SMS, voice call, GPRS communication. Use SMS or call to turn ON/OFF relay will be very easy for home automation DIY. It also have 8 channel dimmer output and PWM output extender. You can write any code by Arduino IDE to ESP32 wifi/bluetooth/ethernet RS485 module. We will supply demo code for different samples. Everyone can modify and change the code for your own smart home automation system project. it support use by ESPHome for home assistant or tasmota firmware for smart home automation DIY.
[Image: KC868-A4S-1_01.jpg]
[Image: KC868-A4S-1_02.jpg]
[Image: KC868-A4S-1_03.jpg]
[Image: KC868-A4S-1_04.jpg]

Print this item