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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 4,499
» Latest member: seoaimpoint
» Forum threads: 2,287
» Forum posts: 11,890

Full Statistics

Online Users
There are currently 38 online users.
» 2 Member(s) | 24 Guest(s)
Bing, ChatGLM-Spider, Crawl, Facebook, Google, PetalBot, bot, facebookexternalhit, seoaimpoint

Latest Threads
PWM support?
Forum: KC868-A16
Last Post: luis15pt
1 hour ago
» Replies: 2
» Views: 16
[arduino code examples fo...
Forum: KC868-A32/A32 Pro
Last Post: admin
4 hours ago
» Replies: 0
» Views: 3
USB ports
Forum: KinCony Server-Mini / Server-16 Raspberry Pi4 relay module
Last Post: BaconRanch
6 hours ago
» Replies: 2
» Views: 6
Lesson23- How to connect ...
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
Yesterday, 10:11 AM
» Replies: 10
» Views: 7,155
KC868-AG RF - sending rep...
Forum: KC868-A series and Uair Smart Controller
Last Post: PhilW
Yesterday, 07:46 AM
» Replies: 3
» Views: 9
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: 54
GSM CALL RELAY
Forum: KC868-A2
Last Post: admin
09-18-2024, 11:53 PM
» Replies: 9
» Views: 4,108
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: 38
KCS firmware
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
09-18-2024, 11:48 PM
» Replies: 10
» Views: 114

  Trouble controlling the H100 Inverter using RS485 Protocol
Posted by: shaolink - 06-22-2023, 06:48 PM - Forum: DIY Project - Replies (9)

I was following this video 

how to control VFD (Variable Frequency Drive) inverter by KC868-COLB - YouTube

And wrote this code to control my H100 Inverter ( How to: H100 VFD & 1.5KW Air-Cooled Spindle Setup - Zhong Hua Jiang - How To - Carbide 3D Community Site)

import serial

def calculate_crc(data):
    reg_crc = 0xFFFF
    for byte in data:
        reg_crc ^= byte
        for _ in range(8):
            if reg_crc & 0x0001:
                reg_crc = (reg_crc >> 1) ^ 0xA001
            else:
                reg_crc >>= 1
    return reg_crc

# RS485 port settings
rs485_port = 'COM12'
rs485_baud_rate = 115200
rs485_parity = serial.PARITY_NONE
rs485_stop_bits = serial.STOPBITS_ONE
rs485_data_bits = serial.EIGHTBITS

try:
    # Open the RS485 serial port
    ser = serial.Serial(
        port=rs485_port,
        baudrate=rs485_baud_rate,
        parity=rs485_parity,
        stopbits=rs485_stop_bits,
        bytesize=rs485_data_bits,
        timeout=1
    )

    # Send a command via RS485 in RTU mode
    command = [0x64, 0x01, 0x02, 0x20, 0x00, 0x00, 0x01, 0x43, 0xCA]  # Modify the command in hexadecimal format
    crc = calculate_crc(command)
    command.append(crc & 0xFF)  # Low byte
    command.append((crc >> 8) & 0xFF)  # High byte
    ser.write(bytes(command))

    # Read the RS485 response
    response_rs485 = ser.readline()
    hex_response_rs485 = ' '.join(hex(byte) for byte in response_rs485)
    print("RS485 Response:", hex_response_rs485)

    # Close the RS485 serial port
    ser.close()

except serial.SerialException as e:
    print("Error opening or accessing the serial port:", str(e))

This is the code I wrote. The checksum passes, and everything else is fine. But when I run the code, it doesn't reflect any changes on the Inverter/ Motor. Please help.

The connections on the RS485 can be found in the images attached below.

Please help! Thanks in advance.



Attached Files Thumbnail(s)
       
Print this item

  Request a free sample
Posted by: marekduzi - 06-22-2023, 05:41 AM - Forum: Apply for free sample product - No Replies

Dobrý den,
chtěl bych získat zkušební bezplatný vzorek ovladače KC868-A4. Pracuji jako elektrikář v automobilovém průmyslu nákladních automobilů, kde jsme také prodejci značek TATRA Trucks CZECH a dále speciální nástavby na přání, kde jsme museli požádat o jinou firmu o vývoj hardwaru a pro daný typ zákazníka. Díky Vašemu ovladači bychom tyto věci zvládli sami a určitě bychom dokázali další udělat na nákup více kusů a vašich zařízení. Velmi bych ocenil vzorek zdarma.Heart

Print this item

  KC868-1U ESP32 DIY PCB Board released
Posted by: admin - 06-22-2023, 01:00 AM - Forum: News - No Replies

KC868-1U is a esp32 diy pcb board. it can install to 1U size box, let your relay controller become smart. if you have a power sequencer, KC868-1U will easy connect it, so that smart control your rack power strip. You can DIY one smart power sequencer. It will support arduino IDE, home assistant by ESPHome, also support Tasmota open source home automation platform.
[Image: KC868-1U-1_01.jpg]
[Image: KC868-1U-1_02.jpg]
[Image: KC868-1U-1_03.jpg]

Print this item

  KinCony KC868-AP Modbus using in Esphome not working
Posted by: nikhuge - 06-21-2023, 09:59 PM - Forum: KC868-A series and Uair Smart Controller - Replies (1)

i am trying to configure a Light/humidity/temperature modbus sensor with kincony Ap modbus port in esphome. below is my configuration and sensor data sheet is attached,I am getting this error in the esphome logs



"No response recieved removed from send queue"


Can point what I am doing wrong.


Code:
esphome:
  name: kincony-esp32-dimmer
  friendly_name: Kincony-Esp32-Dimmer

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "7p6IWmIbZjSt7YFWX2bKaCBB1bTmhraTZo+P4cV7BoE="

ota:
  password: "2aa38947ee1ec3376d4e0b941ce919da"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Kincony-Esp32-Dimmer"
    password: "uIm62IkfOTJ0"

captive_portal:

web_server:
  port: 80

#Modbus Configuration for Sensors
uart:
  id: mbus
  tx_pin: GPIO33
  rx_pin: GPIO14
  baud_rate: 9600

modbus:
  id: modbus1
  uart_id: mbus
  send_wait_time: 200ms

modbus_controller:
- id: light_sensor1
  address: 1
  modbus_id: modbus1
  update_interval: 1s


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

# Example configuration entry for ESP32
i2c:
  sda: 4
  scl: 16
  scan: true
  id: bus_a

pcf8574:
  - id: 'pcf8574_hub_in_1'  # for input channel 1-8    maybe 0x22  /  0x3A
    address: 0x3A

  - id: 'pcf8574_hub_in_2'  # for input channel 9-16
    address: 0x21




sensor:

  - platform: modbus_controller
    modbus_controller_id: light_sensor1
    id: light_intensity
    name: "Light Intensity"
    address: 0x02
    unit_of_measurement: "Lux" ## for any other unit the value is returned in minutes
    register_type: read
    value_type: U_WORD
    accuracy_decimals: 1


  - platform: modbus_controller
    modbus_controller_id: light_sensor1
    id: temp
    name: "Temperature"
    address: 0x01
    unit_of_measurement: "C" ## for any other unit the value is returned in minutes
    register_type: read
    value_type: U_WORD
    accuracy_decimals: 1

  - platform: modbus_controller
    modbus_controller_id: light_sensor1
    id: humidity
    name: "Humidity"
    address: 0x00
    unit_of_measurement: "%" ## for any other unit the value is returned in minutes
    register_type: read
    value_type: U_WORD
    accuracy_decimals: 1

binary_sensor:
  - platform: gpio
    name: "ap-input1"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 0
      mode: INPUT
      inverted: true

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  - platform: gpio
    name: "ap-input17"
    pin:
      number: 34
      inverted: true

  - platform: gpio
    name: "ap-input18"
    pin:
      number: 35
      inverted: true

pca9685:
    id: 'pca9685_hub'
    frequency: 500

output:
  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM0"
    channel: 0

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM1"
    channel: 1

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM2"
    channel: 2

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM3"
    channel: 3

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM4"
    channel: 4

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM5"
    channel: 5

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM6"
    channel: 6

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM7"
    channel: 7

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM8"
    channel: 8

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM9"
    channel: 9

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM10"
    channel: 10

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM11"
    channel: 11

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM12"
    channel: 12

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM13"
    channel: 13

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM14"
    channel: 14

  - platform: pca9685
    pca9685_id: 'pca9685_hub'
    id: "PWM15"
    channel: 15

light:
  - platform: monochromatic
    name: "Color-LED-1"
    output: PWM0
  - platform: monochromatic
    name: "Color-LED-2"
    output: PWM1
  - platform: monochromatic
    name: "Color-LED-3"
    output: PWM2
  - platform: monochromatic
    name: "Color-LED-4"
    output: PWM3
  - platform: monochromatic
    name: "Color-LED-5"
    output: PWM4
  - platform: monochromatic
    name: "Color-LED-6"
    output: PWM5
  - platform: monochromatic
    name: "Color-LED-7"
    output: PWM6
  - platform: monochromatic
    name: "Color-LED-8"
    output: PWM7
  - platform: monochromatic
    name: "Color-LED-9"
    output: PWM8
  - platform: monochromatic
    name: "Color-LED-10"
    output: PWM9
  - platform: monochromatic
    name: "Color-LED-11"
    output: PWM10
  - platform: monochromatic
    name: "Color-LED-12"
    output: PWM11
  - platform: monochromatic
    name: "Color-LED-13"
    output: PWM12
  - platform: monochromatic
    name: "Color-LED-14"
    output: PWM13
  - platform: monochromatic
    name: "Color-LED-15"
    output: PWM14
  - platform: monochromatic
    name: "Color-LED-16"
    output: PWM15

  - platform: rgbw
    name: "ap-rgbw"
    red: PWM1
    green: PWM2
    blue: PWM3
    white: PWM4

switch:
  - platform: gpio
    name: "ap-light1"
    pin: 13
    inverted: false

  - platform: gpio
    name: "ap-light2"
    pin: 2
    inverted: false
   



Attached Files
.pdf   CWT-SL Light sensor (RS485 type) Manual.pdf (Size: 458.11 KB / Downloads: 529)
Print this item

  [Arduino source code for KC868-1U]-07_RS485
Posted by: KinCony Support - 06-21-2023, 05:22 AM - Forum: KC868-1U - No Replies

[Arduino source code for KC868-1U]-07_RS485

Code:
/*KC868-1U  RS485 CODE*/
#define RS485RX  32
#define RS485TX  33
void setup() {
  Serial.begin(115200);
  Serial2.begin(115200,SERIAL_8N1,A2_RS485RX,A2_RS485TX);

   Serial2.println("RS485 SEND is OK!!");
   Serial2.println("******************");
 
}

void loop() {
  /*print the received data of RS485 port*/
  while(Serial2.available()>0)
   {
    Serial2.print((char)Serial2.read());//Read rs485 receive data  and print it
   }
  delay(200);
}

Print this item

  [Arduino source code for KC868-1U]-06_OUTPUT
Posted by: KinCony Support - 06-21-2023, 05:22 AM - Forum: KC868-1U - No Replies

[Arduino source code for KC868-1U]-06_OUTPUT

Code:
/*KC868-1U PCF8574 digital output code*/
#include "Arduino.h"
#include "PCF8574.h"

// Set i2c address
PCF8574 pcf8574_OUT1(0x24,4,16);


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

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


}

void loop()
{
  for(int i=0;i<=7;i++){
    pcf8574_OUT1.digitalWrite(i, LOW);
    delay(1000);
  }
  for(int i=0;i<=7;i++){
    pcf8574_OUT1.digitalWrite(i, HIGH);
    delay(1000);
  }
 
}

Print this item

  [Arduino source code for KC868-1U]-05_LAN8720_UDP
Posted by: KinCony Support - 06-21-2023, 05:21 AM - Forum: KC868-1U - No Replies

[Arduino source code for KC868-1U]-05_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

// 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
  }
}

Print this item

  [Arduino source code for KC868-1U]-04_IR_send_code
Posted by: KinCony Support - 06-21-2023, 05:19 AM - Forum: KC868-1U - No Replies

[Arduino source code for KC868-1U]-04_IR_send_code

Code:
/*if download key pressed  send IR signal*/
#include <IRremote.h>
IRsend irsend(5);     
uint8_t sRepeats = 0;

void setup() {

  Serial.begin(115200);
  pinMode(0,INPUT);
  IrSender.begin(5,0);
  IrSender.enableIROut(38);
}

void loop() {
    
        Serial.println("Turn on LED");
        irsend.sendNECRaw(0xF807FF00, sRepeats);   //  0xF807FF00  is the raw_code  of led on
        delay(1000);
        Serial.println("Turn off LED");
        irsend.sendNECRaw(0xF906FF00, sRepeats);  //   0xF906FF00 is the raw_code  of led Off
       
}  

Print this item

  [Arduino source code for KC868-1U]-03_IR_receive_code
Posted by: KinCony Support - 06-21-2023, 05:19 AM - Forum: KC868-1U - No Replies

[Arduino source code for KC868-1U]-03_IR_receive_code

Code:
/*KC868-1U IR receive code*/
#include <IRremote.h>
IRrecv irrecv (15);
void setup() {

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

void loop() {
    if (irrecv.decode()) {
      Serial.print("irCode address: ");           
        Serial.println(irrecv.decodedIRData.address,HEX);
        Serial.print("irCode command: ");           
        Serial.println(irrecv.decodedIRData.command,HEX);
        Serial.print("irCode decodedRawData: ");           
        Serial.println(irrecv.decodedIRData.decodedRawData,HEX);
        Serial.println();
        //delay(1000);
    }
      IrReceiver.resume();
}

Print this item

  [Arduino source code for KC868-1U]-02_INPUT
Posted by: KinCony Support - 06-21-2023, 05:19 AM - Forum: KC868-1U - No Replies

[Arduino source code for KC868-1U]-02_INPUT

Code:
/*KC868-1U Digital input code*/
#include "Arduino.h"
#include "PCF8574.h"

// Set i2c address
PCF8574 pcf8574_IN1(0x22,4,16);

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(300);
}

Print this item