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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 3,092
» Latest member: girlsagency12
» Forum threads: 1,862
» Forum posts: 9,620

Full Statistics

Online Users
There are currently 45 online users.
» 1 Member(s) | 31 Guest(s)
Amazonbot, Bytespider, Crawl, PetalBot, bot, owler, hjahend

Latest Threads
Calibration issue M16v2
Forum: KC868-M16 / M1 / MB / M30
Last Post: RdP
38 minutes ago
» Replies: 2
» Views: 1
Kc868-server-modbus
Forum: KC868-Server Raspberry Pi4 local server
Last Post: admin
4 hours ago
» Replies: 1
» Views: 1
KC868-ATC V1 dont work on...
Forum: KC868-ATC / Tuya adapter V2
Last Post: admin
7 hours ago
» Replies: 1
» Views: 1
kc868-a8 V1.5 flashing
Forum: "KCS" firmware system
Last Post: admin
Today, 01:21 AM
» Replies: 3
» Views: 2
60m2 Smart apartment auto...
Forum: DIY Project
Last Post: Melindad
Yesterday, 10:43 AM
» Replies: 2
» Views: 3
Kc868-server-modbus
Forum: KC868-Server Raspberry Pi4 local server
Last Post: admin
Yesterday, 08:22 AM
» Replies: 1
» Views: 1
H32L issue
Forum: KC868-HxB series Smart Controller
Last Post: admin
Yesterday, 08:20 AM
» Replies: 7
» Views: 4
KC868-H32B V5.08 firmware
Forum: News
Last Post: admin
04-18-2024, 09:58 PM
» Replies: 9
» Views: 1,540
[Case Study-01]: KC868-A4...
Forum: DIY Project
Last Post: JaneJLocane
04-18-2024, 02:14 PM
» Replies: 1
» Views: 1,723
RS485 Light Switch
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
04-18-2024, 11:28 AM
» Replies: 7
» Views: 6

  KC868-D16 question
Posted by: blackygego - 03-19-2024, 10:45 PM - Forum: KC868-HxB series Smart Controller - Replies (1)

Hi, two question,

1.) Do I use input K1 to control output 1+,1-; input K2 controls output 2+,2-; and so on..I am interested in the following, if I can use the K3 input to control the output 14+,14-?

2.) What is the difference between LED Dimmable Driver 0-10V and LED Dimmable Driver 1-10V?

Thank you very much!

Print this item

  Tuya adapter V2 arduino demo source code
Posted by: admin - 03-19-2024, 02:03 AM - Forum: KC868-ATC / Tuya adapter V2 - Replies (3)

Code:
#include <Arduino.h>
#include <TuyaWifi.h>
#include "HardwareSerial.h"
TuyaWifi my_device;

/* Current LED status */
unsigned char led_state = 0;
/* Connect network button pin */
int key_pin = 25;

/* Data point define */
#define DPID_SWITCH_1   1
#define DPID_SWITCH_2   2
#define DPID_SWITCH_3   3
#define DPID_SWITCH_4   4
#define DPID_SWITCH_5   5
#define DPID_SWITCH_6   6
#define DPID_SWITCH_7   113
#define DPID_SWITCH_8   114
#define DPID_SWITCH_9   115
#define DPID_SWITCH_10  116
#define DPID_SWITCH_11  117
#define DPID_SWITCH_12  118
#define DPID_SWITCH_13  119
#define DPID_SWITCH_14  120
#define DPID_SWITCH_15  121
#define DPID_SWITCH_16  122
#define DPID_SWITCH_17  123
#define DPID_SWITCH_18  124
#define DPID_SWITCH_19  125
#define DPID_SWITCH_20  126
#define DPID_SWITCH_21  127
#define DPID_SWITCH_22  128
#define DPID_SWITCH_23  129
#define DPID_SWITCH_24  130
#define DPID_SWITCH_25  131
#define DPID_SWITCH_26  132
#define DPID_SWITCH_27  133
#define DPID_SWITCH_28  134
#define DPID_SWITCH_29  135
#define DPID_SWITCH_30  136
#define DPID_SWITCH_31  137
#define DPID_SWITCH_32  138

#define LED_WiFi  26
//#define LED_User  33

unsigned char switch_1_state = 0;
unsigned char switch_2_state = 0;
unsigned char switch_3_state = 0;
unsigned char switch_4_state = 0;
unsigned char switch_5_state = 0;
unsigned char switch_6_state = 0;

unsigned char switch_7_state = 0;
unsigned char switch_8_state = 0;
unsigned char switch_9_state = 0;
unsigned char switch_10_state = 0;
unsigned char switch_11_state = 0;
unsigned char switch_12_state = 0;
unsigned char switch_13_state = 0;
unsigned char switch_14_state = 0;
unsigned char switch_15_state = 0;
unsigned char switch_16_state = 0;
unsigned char switch_17_state = 0;
unsigned char switch_18_state = 0;
unsigned char switch_19_state = 0;
unsigned char switch_20_state = 0;
unsigned char switch_21_state = 0;
unsigned char switch_22_state = 0;
unsigned char switch_23_state = 0;
unsigned char switch_24_state = 0;
unsigned char switch_25_state = 0;
unsigned char switch_26_state = 0;
unsigned char switch_27_state = 0;
unsigned char switch_28_state = 0;
unsigned char switch_29_state = 0;
unsigned char switch_30_state = 0;
unsigned char switch_31_state = 0;
unsigned char switch_32_state = 0;

/* Stores all DPs and their types. PS: array[][0]:dpid, array[][1]:dp type.
*                                     dp type(TuyaDefs.h) : DP_TYPE_RAW, DP_TYPE_BOOL, DP_TYPE_VALUE, DP_TYPE_STRING, DP_TYPE_ENUM, DP_TYPE_BITMAP
*/
unsigned char dp_array[][2] =
{
  {DPID_SWITCH_1, DP_TYPE_BOOL},{DPID_SWITCH_2, DP_TYPE_BOOL},{DPID_SWITCH_3, DP_TYPE_BOOL},{DPID_SWITCH_4, DP_TYPE_BOOL},{DPID_SWITCH_5, DP_TYPE_BOOL},{DPID_SWITCH_6, DP_TYPE_BOOL},
  {DPID_SWITCH_7, DP_TYPE_BOOL},{DPID_SWITCH_8, DP_TYPE_BOOL},{DPID_SWITCH_9, DP_TYPE_BOOL},{DPID_SWITCH_10, DP_TYPE_BOOL},{DPID_SWITCH_11, DP_TYPE_BOOL},{DPID_SWITCH_12, DP_TYPE_BOOL},
  {DPID_SWITCH_13, DP_TYPE_BOOL},{DPID_SWITCH_14, DP_TYPE_BOOL},{DPID_SWITCH_15, DP_TYPE_BOOL},{DPID_SWITCH_16, DP_TYPE_BOOL},{DPID_SWITCH_17, DP_TYPE_BOOL},{DPID_SWITCH_18, DP_TYPE_BOOL},
  {DPID_SWITCH_19, DP_TYPE_BOOL},{DPID_SWITCH_20, DP_TYPE_BOOL},{DPID_SWITCH_21, DP_TYPE_BOOL},{DPID_SWITCH_22, DP_TYPE_BOOL},{DPID_SWITCH_23, DP_TYPE_BOOL},{DPID_SWITCH_24, DP_TYPE_BOOL},
  {DPID_SWITCH_25, DP_TYPE_BOOL},{DPID_SWITCH_26, DP_TYPE_BOOL},{DPID_SWITCH_27, DP_TYPE_BOOL},{DPID_SWITCH_28, DP_TYPE_BOOL},{DPID_SWITCH_29, DP_TYPE_BOOL},{DPID_SWITCH_30, DP_TYPE_BOOL},
{DPID_SWITCH_31, DP_TYPE_BOOL},{DPID_SWITCH_32, DP_TYPE_BOOL},
};

unsigned char pid[] = {"3ocztklfu3q32jab"};
unsigned char mcu_ver[] = {"1.0.0"};

/* last time */
unsigned long last_time = 0;

void setup()
{
  // Serial with tuyawifi
  Serial.begin(9600,SERIAL_8N1,22,19);

  Serial2.begin(9600,SERIAL_8N1,32,33);
  Serial2.println("RS485 SEND is OK!!");

  //Initialize led port, turn off led.
  pinMode(LED_WiFi, OUTPUT);
  digitalWrite(LED_WiFi, LOW);

/*  pinMode(LED_User, OUTPUT);
  digitalWrite(LED_User, LOW);*/

  //Initialize networking keys.
  pinMode(key_pin, INPUT_PULLUP);

  //Enter the PID and MCU software version
  my_device.init(pid, mcu_ver);
  //incoming all DPs and their types array, DP numbers
  my_device.set_dp_cmd_total(dp_array, 1);
  //register DP download processing callback function
  my_device.dp_process_func_register(dp_process);
  //register upload all DP callback function
  my_device.dp_update_all_func_register(dp_update_all);

  last_time = millis();
}

void loop()
{
  while(Serial2.available()>0){
    Serial2.print((char)Serial2.read());
   }
   
  my_device.uart_service();

  //Enter the connection network mode when Pin7 is pressed.
  if (digitalRead(key_pin) == LOW) {
    delay(80);
    if (digitalRead(key_pin) == LOW) {
      my_device.mcu_set_wifi_mode(SMART_CONFIG);
    }
  }
  /* LED blinks when network is being connected */
  if ((my_device.mcu_get_wifi_work_state() != WIFI_LOW_POWER) && (my_device.mcu_get_wifi_work_state() != WIFI_CONN_CLOUD) && (my_device.mcu_get_wifi_work_state() != WIFI_SATE_UNKNOW)) {
    if (millis()- last_time >= 500) {
      last_time = millis();

      if (led_state == LOW) {
        led_state = HIGH;
      } else {
        led_state = LOW;
      }
      digitalWrite(LED_WiFi, led_state);
    }
  }

  delay(10);
}

/**
* @description: DP download callback function.
* @param {unsigned char} dpid
* @param {const unsigned char} value
* @param {unsigned short} length
* @return {unsigned char}
*/
unsigned char dp_process(unsigned char dpid,const unsigned char value[], unsigned short length)
{
  switch(dpid) {
    case DPID_SWITCH_1:
      switch_1_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_1, switch_1_state, length);
    break;
    case DPID_SWITCH_2:
      switch_2_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_2, switch_2_state, length);
    break;
    case DPID_SWITCH_3:
      switch_3_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_3, switch_3_state, length);
    break;
    case DPID_SWITCH_4:
      switch_4_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_4, switch_4_state, length);
    break;
    case DPID_SWITCH_5:
      switch_5_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_5, switch_5_state, length);
    break;
    case DPID_SWITCH_6:
      switch_6_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_6, switch_6_state, length);
    break;
    case DPID_SWITCH_7:
      switch_7_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_7, switch_7_state, length);
    break;
    case DPID_SWITCH_8:
      switch_8_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_8, switch_8_state, length);
    break;
    case DPID_SWITCH_9:
      switch_9_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_9, switch_9_state, length);
    break;
    case DPID_SWITCH_10:
      switch_10_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_10, switch_10_state, length);
    break;
    case DPID_SWITCH_11:
      switch_11_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_11, switch_11_state, length);
    break;
    case DPID_SWITCH_12:
      switch_12_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_12, switch_12_state, length);
    break;
    case DPID_SWITCH_13:
      switch_13_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_13, switch_13_state, length);
    break;
    case DPID_SWITCH_14:
      switch_14_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_14, switch_14_state, length);
    break;
    case DPID_SWITCH_15:
      switch_15_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_15, switch_15_state, length);
    break;
    case DPID_SWITCH_16:
      switch_16_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_16, switch_16_state, length);
    break;
    case DPID_SWITCH_17:
      switch_17_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_17, switch_17_state, length);
    break;
    case DPID_SWITCH_18:
      switch_18_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_18, switch_18_state, length);
    break;
    case DPID_SWITCH_19:
      switch_19_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_19, switch_19_state, length);
    break;
    case DPID_SWITCH_20:
      switch_20_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_20, switch_20_state, length);
    break;
    case DPID_SWITCH_21:
      switch_21_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_21, switch_21_state, length);
    break;
    case DPID_SWITCH_22:
      switch_22_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_22, switch_22_state, length);
    break;
    case DPID_SWITCH_23:
      switch_23_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_23, switch_23_state, length);
    break;
    case DPID_SWITCH_24:
      switch_24_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_24, switch_24_state, length);
    break;
    case DPID_SWITCH_25:
      switch_25_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_25, switch_25_state, length);
    break;
    case DPID_SWITCH_26:
      switch_26_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_26, switch_26_state, length);
    break;
    case DPID_SWITCH_27:
      switch_27_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_27, switch_27_state, length);
    break;
    case DPID_SWITCH_28:
      switch_28_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_28, switch_28_state, length);
    break;
    case DPID_SWITCH_29:
      switch_29_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_29, switch_29_state, length);
    break;
    case DPID_SWITCH_30:
      switch_30_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_30, switch_30_state, length);
    break;
    case DPID_SWITCH_31:
      switch_31_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_31, switch_31_state, length);
    break;
    case DPID_SWITCH_32:
      switch_32_state = my_device.mcu_get_dp_download_data(dpid, value, length); /* Get the value of the down DP command */
      //Status changes should be reported.
      my_device.mcu_dp_update(DPID_SWITCH_32, switch_32_state, length);
    break;
   
    default:break;
  }
  return TY_SUCCESS;
}

/**
* @description: Upload all DP status of the current device.
* @param {*}
* @return {*}
*/
void dp_update_all(void)
{
  my_device.mcu_dp_update(DPID_SWITCH_1, switch_1_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_2, switch_2_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_3, switch_3_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_4, switch_4_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_5, switch_5_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_6, switch_6_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_7, switch_7_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_8, switch_8_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_9, switch_9_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_10, switch_10_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_11, switch_11_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_12, switch_12_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_13, switch_13_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_14, switch_14_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_15, switch_15_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_16, switch_16_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_17, switch_17_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_18, switch_18_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_19, switch_19_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_20, switch_20_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_21, switch_21_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_22, switch_22_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_23, switch_23_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_24, switch_24_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_25, switch_25_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_26, switch_26_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_27, switch_27_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_28, switch_28_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_29, switch_29_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_30, switch_30_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_31, switch_31_state, 1);
  my_device.mcu_dp_update(DPID_SWITCH_32, switch_32_state, 1);
}

arduino source code download: 
.zip   voice-control.ino.zip (Size: 2.31 KB / Downloads: 43)

esp32 board need V1.0.6 verision:
   

tuya arduino library config file set to "0". because use ESP32's GPIO for BUTTON and LED with Tuya network function, just set as photo:
   

Print this item

  Tuya adapter V2 ESP32 I/O pin define
Posted by: admin - 03-19-2024, 01:58 AM - Forum: KC868-ATC / Tuya adapter V2 - No Replies

RS485:
RXD: 32
TXD: 33

Tuya module:
RXD: 22
TXD: 19

Tuya Reset button: 25
Tuya network LED: 26

Print this item

  ADR - ESP32 AC 220v dimmer arduino demo source code and library
Posted by: admin - 03-19-2024, 01:55 AM - Forum: KC868-AP / ADR - No Replies

Code:
#include <myADR.h>    ////RBDdimmer.h /////RBDmcuESP32.h

//Parameters
int zeroCrossPin  = 25;
int acdPin  = 33;

int add_pin = 15;
int dec_pin = 4;

int MIN_POWER  = 0;
int MAX_POWER  = 80;
int POWER_STEP  = 2;

//Variables
int power  = 0;

//Objects
dimmerLamp acd(acdPin,zeroCrossPin);

void setup(){
  //Init Serial USB
  Serial.begin(115200);
  Serial.println(F("Initialize System"));
  acd.begin(NORMAL_MODE, ON);
 
  acd.setPower(10); // setPower(0-100%);
  Serial.print("lampValue -> ");
  Serial.print(acd.getPower());
  Serial.println("%");

  pinMode(add_pin,INPUT_PULLUP);
  pinMode(dec_pin,INPUT_PULLUP);
     
}

void loop(){
  testDimmer();
}

int value = 0;

void testDimmer(){/* function testDimmer */

  int add = digitalRead(add_pin);
  int dec = digitalRead(dec_pin);

  if(add == LOW) value += 1;
  if(dec == LOW) value -= 1;

  if(value <= MIN_POWER)  value = MIN_POWER;
  else if(value>MAX_POWER) value = MAX_POWER;

  acd.setPower(value);

  delay(100);
 
////Sweep light power to test dimmer
/*  for(power=MIN_POWER;power<=MAX_POWER;power+=POWER_STEP){
    acd.setPower(power); // setPower(0-100%);
      Serial.print("lampValue -> ");
      Serial.print(acd.getPower());
      Serial.println("%");
    delay(100);
  }

for(power=MAX_POWER;power>=MIN_POWER;power-=POWER_STEP){
    acd.setPower(power); // setPower(0-100%);
      Serial.print("lampValue -> ");
      Serial.print(acd.getPower());
      Serial.println("%");
    delay(100);
  }*/
}
source code download: 
.zip   tst_dimmer.zip (Size: 744 bytes / Downloads: 49)

AC dimmer arduino library file download: 
.zip   ac-dimmer.zip (Size: 5.68 KB / Downloads: 50)

Print this item

  ADR ESPHome demo config for home assistant
Posted by: admin - 03-19-2024, 01:49 AM - Forum: KC868-AP / ADR - No Replies

esphome:
  name: adr
  friendly_name: ADR

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "ZWeLIQ6pHBi8F7iz8oU50b5e4pOntKh7crgfrRpT0NQ="

ota:
  password: "0d1fac93b813af333e08eee312020918"

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Adr Fallback Hotspot"
    password: "GOSjJDSsz6Z5"

captive_portal:

output:
  - platform: ac_dimmer
    id: dimmer1
    gate_pin: 33
    zero_cross_pin:
      number: 25
      mode:
        input: true
      inverted: no
    min_power: 35%

light:
  - platform: monochromatic
    output: dimmer1
    name: adr_lamp
    default_transition_length: 100ms


.txt   ADR_HA_ESP32.txt (Size: 840 bytes / Downloads: 36)

Print this item

  ADR ESP32 I/O pin define
Posted by: admin - 03-19-2024, 01:46 AM - Forum: KC868-AP / ADR - No Replies

DI1: GPIO15
DI2: GPIO4

RS485:
TXD: GPIO27
RXD: GPIO26

Tuya:
TXD: GPIO14
RXD: GPIO13

analog input: GPIO36

zero_cross_pin:  GPIO25
gate_pin: GPIO33

P8 jumper:
R32 short with GND: analog input use for 4-20mA signal
R33 short with GND: analog input use for dc 0-10v signal

Print this item

Question DC motor controller
Posted by: nickdd - 03-18-2024, 09:52 PM - Forum: KC868-AM - Replies (3)

Hi,

Would this board be suitable to control a small DC motor (I want to automate the chicken coop door). 
Which motor controller would be suitable and can I just connect it to the GPIO pins in the green terminals?

Can I also connect Hall effect sensor to detect open/closed state of the door?
I believe ESP32 has built-in support for hall effect?

sorry, still quite new to electronics/esp32 but therefore I'm looking at this nice board instead of starting from scratch.

Appreciate the advice.

Regards,
Nick

Print this item

Wink Time display issue in the KC868-A index page
Posted by: HA7CQ - 03-18-2024, 09:50 AM - Forum: KC868-A8 - Replies (1)

Greetings!
We have programmed many IFTT timer commands. It is important to have the correct time settings in our project. (We control the movement of Bells Smile )   NTP time service works fine, but the board time displayed on the index page is incorrect (displayed ~ Central American). The KC868_A8 panel working  in the true timezone (UTC+1 in our country).

It's causing me trouble because I thought the NTP clock setting process was wrong.

I attached the display capture. Can we correct it?



Attached Files Thumbnail(s)
   
Print this item

  KC868-HAv2 esphome issue
Posted by: procet - 03-17-2024, 08:44 PM - Forum: Development - Replies (22)

Hi, i'va a problem with ha v2 and an esp32 with esphome firmware.
i'll attach the yaml file and the esphome log file. i think there is something wrong in the yaml file because with the ha control software the unit works well.
you can see the startup of the ha v2 and me trying to turno on and off the switches from home assistant.
every time the crc check is failing.
what am i doing wrong?
Thank you very much

Code:
esphome:
  name: wt32-rs485
  friendly_name: wt32-rs485

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:
#  baud_rate: 0

external_components:
  - source:
      type: git
      url: https://github.com/hzkincony/esphome-kc868-ha
      ref: v3.0.0

uart:
  - id: myuart1
    tx_pin: 17
    rx_pin: 5
    baud_rate: 9600     

# Enable Home Assistant API
api:


ota:


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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
#  ap:
#    ssid: "Wt32-Rs485 Fallback Hotspot"
#    password: "RdQ2lmIEtDPg"

#captive_portal:

ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO0_IN
  phy_addr: 1
  power_pin: GPIO16
  manual_ip:
    static_ip: 192.168.1.177
    gateway: 192.168.1.1
    subnet: 255.255.255.0

text_sensor:
  - platform: ethernet_info

kc868_ha:

binary_sensor:
  - platform: kc868_ha
    target_relay_controller_addr: 1 # Default value is 1, corresponds to the Target Relay Controller Addr parameter in HA485_Ctrl software
    switch_adapter_addr: 10 # Default value is 10, corresponds to the Switch Adapter Addr parameter in HA485_Ctrl software
    bind_output: 1 # Corresponds to the BindOutput parameter in HA485_Ctrl software
    name: "binary_sensor 1"
  - platform: kc868_ha
    target_relay_controller_addr: 1
    switch_adapter_addr: 10
    bind_output: 2
    name: "binary_sensor 2"
  - platform: kc868_ha
    target_relay_controller_addr: 1
    switch_adapter_addr: 10
    bind_output: 3
    name: "binary_sensor 3"
  - platform: kc868_ha
    target_relay_controller_addr: 1
    switch_adapter_addr: 10
    bind_output: 4
    name: "binary_sensor 4"
  - platform: kc868_ha
    target_relay_controller_addr: 1
    switch_adapter_addr: 10
    bind_output: 5
    name: "binary_sensor 5"
  - platform: kc868_ha
    target_relay_controller_addr: 1
    switch_adapter_addr: 10
    bind_output: 6
    name: "binary_sensor 6"

switch:
  - platform: kc868_ha
    target_relay_controller_addr: 1
    switch_adapter_addr: 10
    bind_output: 1
    name: "switch 1"
  - platform: kc868_ha
    target_relay_controller_addr: 1
    switch_adapter_addr: 10
    bind_output: 2
    name: "switch 2"
  - platform: kc868_ha
    target_relay_controller_addr: 1
    switch_adapter_addr: 10
    bind_output: 3
    name: "switch 3"
  - platform: kc868_ha
    target_relay_controller_addr: 1
    switch_adapter_addr: 10
    bind_output: 4
    name: "switch 4"
  - platform: kc868_ha
    target_relay_controller_addr: 1
    switch_adapter_addr: 10
    bind_output: 5
    name: "switch 5"
  - platform: kc868_ha
    target_relay_controller_addr: 1
    switch_adapter_addr: 10
    bind_output: 6
    name: "switch 6"


Code:
INFO ESPHome 2023.8.2
[18:16:24][D][kc868_ha.component:019]: uart bus receive df:eb:ff:ff:7e:77:ff:ff:ff:ff:ff:ff:ff:7d:f3:ff:f7:eb:ff:fe:5e
[18:16:24][D][kc868_ha.component:030]: uart crc=fe:5e, calc crc=b6:8a
[18:16:24][W][kc868_ha.component:033]: crc check failed. ignore data
[18:16:27][D][kc868_ha.component:019]: uart bus receive ff:ff:ef:f3:ef:cf:fe:ff:ff:ff:ff:ff:ff:ff:ff:f1:cf:ff:df:ff:bd
[18:16:27][D][kc868_ha.component:030]: uart crc=ff:bd, calc crc=18:f2
[18:16:27][W][kc868_ha.component:033]: crc check failed. ignore data
[18:16:29][D][kc868_ha.component:019]: uart bus receive 7f:ff:ff:fb:e7:ce:ff:ff:ff:ff:ff:ff:ff:ff:ff:78:f4:7f:f7:ff:ff
[18:16:29][D][kc868_ha.component:030]: uart crc=ff:ff, calc crc=b:26
[18:16:29][W][kc868_ha.component:033]: crc check failed. ignore data
[18:16:32][D][kc868_ha.component:019]: uart bus receive 7f:f7:eb:ff:f3:fe:d3:ff:ff:ff:ff:ff:ff:ff:ff:f5:8f:ff:ff:eb:ff
[18:16:32][D][kc868_ha.component:030]: uart crc=eb:ff, calc crc=b5:63
[18:16:32][W][kc868_ha.component:033]: crc check failed. ignore data
[18:16:33][D][kc868_ha.component:019]: uart bus receive 7f:ff:ff:f3:e7:37:fb:ff:ff:ff:ff:ff:ff:ff:ff:e1:cf:ff:7f:ff:eb
[18:16:33][D][kc868_ha.component:030]: uart crc=ff:eb, calc crc=c5:6a
[18:16:33][W][kc868_ha.component:033]: crc check failed. ignore data
[18:16:34][D][kc868_ha.component:019]: uart bus receive df:ff:eb:ff:ff:ef:35:f9:ff:ff:ff:ff:ff:e9:8f:ff:ff:f7:eb:ff:f3
[18:16:34][D][kc868_ha.component:030]: uart crc=ff:f3, calc crc=b1:52
[18:16:34][W][kc868_ha.component:033]: crc check failed. ignore data
[18:16:35][D][kc868_ha.component:019]: uart bus receive df:eb:fb:e7:35:fb:ff:ff:ff:ff:ff:ff:ff:ff:ff:f9:df:ff:ff:eb:ff
[18:16:35][D][kc868_ha.component:030]: uart crc=eb:ff, calc crc=f9:99
[18:16:35][W][kc868_ha.component:033]: crc check failed. ignore data
[18:16:36][D][kc868_ha.component:019]: uart bus receive df:ff:eb:ff:f3:7e:5b:ff:ff:ff:ff:ff:ff:ff:78:e4:f7:eb:df:5f:fb
[18:16:36][D][kc868_ha.component:030]: uart crc=5f:fb, calc crc=cb:32
[18:16:36][W][kc868_ha.component:033]: crc check failed. ignore data
[18:16:37][D][kc868_ha.component:019]: uart bus receive ff:ff:ff:f3:e7:bd:ff:ff:ff:ff:ff:ff:ff:ff:ff:e1:ff:ff:ff:ff:ff
[18:16:37][D][kc868_ha.component:030]: uart crc=ff:ff, calc crc=68:d5
[18:16:37][W][kc868_ha.component:033]: crc check failed. ignore data
[18:16:37][D][kc868_ha.component:019]: uart bus receive 7f:ff:eb:be:5e:5b:ff:ff:ff:ff:ff:ff:ff:79:ee:7f:f7:fb:ff:f3:de
[18:16:37][D][kc868_ha.component:030]: uart crc=f3:de, calc crc=2a:71
[18:16:37][W][kc868_ha.component:033]: crc check failed. ignore data
[18:16:50][D][switch:012]: 'switch 1' Turning ON.
[18:16:50][D][kc868_ha.component:131]: uart bus send 1:3:12:55:bb:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:1:30:4b
[18:16:50][D][switch:055]: 'switch 1': Sending state ON
[18:16:50][D][kc868_ha.component:019]: uart bus receive 1:3:12:55:bb:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:1
[18:16:50][D][kc868_ha.component:030]: uart crc=0:1, calc crc=41:25
[18:16:50][W][kc868_ha.component:033]: crc check failed. ignore data
[18:17:02][D][switch:016]: 'switch 1' Turning OFF.
[18:17:02][D][kc868_ha.component:131]: uart bus send 1:3:12:55:bb:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:f1:8b
[18:17:02][D][switch:055]: 'switch 1': Sending state OFF
[18:17:02][D][kc868_ha.component:019]: uart bus receive 1:3:12:55:bb:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
[18:17:02][D][kc868_ha.component:030]: uart crc=0:0, calc crc=41:25
[18:17:02][W][kc868_ha.component:033]: crc check failed. ignore data
[18:17:07][D][switch:012]: 'switch 1' Turning ON.
[18:17:07][D][kc868_ha.component:131]: uart bus send 1:3:12:55:bb:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:1:30:4b
[18:17:07][D][switch:055]: 'switch 1': Sending state ON
[18:17:07][D][kc868_ha.component:019]: uart bus receive 1:3:12:55:bb:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:1
[18:17:07][D][kc868_ha.component:030]: uart crc=0:1, calc crc=41:25
[18:17:07][W][kc868_ha.component:033]: crc check failed. ignore data
[18:17:09][D][switch:016]: 'switch 1' Turning OFF.
[18:17:09][D][kc868_ha.component:131]: uart bus send 1:3:12:55:bb:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:f1:8b
[18:17:09][D][switch:055]: 'switch 1': Sending state OFF
[18:17:09][D][kc868_ha.component:019]: uart bus receive 1:3:12:55:bb:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
[18:17:09][D][kc868_ha.component:030]: uart crc=0:0, calc crc=41:25
[18:17:09][W][kc868_ha.component:033]: crc check failed. ignore data
[18:17:10][D][switch:012]: 'switch 2' Turning ON.
[18:17:10][D][kc868_ha.component:131]: uart bus send 1:3:12:55:bb:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:2:70:4a
[18:17:10][D][switch:055]: 'switch 2': Sending state ON
[18:17:10][D][kc868_ha.component:019]: uart bus receive 1:3:12:55:bb:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:2
[18:17:10][D][kc868_ha.component:030]: uart crc=0:2, calc crc=41:25
[18:17:10][W][kc868_ha.component:033]: crc check failed. ignore data
[18:17:11][D][switch:016]: 'switch 2' Turning OFF.
[18:17:11][D][kc868_ha.component:131]: uart bus send 1:3:12:55:bb:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:f1:8b
[18:17:11][D][switch:055]: 'switch 2': Sending state OFF
[18:17:11][D][kc868_ha.component:019]: uart bus receive 1:3:12:55:bb:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
[18:17:11][D][kc868_ha.component:030]: uart crc=0:0, calc crc=41:25
[18:17:11][W][kc868_ha.component:033]: crc check failed. ignore data
[18:17:17][D][switch:012]: 'switch 3' Turning ON.
[18:17:17][D][kc868_ha.component:131]: uart bus send 1:3:12:55:bb:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:4:f0:48
[18:17:17][D][switch:055]: 'switch 3': Sending state ON
[18:17:17][D][kc868_ha.component:019]: uart bus receive 1:3:12:55:bb:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:4
[18:17:18][D][kc868_ha.component:030]: uart crc=0:4, calc crc=41:25
[18:17:18][W][kc868_ha.component:033]: crc check failed. ignore data
[18:17:18][D][switch:016]: 'switch 3' Turning OFF.
[18:17:18][D][kc868_ha.component:131]: uart bus send 1:3:12:55:bb:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:f1:8b
[18:17:18][D][switch:055]: 'switch 3': Sending state OFF
[18:17:18][D][kc868_ha.component:019]: uart bus receive 1:3:12:55:bb:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
[18:17:18][D][kc868_ha.component:030]: uart crc=0:0, calc crc=41:25
[18:17:18][W][kc868_ha.component:033]: crc check failed. ignore data

Print this item

  Free sample
Posted by: ali - 03-17-2024, 10:21 AM - Forum: Apply for free sample product - No Replies

اسمي علي من مصر وأعمل كهربائي منزل وأريد تجربة هذا المنتج. إذا كان منتج جيد، سأنصح جميع زملائي بشرائه، وسنأخذ كمية كبيرة.

الرجاء الرد بسرعة



Attached Files Thumbnail(s)
       
Print this item