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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 8,278
» Latest member: decsec
» Forum threads: 3,618
» Forum posts: 18,663

Full Statistics

Online Users
There are currently 92 online users.
» 0 Member(s) | 69 Guest(s)
AhrefsBot, Amazonbot, Applebot, Bytespider, DataForSeoBot, PetalBot, Semrush, bot

Latest Threads
KC868-A32 : PSU 24VDC
Forum: KC868-A32/A32 Pro
Last Post: admin
7 hours ago
» Replies: 3
» Views: 19
a16v3 - reed switch and m...
Forum: KC868-A16v3
Last Post: admin
8 hours ago
» Replies: 11
» Views: 542
Loxone RS485
Forum: KinCony integrate with Loxone home automation
Last Post: admin
8 hours ago
» Replies: 7
» Views: 1,048
Kc868a newbie questions
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
8 hours ago
» Replies: 1
» Views: 3
KC868-A2 SIM7600 with Tuy...
Forum: KC868-A2
Last Post: WestfieldGhost
Yesterday, 05:33 PM
» Replies: 33
» Views: 3,409
MB Current & Power too lo...
Forum: KC868-M16 / M1 / MB / M30
Last Post: admin
12-17-2025, 11:29 PM
» Replies: 1
» Views: 17
Submit your suggestions a...
Forum: Suggestions and feedback on KinCony's products
Last Post: admin
12-17-2025, 11:20 PM
» Replies: 34
» Views: 8,547
MODBUS TCP ETHERNET - SLA...
Forum: KC868-A16
Last Post: admin
12-17-2025, 06:47 AM
» Replies: 8
» Views: 1,044
N20 ESPHome YAML Updated ...
Forum: N20
Last Post: admin
12-17-2025, 06:45 AM
» Replies: 1
» Views: 19
Where to start
Forum: KC868-A6
Last Post: admin
12-17-2025, 01:05 AM
» Replies: 11
» Views: 8,461

  KinCony ESP32 Tuya iot adapter released!
Posted by: admin - 06-30-2022, 04:32 AM - Forum: News - Replies (4)

KinCony ESP32 Tuya IoT adapter let relay board or IoT devices easy integrate to tuya IoT platform. We have designed by ESP32 work with Tuya module. Tuya module will connect with Tuya cloud server, when using tuya phone app, message will send to tuya wifi module and decode by ESP32. ESP32 support use arduino IDE to write code, get the tuya message and send any command to RS232 or RS485 or network device. it’s a good convert tool for smart home automation DIY.

adapter support to use “Tuya MCU SDK Arduino Library”

KC868-H32B,KC868-H32BS …. HxB series smart controller will be easy support TUYA phone application, alexa and google home voice control function.


[Image: kincony-tuya-adapter-1.jpg]
[Image: kincony-tuya-adapter-2.JPG]

it support install on the DIN rail.
[Image: esp32-tuya-adapter-pins.jpg]
you can write any arduino IDE code or by IDF tool to write code and download firmware by USB-C cable.
[Image: kincony-tuya-adapter-3.JPG]
[Image: kincony-tuya-adapter-4.JPG]
[Image: kincony-tuya-adapter-5.JPG]
[Image: kincony-tuya-adapter-6.JPG]

install wifi antena by SMA socket.
Tuya app , alexa app and google home / google assistant app will be support.
[Image: h32bs-tuya-app-1_pix400.jpg][Image: h32bs-tuya-app-2_pix400.jpg]
[Image: h32bs-tuya-app-3_pix400.jpg][Image: h32bs-tuya-app-4_pix400.jpg]
[Image: h32bs-alexa-app_pix400.jpg][Image: h32bs-google-app_pix400.jpg]
[Image: kincony-tuya-adapter-7.JPG]
suspport use tuya phone app, google home and alexa echo speaker
[Image: kincony-tuya-adapter-8.JPG]

KinCony esp32 tuya adapter work with KC868-H32B by RS232 port
[Image: kincony-tuya-adapter-9.JPG]

KinCony esp32 tuya adapter work with KC868-H32BS by RS232 port
[Image: kincony-tuya-adapter-10.JPG]

[Image: tuya-RS485.jpg]

Print this item

  [Arduino IDE demo source code for KC868-A8S]--#14-KC868-A8S_mqtt-relay_code
Posted by: KinCony Support - 06-30-2022, 12:55 AM - Forum: KC868-A8S - No Replies

[Arduino IDE demo source code for KC868-A8S]--#14-KC868-A8S_mqtt-relay_code
// make sure set your Serial2 pins in your "HardwareSerial.cpp" for ESP32 as follows:

//#define RX2  15
//#define TX2  13

Code:
// code use for KinCony KC868-A8S board


#include "PCF8574.h"

String Publish = "relay8/12345/state"; //Publish Topic
String Subscribe = "relay8/12345/set"; //Subscribe Topic

PCF8574 pcf8574_o(0x24,4,5);
PCF8574 pcf8574_i(0x22,4,5);

void setup()
{
  pinMode(2, OUTPUT);   //beep

  Serial.begin(115200);
  Serial2.begin(115200);
 
  pcf8574_i.pinMode(P0, INPUT);

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

    Serial.print("Init pcf8574_i...");
    if (pcf8574_i.begin()){
        Serial.println("PCF8674_input_OK");
    }else{
        Serial.println("PCF8674_input_KO");
    }

    Serial.print("Init pcf8574_o...");
    if (pcf8574_o.begin()){
        Serial.println("PCF8674_output_OK");
    }else{
        Serial.println("PCF8674_output_KO");
    }

  pcf8574_o.digitalWrite(P0, HIGH);
  pcf8574_o.digitalWrite(P1, HIGH);
  pcf8574_o.digitalWrite(P2, HIGH);
  pcf8574_o.digitalWrite(P3, HIGH);
  pcf8574_o.digitalWrite(P4, HIGH);
  pcf8574_o.digitalWrite(P5, HIGH);
  pcf8574_o.digitalWrite(P6, HIGH);
  pcf8574_o.digitalWrite(P7, HIGH);

  //AT Commands for setting up the client id and Server
  //Need to be executed once -- Open serial terminal doe seeing the debug messages
  Serial.println("Connecting To Server........");
  Serial2.println("ATE1");
  delay(2000);
  Serial2.println("AT+CMQTTSTART"); //Establishing MQTT Connection
  delay(2000);
  Serial2.println("AT+CMQTTACCQ=0,\"kincony\""); //Client ID - change this for each client as this need to be unique
  delay(2000);
  Serial2.println("AT+CMQTTCONNECT=0,\"tcp://iot.kincony.com:1883\",120,1,\"mqtt\",\"123\""); //MQTT Server Name for connecting this client  user name: mqtt   password: 123
  delay(2000);

  Serial2.println("AT+CMQTTSUB=0,16,1,1"); //Length of message
  delay(1000);
  Serial2.println("relay8/12345/set"); //message
  delay(1000);
  Serial.println("Done");
}

void loop()
{
  String incoming;

//Receiving MODEM Response
  while(Serial2.available()>0)
  {
    delay(10);
    incoming = Serial2.readString();
    Serial.println(incoming);

    //Serial.println(b);
    if(incoming.indexOf("PAYLOAD") != -1)
    {
       int new1 = incoming.indexOf("PAYLOAD");
       String neww = incoming.substring(new1);
       int new2 = neww.indexOf('\n');
       String new3 = neww.substring(new2+1);
       int new4 = new3.indexOf('\n');
       String new5 = new3.substring(0,new4);
      
       Serial.println("Topic: relay/subscribe");
       Serial.print("Message is: ");
       Serial.println(new5);
       new5.remove(new5.length()-1);
       if(new5 == "{\"relay1\":{\"on\":1}}")
       {
        Serial.println("relay1 ON");
        pcf8574_o.digitalWrite(P0, LOW);


      Serial.println("Publishing Message: relay1 ON");
      Serial2.println("AT+CMQTTTOPIC=0,18"); //AT Command for Setting up the Publish Topic Name
      delay(1000);
      Serial2.println(Publish); //Topic Name
      delay(1000);
      Serial2.println("AT+CMQTTPAYLOAD=0,19"); //Payload length
      delay(1000);
      Serial2.println("{\"relay1\":{\"on\":1}}"); //Payload message
      delay(1000);
      Serial2.println("AT+CMQTTPUB=0,1,60"); //Acknowledgment
      delay(1000);
       
       }
       else if(new5 == "{\"relay1\":{\"on\":0}}")
       {
        Serial.println("relay1 OFF");
        pcf8574_o.digitalWrite(P0, HIGH);

      
      Serial.println("Publishing Message: relay1 OFF");
      Serial2.println("AT+CMQTTTOPIC=0,18"); //AT Command for Setting up the Publish Topic Name
      delay(1000);
      Serial2.println(Publish); //Topic Name
      delay(1000);
      Serial2.println("AT+CMQTTPAYLOAD=0,19"); //Payload length
      delay(1000);
      Serial2.println("{\"relay1\":{\"on\":0}}"); //Payload message
      delay(1000);
      Serial2.println("AT+CMQTTPUB=0,1,60"); //Acknowledgment
      delay(1000);      
             
       }
    }     
  }
}

Print this item

  [Arduino IDE demo source code for KC868-A8S]--#13-KC868-A8S_sms-relay_code
Posted by: KinCony Support - 06-30-2022, 12:54 AM - Forum: KC868-A8S - No Replies

[Arduino IDE demo source code for KC868-A8S]--#13-KC868-A8S_sms-relay_code
// make sure set your Serial2 pins in your "HardwareSerial.cpp" for ESP32 as follows:
//#define RX2  15
//#define TX2  13



Code:
// code use for KinCony KC868-A8S board

#include "PCF8574.h"
#include <DS18B20.h>
String incomingData;
String message;
const char phone[] = "xxxxxxxxxxx";  // replace with your mobile phone number
DS18B20 ds(14);


// Set i2c address
PCF8574 pcf8574_o(0x24,4,5);
PCF8574 pcf8574_i(0x22,4,5);

void setup() {
pinMode(2, OUTPUT);   //beep

Serial.begin(115200);
Serial2.begin(115200);

   // set gsm module to tp show the output on serial out
Serial2.print("AT+CNMI=2,2,0,0,0\r");
delay(100);
 
pcf8574_o.pinMode(P0, OUTPUT);
pcf8574_o.pinMode(P1, OUTPUT);
pcf8574_o.pinMode(P2, OUTPUT);
pcf8574_o.pinMode(P3, OUTPUT);
pcf8574_o.pinMode(P4, OUTPUT);
pcf8574_o.pinMode(P5, OUTPUT);
pcf8574_o.pinMode(P6, OUTPUT);
pcf8574_o.pinMode(P7, OUTPUT);

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


Serial.print("Init pcf8574_output...");
  if (pcf8574_o.begin()){
    Serial.println("OK");
  }else{
    Serial.println("KO");
       }

Serial.print("Init pcf8574_input...");
  if (pcf8574_i.begin()){
    Serial.println("OK");
  }else{
    Serial.println("KO");
       }


pcf8574_o.digitalWrite(P0, HIGH);
pcf8574_o.digitalWrite(P1, HIGH);
pcf8574_o.digitalWrite(P2, HIGH);
pcf8574_o.digitalWrite(P3, HIGH);
pcf8574_o.digitalWrite(P4, HIGH);
pcf8574_o.digitalWrite(P5, HIGH);
pcf8574_o.digitalWrite(P6, HIGH);
pcf8574_o.digitalWrite(P7, HIGH);

Serial.print(ds.getTempC());

Serial.print("start test");

Serial2.print("AT+CMGF=1\r");  //Set text mode
/* digitalWrite(2, HIGH);
delay(200); 
digitalWrite(2, LOW);
delay(200);
digitalWrite(2, HIGH);
delay(200); 
digitalWrite(2, LOW);*/
}

void loop() {
// if received command is to turn on relay
  receive_message();

  if(incomingData.indexOf("relay1-on")>=0)
  {
    pcf8574_o.digitalWrite(P0, LOW);
    message = "Relay1 is turned ON";
    // Send a sms back to confirm that the relay is turned on
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);
  }
 
  // if received command is to turn off relay
  if(incomingData.indexOf("relay1-off")>=0)
  {
    pcf8574_o.digitalWrite(P0, HIGH);
    message = "Relay1 is turned OFF";
    // Send a sms back to confirm that the relay is turned off
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);
  }
 
  if(incomingData.indexOf("relay2-on")>=0)
  {
    pcf8574_o.digitalWrite(P1, LOW);
    message = "Relay2 is turned ON";
    // Send a sms back to confirm that the relay is turned on
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);
  }
 
  // if received command is to turn off relay
  if(incomingData.indexOf("relay2-off")>=0)
  {
    pcf8574_o.digitalWrite(P1, HIGH);
    message = "Relay2 is turned OFF";
    // Send a sms back to confirm that the relay is turned off
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);
  } 
 
  if(incomingData.indexOf("relay3-on")>=0)
  {
    pcf8574_o.digitalWrite(P2, LOW);
    message = "Relay3 is turned ON";
    // Send a sms back to confirm that the relay is turned on
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);
  }
 
  // if received command is to turn off relay
  if(incomingData.indexOf("relay3-off")>=0)
  {
    pcf8574_o.digitalWrite(P2, HIGH);
    message = "Relay3 is turned OFF";
    // Send a sms back to confirm that the relay is turned off
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);
  } 
 
  if(incomingData.indexOf("relay4-on")>=0)
  {
    pcf8574_o.digitalWrite(P3, LOW);
    message = "Relay4 is turned ON";
    // Send a sms back to confirm that the relay is turned on
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);     
  }
 
  // if received command is to turn off relay
  if(incomingData.indexOf("relay4-off")>=0)
  {
    pcf8574_o.digitalWrite(P3, HIGH);
    message = "Relay4 is turned OFF";
    // Send a sms back to confirm that the relay is turned off
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);     
  } 
 
  if(incomingData.indexOf("relay5-on")>=0)
  {
    pcf8574_o.digitalWrite(P4, LOW);
    message = "Relay5 is turned ON";
    // Send a sms back to confirm that the relay is turned on
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);     
  }
 
  // if received command is to turn off relay
  if(incomingData.indexOf("relay5-off")>=0)
  {
    pcf8574_o.digitalWrite(P4, HIGH);
    message = "Relay5 is turned OFF";
    // Send a sms back to confirm that the relay is turned off
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);     
  } 
 
  if(incomingData.indexOf("relay6-on")>=0)
  {
    pcf8574_o.digitalWrite(P5, LOW);
    message = "Relay6 is turned ON";
    // Send a sms back to confirm that the relay is turned on
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);     
  }
 
  // if received command is to turn off relay
  if(incomingData.indexOf("relay6-off")>=0)
  {
    pcf8574_o.digitalWrite(P5, HIGH);
    message = "Relay6 is turned OFF";
    // Send a sms back to confirm that the relay is turned off
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);     
  } 
 
  if(incomingData.indexOf("relay7-on")>=0)
  {
    pcf8574_o.digitalWrite(P6, LOW);
    message = "Relay7 is turned ON";
    // Send a sms back to confirm that the relay is turned on
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);     
  }
 
  // if received command is to turn off relay
  if(incomingData.indexOf("relay7-off")>=0)
  {
    pcf8574_o.digitalWrite(P6, HIGH);
    message = "Relay7 is turned OFF";
    // Send a sms back to confirm that the relay is turned off
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);     
  } 
 
  if(incomingData.indexOf("relay8-on")>=0)
  {
    pcf8574_o.digitalWrite(P7, LOW);
    message = "Relay8 is turned ON";
    // Send a sms back to confirm that the relay is turned on
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);     
  }
 
  // if received command is to turn off relay
  if(incomingData.indexOf("relay8-off")>=0)
  {
    pcf8574_o.digitalWrite(P7, HIGH);
    message = "Relay8 is turned OFF";
    // Send a sms back to confirm that the relay is turned off
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);     
  } 
 
  if(incomingData.indexOf("all-on")>=0)
  {
    pcf8574_o.digitalWrite(P0, LOW);
    pcf8574_o.digitalWrite(P1, LOW);
    pcf8574_o.digitalWrite(P2, LOW);
    pcf8574_o.digitalWrite(P3, LOW);
    pcf8574_o.digitalWrite(P4, LOW);
    pcf8574_o.digitalWrite(P5, LOW);
    pcf8574_o.digitalWrite(P6, LOW);
    pcf8574_o.digitalWrite(P7, LOW);
    message = "All relay are turned ON";
    // Send a sms back to confirm that the relay is turned off
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);     
  }   
 
  if(incomingData.indexOf("all-off")>=0)
  {
    pcf8574_o.digitalWrite(P0, HIGH);
    pcf8574_o.digitalWrite(P1, HIGH);
    pcf8574_o.digitalWrite(P2, HIGH);
    pcf8574_o.digitalWrite(P3, HIGH);
    pcf8574_o.digitalWrite(P4, HIGH);
    pcf8574_o.digitalWrite(P5, HIGH);
    pcf8574_o.digitalWrite(P6, HIGH);
    pcf8574_o.digitalWrite(P7, HIGH);
    message = "All relay are turned OFF";
    // Send a sms back to confirm that the relay is turned off
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);     
  }     
 
  if(incomingData.indexOf("temper")>=0)
  {
   
    message = "Temperature is "+String(ds.getTempC(),2)+" C";
    send_message(message);
    Serial2.println("AT+CMGD=1,4");  //delete all SMS on SIM card
    delay(100);     
  }   


  incomingData="";

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

  if (val1==LOW)
   {
     Serial.println("input1 trigger");
     pcf8574_o.digitalWrite(P0, LOW);
     delay(5000);
     pcf8574_o.digitalWrite(P0, HIGH);
     
     message = "door sensor is triggered,someone in the room!";
     send_message(message);
     delay(100);
   }

  if (val2==LOW)
   {
     Serial.println("input2 trigger");
     pcf8574_o.digitalWrite(P0, LOW);
     delay(5000);
     pcf8574_o.digitalWrite(P0, HIGH);
     
     message = "window sensor is triggered,someone in the room!";
     send_message(message);
     delay(100);
   }

  if (val3==LOW)
   {
     Serial.println("input3 trigger");
     message = "sensor3 is triggered,someone in the room!";
     send_message(message);
     delay(100);
   }

  if (val4==LOW)
   {
     Serial.println("input4 trigger");   
     message = "sensor4 is triggered,someone in the room!";
     send_message(message);
     delay(100);
   }

  if (val5==LOW)
   {
     Serial.println("input5 trigger");     
     message = "sensor5 is triggered,someone in the room!";
     send_message(message);
     delay(100);
   }

  if (val6==LOW)
   {
     Serial.println("input6 trigger");     
     message = "sensor6 is triggered,someone in the room!";
     send_message(message);
     delay(100);
   }

  if (val7==LOW)
   {
     Serial.println("input7 trigger");   
     message = "sensor7 is triggered,someone in the room!";
     send_message(message);
     delay(100);
   }

  if (val8==LOW)
   {
     Serial.println("input8 trigger");     
     message = "sensor8 is triggered,someone in the room!";
     send_message(message);
     delay(100);
   }
delay(200);
}

void receive_message()
{
  if (Serial2.available() > 0)
  {
    incomingData = Serial2.readString(); // Get the data from the serial port.
    Serial.print(incomingData);
    delay(10);
  }
}

void send_message(String message)
{
  Serial2.println("AT+CMGF=1");    //Set the GSM Module in Text Mode
  delay(100); 
  Serial2.print("AT+CMGS=\""+String(phone)+"\"\r"); //Send message
  delay(100);
  Serial2.println(message);   // The SMS text you want to send
  delay(100);
  Serial2.println((char)26);  // ASCII code of CTRL+Z
  delay(100);
  Serial2.println();
  delay(100); 
}

Print this item

  [Arduino IDE demo source code for KC868-A8S]--#12-KC868-A8S_sms_code
Posted by: KinCony Support - 06-30-2022, 12:52 AM - Forum: KC868-A8S - No Replies

[Arduino IDE demo source code for KC868-A8S]--#12-KC868-A8S_sms_code

Code:
//code use for KC868-A8S board
const char phone[] = "13100000000";  //replace for your mobile phone number

int data;
String message;
unsigned long int last;

void setup()
{

Serial.begin(115200);
Serial2.begin(115200);
 
 
  Serial.print("start test");

  send_sms("Test message from KinCony KC868-A8S");
}

void loop()
{
check_sms_responce();
}

void send_sms ( String sms)
{
      Serial2.print("AT+CMGF=1\r");  //Set text mode
      delay(1000);
      Serial2.print("AT+CMGS=\""+String(phone)+"\"\r"); //Send message
      delay(1000);
      Serial2.print(sms);//Text message
      Serial2.println((char)0x1A); //Ctrl+Z
}

void check_sms_responce()
{
   if(Serial2.available()>0)
  {
    delay(60);
    message="";
    while(Serial2.available())
    {
      message+=(char)Serial2.read();
    }
    Serial.print(message);
  }
}

Print this item

  [Arduino IDE demo source code for KC868-A8S]--#11-KC868-A8S_AT-debug_code
Posted by: KinCony Support - 06-30-2022, 12:49 AM - Forum: KC868-A8S - Replies (1)

[Arduino IDE demo source code for KC868-A8S]--#11-KC868-A8S_AT-debug_code

Code:
void setup() {
  Serial.begin(115200);
  Serial2.begin(115200);
}

void loop() {
  while (Serial.available()) {
      delay(1);
      Serial2.write(Serial.read());
  }
  while (Serial2.available()) {
       Serial.write(Serial2.read());
  }
}

Print this item

Question Dimmer D8 lost Ethernet connection after reset
Posted by: KjetilK - 06-28-2022, 09:45 PM - Forum: KC868-HxB series Smart Controller - Replies (3)

Hi! I was just setting up a KC868-D8 dimmer controller that I bought some time ago.

Initially, it came up without problems, and I was able to control the one dimmer circuit I attached to it using the Web interface. Cool . It got an IP from the DHCP server in the LAN, I have it configured to give addresses in the 172.22.0.0/16 range.

Then I changed the passwords, since I don't like to have default passwords around for security. The server came back up again, but I couldn't log in, though I'm pretty sure I entered the correct password. So, thinking it would reset the password, I hit the reset button.

But now to the biggest problem: It does not connect to my network now.

I see no traffic from it in my logs, it doesn't contact the DHCP server, its MAC is listed as incomplete with arp, and there is also no response at 192.168.1.200:4196 (which is not strange, since that address wouldn't be allowed in my network).

What could be the reason for this and how do I fix it?

Could it possibly be that it insists on the 192.168.1.200 address, and so it doesn't ask the DHCP server?

Print this item

  KC868 A4 - Wifi Lost
Posted by: mfjunior96 - 06-27-2022, 01:37 PM - Forum: KC868-A4 - Replies (5)

Goodnight,

I have a problem with my KC868 A4 board - I made her code, to use it with alexa, but in about 10 days (it varies a lot) when asking for a command through alexa it doesn't find the devices, as if it had no wifi connection, so I click the reset button and it works normally again, has this happened to anyone?

thanks in advance



Attached Files
.zip   Casa_A4_Digital_Wifi_IR_LED.zip (Size: 1.5 KB / Downloads: 562)
Print this item

  Lesson34- how to send SMS by AT command
Posted by: admin - 06-27-2022, 01:40 AM - Forum: KC868-A series and Uair Smart Controller - No Replies

this demo send a sms "Test message from KinCony KC868-A8S" to your mobile phone.

here is arduino IDE source code: 
.zip   sms.zip (Size: 565 bytes / Downloads: 976)

Print this item

  Lesson36- remote control relay by KC868-A8S 4G module via MQTT AT command
Posted by: admin - 06-26-2022, 12:38 AM - Forum: KC868-A series and Uair Smart Controller - No Replies

MQTT AT command debug for KC868-A8S:

publish message to MQTT broker:

1. AT+CMQTTSTART
2. AT+CMQTTACCQ=0,"KinCony1"
3. AT+CMQTTCONNECT=0,"tcp://iot.kincony.com:1883",120,1,"mqtt","123"
4. AT+CMQTTTOPIC=0,18
5. > relay8/12345/state
6. AT+CMQTTPAYLOAD=0,19
7. > {"relay1":{"on":1}}
8. AT+CMQTTPUB=0,1,60

this is puslish a message for update MQTT broker relay state when relay1 is ON

subscribe topic from MQTT broker:

AT+CMQTTSUB=0,16,1,1
relay8/12345/set

will receive example message:

+CMQTTRXSTART: 0,16,3
+CMQTTRXTOPIC: 0,16
relay8/12345/set
+CMQTTRXPAYLOAD: 0,3
abc
+CMQTTRXEND: 0

this is demo for receive message: abc

+CMQTTRXSTART: 0,16,19
+CMQTTRXTOPIC: 0,16
relay8/12345/set
+CMQTTRXPAYLOAD: 0,19
{"relay1":{"on":0}}
+CMQTTRXEND: 0

this is demo for receive message: {"relay1":{"on":0}}


here is arduino IDE source code: 
.zip   mqtt-relay.zip (Size: 1.35 KB / Downloads: 648)

.pdf   SIM7500_SIM7600 Series_MQTT_ATC_V1.01.pdf (Size: 740.41 KB / Downloads: 750)

Print this item

  Lesson35- use SMS control relay and read temperature sensor
Posted by: admin - 06-26-2022, 12:22 AM - Forum: KC868-A series and Uair Smart Controller - Replies (9)

send SMS text:

1. turn on/off one relay:

relay1-on    turn ON relay1
relay1-off    turn OFF relay1
relay2-on    turn ON relay2
relay2-off    turn OFF relay2
relay3-on    turn ON relay3
relay3-off    turn OFF relay3
relay4-on    turn ON relay4
relay4-off    turn OFF relay4
relay5-on    turn ON relay5
relay5-off    turn OFF relay5
relay6-on    turn ON relay6
relay6-off    turn OFF relay6
relay7-on    turn ON relay7
relay7-off    turn OFF relay7
relay8-on    turn ON relay8
relay8-off    turn OFF relay8

2. turn on/off all relay:

all-on  turn ON relay1-8
all-off  turn OFF relay1-8

3. read current temperature value:

temper      read DS18B20 temperature sensor data

4. digital input for sensor trigger output

a. if input1 trigger, (siren) relay1 ON -> 3 seconds -> relay1 OFF -> send SMS: door sensor is triggered,someone in the room!
b. if input2 trigger, (siren) relay1 ON -> 3 seconds -> relay1 OFF -> send SMS: window sensor is triggered,someone in the room!
c. if input3 trigger, send SMS: sensor3 is triggered,someone in the room!
d. if input4 trigger, send SMS: sensor4 is triggered,someone in the room!
e. if input5 trigger, send SMS: sensor5 is triggered,someone in the room!
f.  if input6 trigger, send SMS: sensor6 is triggered,someone in the room!
g. if input7 trigger, send SMS: sensor7 is triggered,someone in the room!
h. if input8 trigger, send SMS: sensor8 is triggered,someone in the room!


here is arduino IDE source code: 
.zip   sms-relay.zip (Size: 1.71 KB / Downloads: 703)

Print this item