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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 5,369
» Latest member: talljane
» Forum threads: 2,574
» Forum posts: 13,305

Full Statistics

Online Users
There are currently 51 online users.
» 0 Member(s) | 30 Guest(s)
AhrefsBot, Bing, Bytespider, Crawl, Go-http-client, Google, PetalBot, Semrush, bot

Latest Threads
KC868-A2 ESP32 I/O pin de...
Forum: KC868-A2
Last Post: tugra
3 hours ago
» Replies: 7
» Views: 2,261
change wake up name
Forum: KinCony AS
Last Post: gal
11 hours ago
» Replies: 12
» Views: 78
A32 Pro ESPHome yaml incl...
Forum: KC868-A32/A32 Pro
Last Post: xarouli5
Today, 06:38 AM
» Replies: 17
» Views: 181
Need help with configurat...
Forum: KC868-HxB series Smart Controller
Last Post: admin
Today, 04:32 AM
» Replies: 32
» Views: 393
ESP32 S3 set up issue
Forum: Extender module
Last Post: admin
Yesterday, 11:43 PM
» Replies: 10
» Views: 66
KC868-A8 Schematic
Forum: KC868-A8
Last Post: admin
Yesterday, 11:40 PM
» Replies: 7
» Views: 49
"KCS" v2.2.8 firmware BIN...
Forum: "KCS" firmware system
Last Post: admin
Yesterday, 11:38 PM
» Replies: 2
» Views: 172
Dimensions/drawings of bo...
Forum: Schematic and diagram
Last Post: admin
Yesterday, 11:37 PM
» Replies: 1
» Views: 23
how to use AS ESP32-S3 vo...
Forum: KinCony AS
Last Post: admin
12-16-2024, 10:55 PM
» Replies: 12
» Views: 448
Problem with IFTTT automa...
Forum: "KCS" firmware system
Last Post: admin
12-16-2024, 10:53 PM
» Replies: 5
» Views: 34

  Lesson8 - install Mosquitto broker on home assistant
Posted by: admin - 03-27-2022, 03:29 AM - Forum: Home automation training courses - No Replies


1. MQTT structure

   

   

2. Install mosquito MQTT broker on home assistant

   

Configuration:

logins:
  - username: mqtt
    password: '123'
customize:
  active: false
  folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false

Note: username and password just replace by yourself.

3. MQTT communication
   


4. MQTT communication test

Configuration-->Devices & Services --> Mosquitto broker "CONFIGURE"
   

Print this item

Wink [Arduino IDE demo source code for KC868-A32]--#06-RS485
Posted by: KinCony Support - 03-24-2022, 07:03 AM - Forum: KC868-A32/A32 Pro - Replies (1)

Code:
void setup() {
 Serial1.begin(9600);    //Serial 1
}

void loop() {
Serial1.println("KinCony");
delay(1500);
}

Print this item

Wink [Arduino IDE demo source code for KC868-A32]--#05-PCF8574-DO
Posted by: KinCony Support - 03-24-2022, 06:59 AM - Forum: KC868-A32/A32 Pro - No Replies

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

TwoWire I2Ctwo = TwoWire(1);

// Set i2c address
PCF8574 pcf8574_R1(&I2Ctwo, 0x24, 15, 13);
PCF8574 pcf8574_R2(&I2Ctwo, 0x25, 15, 13);
PCF8574 pcf8574_R3(&I2Ctwo, 0x21, 15, 13);
PCF8574 pcf8574_R4(&I2Ctwo, 0x22, 15, 13);

void setup()
{
    Serial.begin(115200);
//    delay(1000);

    // Set pinMode to OUTPUT
pcf8574_R1.pinMode(P0, OUTPUT);
pcf8574_R1.pinMode(P1, OUTPUT);
pcf8574_R1.pinMode(P2, OUTPUT);
pcf8574_R1.pinMode(P3, OUTPUT);
pcf8574_R1.pinMode(P4, OUTPUT);
pcf8574_R1.pinMode(P5, OUTPUT);
pcf8574_R1.pinMode(P6, OUTPUT);
pcf8574_R1.pinMode(P7, OUTPUT);

pcf8574_R2.pinMode(P0, OUTPUT);
pcf8574_R2.pinMode(P1, OUTPUT);
pcf8574_R2.pinMode(P2, OUTPUT);
pcf8574_R2.pinMode(P3, OUTPUT);
pcf8574_R2.pinMode(P4, OUTPUT);
pcf8574_R2.pinMode(P5, OUTPUT);
pcf8574_R2.pinMode(P6, OUTPUT);
pcf8574_R2.pinMode(P7, OUTPUT);

pcf8574_R3.pinMode(P0, OUTPUT);
pcf8574_R3.pinMode(P1, OUTPUT);
pcf8574_R3.pinMode(P2, OUTPUT);
pcf8574_R3.pinMode(P3, OUTPUT);
pcf8574_R3.pinMode(P4, OUTPUT);
pcf8574_R3.pinMode(P5, OUTPUT);
pcf8574_R3.pinMode(P6, OUTPUT);
pcf8574_R3.pinMode(P7, OUTPUT);

pcf8574_R4.pinMode(P0, OUTPUT);
pcf8574_R4.pinMode(P1, OUTPUT);
pcf8574_R4.pinMode(P2, OUTPUT);
pcf8574_R4.pinMode(P3, OUTPUT);
pcf8574_R4.pinMode(P4, OUTPUT);
pcf8574_R4.pinMode(P5, OUTPUT);
pcf8574_R4.pinMode(P6, OUTPUT);
pcf8574_R4.pinMode(P7, OUTPUT);

    Serial.print("Init pcf8574_R1...");
    if (pcf8574_R1.begin()){
        Serial.println("PCF8574_R1_OK");
    }else{
        Serial.println("PCF8574_R1_KO");
    }

  Serial.print("Init pcf8574_R2...");
  if (pcf8574_R2.begin()){
    Serial.println("PCF8574_R2_OK");
  }else{
    Serial.println("PCF8574_R2_KO");
  }

  Serial.print("Init pcf8574_R3...");
  if (pcf8574_R3.begin()){
    Serial.println("PCF8574_R3_OK");
  }else{
    Serial.println("PCF8574_R3_KO");
  }

  Serial.print("Init pcf8574_R4...");
  if (pcf8574_R4.begin()){
    Serial.println("PCF8574_R4_OK");
  }else{
    Serial.println("PCF8574_R4_KO");
  }



}

void loop()
{
    pcf8574_R1.digitalWrite(P0, LOW);
  delay(200);
  pcf8574_R1.digitalWrite(P1, LOW);
  delay(200);
  pcf8574_R1.digitalWrite(P2, LOW);
  delay(200);
  pcf8574_R1.digitalWrite(P3, LOW);
  delay(200);
  pcf8574_R1.digitalWrite(P4, LOW);
  delay(200);
  pcf8574_R1.digitalWrite(P5, LOW);
  delay(200);
  pcf8574_R1.digitalWrite(P6, LOW);
  delay(200);
  pcf8574_R1.digitalWrite(P7, LOW);
  delay(200);

  pcf8574_R2.digitalWrite(P0, LOW);
  delay(200);
  pcf8574_R2.digitalWrite(P1, LOW);
  delay(200);
  pcf8574_R2.digitalWrite(P2, LOW);
  delay(200);
  pcf8574_R2.digitalWrite(P3, LOW);
  delay(200);
  pcf8574_R2.digitalWrite(P4, LOW);
  delay(200);
  pcf8574_R2.digitalWrite(P5, LOW);
  delay(200);
  pcf8574_R2.digitalWrite(P6, LOW);
  delay(200);
  pcf8574_R2.digitalWrite(P7, LOW);
  delay(200);

  pcf8574_R3.digitalWrite(P0, LOW);
  delay(200);
  pcf8574_R3.digitalWrite(P1, LOW);
  delay(200);
  pcf8574_R3.digitalWrite(P2, LOW);
  delay(200);
  pcf8574_R3.digitalWrite(P3, LOW);
  delay(200);
  pcf8574_R3.digitalWrite(P4, LOW);
  delay(200);
  pcf8574_R3.digitalWrite(P5, LOW);
  delay(200);
  pcf8574_R3.digitalWrite(P6, LOW);
  delay(200);
  pcf8574_R3.digitalWrite(P7, LOW);
  delay(200);

  pcf8574_R4.digitalWrite(P0, LOW);
  delay(200);
  pcf8574_R4.digitalWrite(P1, LOW);
  delay(200);
  pcf8574_R4.digitalWrite(P2, LOW);
  delay(200);
  pcf8574_R4.digitalWrite(P3, LOW);
  delay(200);
  pcf8574_R4.digitalWrite(P4, LOW);
  delay(200);
  pcf8574_R4.digitalWrite(P5, LOW);
  delay(200);
  pcf8574_R4.digitalWrite(P6, LOW);
  delay(200);
  pcf8574_R4.digitalWrite(P7, LOW);
  delay(200);
}
       

Print this item

Wink [Arduino IDE demo source code for KC868-A32]--#04-PCF8574-DI
Posted by: KinCony Support - 03-24-2022, 06:53 AM - Forum: KC868-A32/A32 Pro - No Replies

Code:
/*
KeyPressed on PIN1
by Mischianti Renzo <http://www.mischianti.org>

https://www.mischianti.org/2019/01/02/pcf8574-i2c-digital-i-o-expander-fast-easy-usage/
*/

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


// Instantiate Wire for generic use at 400kHz
TwoWire I2Cone = TwoWire(0);
// Instantiate Wire for generic use at 100kHz
TwoWire I2Ctwo = TwoWire(1);

// Set i2c address
PCF8574 pcf8574_I1(0x24);
PCF8574 pcf8574_I2(0x25);
PCF8574 pcf8574_I3(0x21);
PCF8574 pcf8574_I4(0x22);



unsigned long timeElapsed;
void setup()
{
    Serial.begin(115200);
    delay(1000);

//    pcf8574.pinMode(P0, OUTPUT);
pcf8574_I1.pinMode(P0, INPUT);
pcf8574_I1.pinMode(P1, INPUT);
pcf8574_I1.pinMode(P2, INPUT);
pcf8574_I1.pinMode(P3, INPUT);
pcf8574_I1.pinMode(P4, INPUT);
pcf8574_I1.pinMode(P5, INPUT);
pcf8574_I1.pinMode(P6, INPUT);
pcf8574_I1.pinMode(P7, INPUT);

pcf8574_I2.pinMode(P0, INPUT);
pcf8574_I2.pinMode(P1, INPUT);
pcf8574_I2.pinMode(P2, INPUT);
pcf8574_I2.pinMode(P3, INPUT);
pcf8574_I2.pinMode(P4, INPUT);
pcf8574_I2.pinMode(P5, INPUT);
pcf8574_I2.pinMode(P6, INPUT);
pcf8574_I2.pinMode(P7, INPUT);

pcf8574_I3.pinMode(P0, INPUT);
pcf8574_I3.pinMode(P1, INPUT);
pcf8574_I3.pinMode(P2, INPUT);
pcf8574_I3.pinMode(P3, INPUT);
pcf8574_I3.pinMode(P4, INPUT);
pcf8574_I3.pinMode(P5, INPUT);
pcf8574_I3.pinMode(P6, INPUT);
pcf8574_I3.pinMode(P7, INPUT);

pcf8574_I4.pinMode(P0, INPUT);
pcf8574_I4.pinMode(P1, INPUT);
pcf8574_I4.pinMode(P2, INPUT);
pcf8574_I4.pinMode(P3, INPUT);
pcf8574_I4.pinMode(P4, INPUT);
pcf8574_I4.pinMode(P5, INPUT);
pcf8574_I4.pinMode(P6, INPUT);
pcf8574_I4.pinMode(P7, INPUT);



    Serial.print("Init pcf8574...");
    if (pcf8574_I1.begin()){
        Serial.println("pcf8574_I1_OK");
    }else{
        Serial.println("pcf8574_I1_KO");
    }

  Serial.print("Init pcf8574...");
  if (pcf8574_I2.begin()){
    Serial.println("pcf8574_I2_OK");
  }else{
    Serial.println("pcf8574_I2_KO");
  }

  Serial.print("Init pcf8574_I3...");
  if (pcf8574_I3.begin()){
    Serial.println("pcf8574_I3_OK");
  }else{
    Serial.println("pcf8574_I3_KO");
  }

  Serial.print("Init pcf8574_I4...");
  if (pcf8574_I4.begin()){
    Serial.println("pcf8574_I4_OK");
  }else{
    Serial.println("pcf8574_I4_KO");
  }

}

void loop()
{
uint8_t val1 = pcf8574_I1.digitalRead(P0);
uint8_t val2 = pcf8574_I1.digitalRead(P1);
uint8_t val3 = pcf8574_I1.digitalRead(P2);
uint8_t val4 = pcf8574_I1.digitalRead(P3);
uint8_t val5 = pcf8574_I1.digitalRead(P4);
uint8_t val6 = pcf8574_I1.digitalRead(P5);
uint8_t val7 = pcf8574_I1.digitalRead(P6);
uint8_t val8 = pcf8574_I1.digitalRead(P7);

uint8_t val9 = pcf8574_I2.digitalRead(P0);
uint8_t val10 = pcf8574_I2.digitalRead(P1);
uint8_t val11 = pcf8574_I2.digitalRead(P2);
uint8_t val12 = pcf8574_I2.digitalRead(P3);
uint8_t val13 = pcf8574_I2.digitalRead(P4);
uint8_t val14 = pcf8574_I2.digitalRead(P5);
uint8_t val15 = pcf8574_I2.digitalRead(P6);
uint8_t val16 = pcf8574_I2.digitalRead(P7);


uint8_t val17 = pcf8574_I3.digitalRead(P0);
uint8_t val18 = pcf8574_I3.digitalRead(P1);
uint8_t val19 = pcf8574_I3.digitalRead(P2);
uint8_t val20 = pcf8574_I3.digitalRead(P3);
uint8_t val21 = pcf8574_I3.digitalRead(P4);
uint8_t val22 = pcf8574_I3.digitalRead(P5);
uint8_t val23 = pcf8574_I3.digitalRead(P6);
uint8_t val24 = pcf8574_I3.digitalRead(P7);


uint8_t val25 = pcf8574_I4.digitalRead(P0);
uint8_t val26 = pcf8574_I4.digitalRead(P1);
uint8_t val27 = pcf8574_I4.digitalRead(P2);
uint8_t val28 = pcf8574_I4.digitalRead(P3);
uint8_t val29 = pcf8574_I4.digitalRead(P4);
uint8_t val30 = pcf8574_I4.digitalRead(P5);
uint8_t val31 = pcf8574_I4.digitalRead(P6);
uint8_t val32 = pcf8574_I4.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");

if (val9==LOW) Serial.println("KEY9 PRESSED");
if (val10==LOW) Serial.println("KEY10 PRESSED");
if (val11==LOW) Serial.println("KEY11 PRESSED");
if (val12==LOW) Serial.println("KEY12 PRESSED");
if (val13==LOW) Serial.println("KEY13 PRESSED");
if (val14==LOW) Serial.println("KEY14 PRESSED");
if (val15==LOW) Serial.println("KEY15 PRESSED");
if (val16==LOW) Serial.println("KEY16 PRESSED");

if (val17==LOW) Serial.println("KEY17 PRESSED");
if (val18==LOW) Serial.println("KEY18 PRESSED");
if (val19==LOW) Serial.println("KEY19 PRESSED");
if (val20==LOW) Serial.println("KEY20 PRESSED");
if (val21==LOW) Serial.println("KEY21 PRESSED");
if (val22==LOW) Serial.println("KEY22 PRESSED");
if (val23==LOW) Serial.println("KEY23 PRESSED");
if (val24==LOW) Serial.println("KEY24 PRESSED");

if (val25==LOW) Serial.println("KEY25 PRESSED");
if (val26==LOW) Serial.println("KEY26 PRESSED");
if (val27==LOW) Serial.println("KEY27 PRESSED");
if (val28==LOW) Serial.println("KEY28 PRESSED");
if (val29==LOW) Serial.println("KEY29 PRESSED");
if (val30==LOW) Serial.println("KEY30 PRESSED");
if (val31==LOW) Serial.println("KEY31 PRESSED");
if (val32==LOW) Serial.println("KEY32 PRESSED");
    delay(300);
}
       

Print this item

Wink [Arduino IDE demo source code for KC868-A32]--#03-Nextion TFT LCD Display
Posted by: KinCony Support - 03-24-2022, 06:34 AM - Forum: KC868-A32/A32 Pro - No Replies

Code:
int i=0;

void setup()
{
Serial2.begin(9600);
}

void loop()
{
i++;
if (i==100) i=0;

Serial2.print("n0.val=");
Serial2.print(i);
Serial2.write(0xff);
Serial2.write(0xff);
Serial2.write(0xff);
delay(200);

}
   

Print this item

Wink [Arduino IDE demo source code for KC868-A32]--#02-LAN8720_UDP
Posted by: KinCony Support - 03-24-2022, 06:29 AM - Forum: KC868-A32/A32 Pro - 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
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
  }
}
   

Print this item

Wink [Arduino IDE demo source code for KC868-A32]--#01-ADC_INOUT
Posted by: KinCony Support - 03-24-2022, 06:22 AM - Forum: KC868-A32/A32 Pro - No Replies

Code:
#include "Arduino.h"

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

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

Print this item

  KC868-A32 configure for ESPhome
Posted by: admin - 03-23-2022, 12:36 PM - Forum: KC868-A32/A32 Pro - Replies (16)

esphome:
  name: a32
  platform: ESP32
  board: esp32dev


# Enable logging
logger:

# Enable Home Assistant API
api:


# Example configuration entry
i2c:
  - id: bus_a
    sda: 15
    scl: 13
    scan: true
  - id: bus_b
    sda: 4
    scl: 5
    scan: true
   

# Example configuration entry
ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0

# Example configuration entry
pcf8574:
  - id: 'pcf8574_hub_out_1'  # for output channel 1-8
    i2c_id: bus_a
    address: 0x24

  - id: 'pcf8574_hub_out_2'  # for output channel 9-16
    i2c_id: bus_a
    address: 0x25

  - id: 'pcf8574_hub_out_3'  # for output channel 17-24
    i2c_id: bus_a
    address: 0x21

  - id: 'pcf8574_hub_out_4'  # for output channel 25-32
    i2c_id: bus_a
    address: 0x22
   
  - id: 'pcf8574_hub_in_1'  # for input channel 1-8
    i2c_id: bus_b
    address: 0x24

  - id: 'pcf8574_hub_in_2'  # for input channel 9-16
    i2c_id: bus_b
    address: 0x25

  - id: 'pcf8574_hub_in_3'  # for input channel 17-24
    i2c_id: bus_b
    address: 0x21

  - id: 'pcf8574_hub_in_4'  # for input channel 25-32
    i2c_id: bus_b
    address: 0x22   
   
# Individual outputs
switch:
  - platform: gpio
    name: "light1"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 0
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light2"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 1
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light3"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 2
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light4"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 3
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "light5"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 4
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light6"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 5
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light7"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 6
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light8"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 7
      mode: OUTPUT
      inverted: true


  - platform: gpio
    name: "light9"
    pin:
      pcf8574: pcf8574_hub_out_2
      number: 0
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light10"
    pin:
      pcf8574: pcf8574_hub_out_2
      number: 1
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light11"
    pin:
      pcf8574: pcf8574_hub_out_2
      number: 2
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light12"
    pin:
      pcf8574: pcf8574_hub_out_2
      number: 3
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "light13"
    pin:
      pcf8574: pcf8574_hub_out_2
      number: 4
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light14"
    pin:
      pcf8574: pcf8574_hub_out_2
      number: 5
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light15"
    pin:
      pcf8574: pcf8574_hub_out_2
      number: 6
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light16"
    pin:
      pcf8574: pcf8574_hub_out_2
      number: 7
      mode: OUTPUT
      inverted: true
     
     
  - platform: gpio
    name: "light17"
    pin:
      pcf8574: pcf8574_hub_out_3
      number: 0
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light18"
    pin:
      pcf8574: pcf8574_hub_out_3
      number: 1
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light19"
    pin:
      pcf8574: pcf8574_hub_out_3
      number: 2
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light20"
    pin:
      pcf8574: pcf8574_hub_out_3
      number: 3
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "light21"
    pin:
      pcf8574: pcf8574_hub_out_3
      number: 4
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light22"
    pin:
      pcf8574: pcf8574_hub_out_3
      number: 5
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light23"
    pin:
      pcf8574: pcf8574_hub_out_3
      number: 6
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light24"
    pin:
      pcf8574: pcf8574_hub_out_3
      number: 7
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "light25"
    pin:
      pcf8574: pcf8574_hub_out_4
      number: 0
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light26"
    pin:
      pcf8574: pcf8574_hub_out_4
      number: 1
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light27"
    pin:
      pcf8574: pcf8574_hub_out_4
      number: 2
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light28"
    pin:
      pcf8574: pcf8574_hub_out_4
      number: 3
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "light29"
    pin:
      pcf8574: pcf8574_hub_out_4
      number: 4
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light30"
    pin:
      pcf8574: pcf8574_hub_out_4
      number: 5
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light31"
    pin:
      pcf8574: pcf8574_hub_out_4
      number: 6
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light32"
    pin:
      pcf8574: pcf8574_hub_out_4
      number: 7
      mode: OUTPUT
      inverted: true
     
     
     
# Individual outputs
binary_sensor:
  - platform: gpio
    name: "input1"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 0
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input2"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 1
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input3"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 2
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input4"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 3
      mode: INPUT
      inverted: true
     
  - platform: gpio
    name: "input5"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 4
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input6"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 5
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input7"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 6
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input8"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 7
      mode: INPUT
      inverted: true


  - platform: gpio
    name: "input9"
    pin:
      pcf8574: pcf8574_hub_in_2
      number: 0
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input10"
    pin:
      pcf8574: pcf8574_hub_in_2
      number: 1
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input11"
    pin:
      pcf8574: pcf8574_hub_in_2
      number: 2
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input12"
    pin:
      pcf8574: pcf8574_hub_in_2
      number: 3
      mode: INPUT
      inverted: true
     
  - platform: gpio
    name: "input13"
    pin:
      pcf8574: pcf8574_hub_in_2
      number: 4
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input14"
    pin:
      pcf8574: pcf8574_hub_in_2
      number: 5
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input15"
    pin:
      pcf8574: pcf8574_hub_in_2
      number: 6
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input16"
    pin:
      pcf8574: pcf8574_hub_in_2
      number: 7
      mode: INPUT
      inverted: true
     
     
  - platform: gpio
    name: "input17"
    pin:
      pcf8574: pcf8574_hub_in_3
      number: 0
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input18"
    pin:
      pcf8574: pcf8574_hub_in_3
      number: 1
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input19"
    pin:
      pcf8574: pcf8574_hub_in_3
      number: 2
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input20"
    pin:
      pcf8574: pcf8574_hub_in_3
      number: 3
      mode: INPUT
      inverted: true
     
  - platform: gpio
    name: "input21"
    pin:
      pcf8574: pcf8574_hub_in_3
      number: 4
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input22"
    pin:
      pcf8574: pcf8574_hub_in_3
      number: 5
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input23"
    pin:
      pcf8574: pcf8574_hub_in_3
      number: 6
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input24"
    pin:
      pcf8574: pcf8574_hub_in_3
      number: 7
      mode: INPUT
      inverted: true
     
  - platform: gpio
    name: "input25"
    pin:
      pcf8574: pcf8574_hub_in_4
      number: 0
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input26"
    pin:
      pcf8574: pcf8574_hub_in_4
      number: 1
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input27"
    pin:
      pcf8574: pcf8574_hub_in_4
      number: 2
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input28"
    pin:
      pcf8574: pcf8574_hub_in_4
      number: 3
      mode: INPUT
      inverted: true
     
  - platform: gpio
    name: "input29"
    pin:
      pcf8574: pcf8574_hub_in_4
      number: 4
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input30"
    pin:
      pcf8574: pcf8574_hub_in_4
      number: 5
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input31"
    pin:
      pcf8574: pcf8574_hub_in_4
      number: 6
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input32"
    pin:
      pcf8574: pcf8574_hub_in_4
      number: 7
      mode: INPUT
      inverted: true

# Example configuration entry
sensor:
  - platform: adc
    pin: 39
    name: "analog-1"
    update_interval: 10s
    attenuation: 11db

  - platform: adc
    pin: 34
    name: "analog-2"
    update_interval: 10s
    attenuation: 11db
   
  - platform: adc
    pin: 36
    name: "analog-3"
    update_interval: 10s
    attenuation: 11db
   
  - platform: adc
    pin: 35
    name: "analog-4"
    update_interval: 10s
    attenuation: 11db

Print this item

  KC868-A32 ESP32 I/O pin define
Posted by: admin - 03-23-2022, 12:35 PM - Forum: KC868-A32/A32 Pro - No Replies

#define ANALOG_A1  GPIO39
#define ANALOG_A2  GPIO34
#define ANALOG_A3  GPIO36
#define ANALOG_A4  GPIO35

IIC Bus:A

SDA-A:GPIO15
SCL-A:GPIO13

PCF8574:U16 (relay1-8): 100 100 = 0x24
PCF8574:U32 (relay9-16): 100 101 = 0x25
PCF8574:U58 (relay17-24): 100 001 = 0x21
PCF8574:U59 (relay25-32): 100 010 = 0x22

IIC Bus:B
SDA-B:GPIO4
SCL-B:GPIO5

PCF8574:U14 (DI1-8): 100 100 = 0x24
PCF8574:U31 (DI9-16): 100 101 = 0x25
PCF8574:U56 (DI17-24): 100 001 = 0x21
PCF8574:U57 (DI25-32): 100 010 = 0x22

-----------------

Ethernet (LAN8720) I/O define:

#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

--------------------

RS485:
RXD:GPIO16
TXD:GPIO14

Extend serial port (3.3v TTL level):
RXD:GPIO33
TXD:GPIO32

Print this item

  KC868-A32 schematic diagram download
Posted by: admin - 03-23-2022, 12:34 PM - Forum: KC868-A32/A32 Pro - No Replies

https://www.kincony.com/download/KC868-A...ematic.pdf

Print this item