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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 6,598
» Latest member: gregoryx
» Forum threads: 2,930
» Forum posts: 15,541

Full Statistics

Online Users
There are currently 12 online users.
» 0 Member(s) | 5 Guest(s)
Amazonbot, PetalBot, bot

Latest Threads
KC868-M16v2 configure yam...
Forum: KC868-M16 / M1 / MB / M30
Last Post: admin
7 hours ago
» Replies: 52
» Views: 5,526
KC868-A8M circuit diagram
Forum: KC868-A8M
Last Post: admin
7 hours ago
» Replies: 2
» Views: 855
KC868-AG ESP32 I/O pin de...
Forum: KC868-AG / AG Pro / AG8
Last Post: admin
Yesterday, 12:23 PM
» Replies: 12
» Views: 2,617
Low output voltage
Forum: KC868-A16
Last Post: twostar
Yesterday, 11:59 AM
» Replies: 2
» Views: 21
Tuya adapter V2 arduino s...
Forum: KC868-ATC / Tuya adapter V2
Last Post: admin
Yesterday, 01:18 AM
» Replies: 2
» Views: 247
Dummy question: non-zero ...
Forum: T16M
Last Post: jarekD
04-05-2025, 09:00 AM
» Replies: 9
» Views: 165
BM16 Problems
Forum: B16M
Last Post: PWJ
04-04-2025, 08:51 AM
» Replies: 2
» Views: 25
M30 negative power
Forum: KC868-M16 / M1 / MB / M30
Last Post: admin
04-04-2025, 12:10 AM
» Replies: 3
» Views: 24
KC868-A16 analog input
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
04-04-2025, 12:10 AM
» Replies: 5
» Views: 321
KC868-D16 firmware update
Forum: KC868-HxB series Smart Controller
Last Post: admin
04-04-2025, 12:03 AM
» Replies: 1
» Views: 18

  Questions about Analog Inputs KC868-A16
Posted by: Decilitr - 01-19-2025, 08:00 PM - Forum: KC868-A16 - Replies (9)

Hi all!
I received my KC868-A16 board and now experimenting with it. My goal is to use it for Home Assistant.
Digital inputs and outputs work fine, but there are some confusing points with analog inputs.
I would appreciate clarification.

1. I used the lines from the example .yaml file and it turned out that because of the lines
------------------------------------
    filters:
      - lambda:
          if (x >= 3.11) {
            return x * 1.60256;
          } else if (x <= 0.15) {
            return 0;
          } else {
            return x * 1.51;
          }
------------------------------------
the measured voltage values were greatly inflated. So I removed these lines from my .yaml file and the voltage values became correct.
What were these lines in the original example for anyway?

2. When the same voltage is applied simultaneously to all four analog inputs, the spread of readings between them is no more than 5%. This is very good accuracy, but can it be increased by changing the parameter "attenuation: 11db" ?

3. When connecting each of the analog inputs to ground, the voltage value is not 0V but 0.14V
Is there any way to fix this?

4. And the main problem. When the input voltage changes from minimum to 3.14V, its value is displayed correctly. However, when the input voltage increases from 3.14V to 5V, it stops changing and always shows 3.14V, which is obviously wrong.
What is the problem here?

Print this item

  analog input resolution 30%erro
Posted by: jltluc57 - 01-19-2025, 10:39 AM - Forum: KC868-A16 - Replies (16)

Hello

Can you tell me the resolution on the analog inputs.
Because for 1.5v in I visualize 2.01v which is 30% error..
That's a lot

Board A16



Attached Files Image(s)
       
Print this item

  NTP not update
Posted by: jltluc57 - 01-19-2025, 09:25 AM - Forum: KC868-A16 - Replies (22)

Hello

i have a problem with the NFP, in fact impossible to have a correct display with the right time zone.
What is the reading cycle of the NTP server?


The internet connection is good.
This NTP server works well on all my computers

The capture 3 is the time of my computer

Regards



Attached Files Image(s)
           
Print this item

  [arduino code examples for T16M]-06 digital INPUT trigger OUTPUT directly
Posted by: admin - 01-19-2025, 02:15 AM - Forum: T16M - No Replies

Code:
/*
* Made by KinCony IoT: https://www.kincony.com
*
* This program reads 16 input states from a PCF8575 I/O expander and
* controls a corresponding 16-channel relay module. When an input pin
* is LOW, the corresponding relay is turned ON (LOW means ON for the relay).
* When the input pin is HIGH, the corresponding relay is turned OFF.
*
* Pin Definitions:
* - SDA: GPIO 11
* - SCL: GPIO 12
* - Input I2C Address: 0x24
* - Relay I2C Address: 0x25
*/

#include <Wire.h>        // I2C communication
#include <PCF8575.h>     // Library to control the PCF8575 I/O expander

// Define I2C pins
#define SDA 11           // SDA pin
#define SCL 12           // SCL pin

// I2C addresses
#define INPUT_I2C_ADDRESS 0x24   // I2C address for the input PCF8575 module
#define RELAY_I2C_ADDRESS 0x25   // I2C address for the relay PCF8575 module

PCF8575 pcf8575_IN(INPUT_I2C_ADDRESS);    // Create an object for the input PCF8575
PCF8575 pcf8575_RL(RELAY_I2C_ADDRESS);    // Create an object for the relay PCF8575

void setup() {
  // Initialize I2C communication
  Wire.begin(SDA, SCL);
 
  // Initialize serial communication
  Serial.begin(115200);
 
  // Initialize input and relay modules
  pcf8575_IN.begin();
  pcf8575_RL.begin();
 
  // Turn off all relays at the start
  for (int i = 0; i < 16; i++) {
    pcf8575_RL.write(i, LOW);  // Assuming relays are LOW when OFF, setting all relays to OFF initially
  }
 
  Serial.println("System started: Input state controlling 16 relays");
}

void loop() {
  uint16_t inputState = 0;

  // Read the state of 16 inputs
  for (int i = 0; i < 16; i++) {
    if (pcf8575_IN.read(i)) {
      inputState |= (1 << i);  // If input is HIGH, set the corresponding bit
    } else {
      inputState &= ~(1 << i); // Otherwise, clear the corresponding bit
    }
  }
 
  // Control the relays based on the input state
  for (int i = 0; i < 16; i++) {
    if (inputState & (1 << i)) {
      pcf8575_RL.write(i, HIGH);  // If input is HIGH, turn the relay OFF
    } else {
      pcf8575_RL.write(i, LOW);   // If input is LOW, turn the relay ON
    }
  }

  // Delay for 500 milliseconds
  delay(500);
}
arduino ino file download: 
.zip   6-input-trigger-output.zip (Size: 1.02 KB / Downloads: 57)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:
.zip   6-input-trigger-output.ino.merged.zip (Size: 189.39 KB / Downloads: 53)

Print this item

  [arduino code examples for T16M]-05 Ethernet W5500 chip work with TCP Server mode
Posted by: admin - 01-19-2025, 02:13 AM - Forum: T16M - No Replies

Code:
/*
* Made by KinCony IoT: https://www.kincony.com
*
* This Arduino program sets up an ESP32-S3 with a W5500 Ethernet module
* as a TCP server. It listens on port 4196 and echoes back any string
* received from a client.
*
* Hardware connections:
* - CLK: GPIO42
* - MOSI: GPIO43
* - MISO: GPIO44
* - CS: GPIO41
* - RST: GPIO1
* - INT: GPIO2
*
* Static IP address: 192.168.3.55
* Subnet Mask: 255.255.255.0
* Gateway: 192.168.3.1
* DNS: 192.168.3.1
*/

#include <SPI.h>
#include <Ethernet.h>

// Define the W5500 Ethernet module pins
#define W5500_CS_PIN  41
#define W5500_RST_PIN 1
#define W5500_INT_PIN 2
#define W5500_CLK_PIN 42
#define W5500_MOSI_PIN 43
#define W5500_MISO_PIN 44

// MAC address for your Ethernet shield (must be unique on your network)
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// Static IP address configuration
IPAddress ip(192, 168, 3, 55);       // Static IP address
IPAddress subnet(255, 255, 255, 0);   // Subnet mask
IPAddress gateway(192, 168, 3, 1);    // Default gateway
IPAddress dns(192, 168, 3, 1);        // DNS server address

// Create an EthernetServer object to handle TCP connections
EthernetServer server(4196);

void setup() {
  // Initialize serial communication
  Serial.begin(115200);
  while (!Serial) {
    ; // Wait for serial port to connect
  }

  // Initialize the W5500 module
  pinMode(W5500_RST_PIN, OUTPUT);
  pinMode(W5500_INT_PIN, INPUT);
  digitalWrite(W5500_RST_PIN, LOW);  // Reset the W5500 module
  delay(100);                       // Wait for reset to complete
  digitalWrite(W5500_RST_PIN, HIGH); // Release reset

  // Initialize SPI with the correct pin definitions
  SPI.begin(W5500_CLK_PIN, W5500_MISO_PIN, W5500_MOSI_PIN);

  // Set up the Ethernet library with W5500-specific pins
  Ethernet.init(W5500_CS_PIN);

  // Start the Ethernet connection with static IP configuration
  Ethernet.begin(mac, ip, dns, gateway, subnet);

  // Print the IP address to the serial monitor
  Serial.print("IP Address: ");
  Serial.println(Ethernet.localIP());

  // Start listening for incoming TCP connections
  server.begin();
}

void loop() {
  // Check for incoming client connections
  EthernetClient client = server.available();
  if (client) {
    Serial.println("New client connected");

    // Read data from the client and echo it back
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        server.write(c);
      }
    }

    // Close the connection when done
    client.stop();
    Serial.println("Client disconnected");
  }
}
arduino ino file download: 
.zip   5-Ethernet-W5500.zip (Size: 1.23 KB / Downloads: 51)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download: 
.zip   5-Ethernet-W5500.ino.merged.zip (Size: 188.93 KB / Downloads: 52)

Print this item

  [arduino code examples for T16M]-04 Read free GPIO state
Posted by: admin - 01-19-2025, 02:11 AM - Forum: T16M - Replies (2)

Code:
/*
* Made by KinCony IoT: https://www.kincony.com
*
* GPIO Status Monitoring
*
* This program monitors the status (high or low) of multiple GPIO pins on the ESP32-S3.
* It prints the status of the pins to the serial monitor whenever a change is detected.
*
* GPIO Pins Monitored:
* - GPIO 8
* - GPIO 9
* - GPIO 10
* - GPIO 15
* - GPIO 16
* - GPIO 17
* - GPIO 18
* - GPIO 0
*
* Hardware Requirements:
* - Connect the pins to appropriate devices or pull them to HIGH/LOW for testing
*/

#define GPIO_PIN_8 8
#define GPIO_PIN_9 9
#define GPIO_PIN_10 10
#define GPIO_PIN_15 15
#define GPIO_PIN_16 16
#define GPIO_PIN_17 17
#define GPIO_PIN_18 18
#define GPIO_PIN_0 0

// Store the previous state of the GPIO pins
bool prevState[8] = {false, false, false, false, false, false, false, false};

void setup() {
  // Initialize serial communication for debugging purposes
  Serial.begin(115200); // Initialize the serial monitor at 115200 baud
  while (!Serial);      // Wait for the serial monitor to open

  // Initialize GPIO pins as inputs
  pinMode(GPIO_PIN_8, INPUT);
  pinMode(GPIO_PIN_9, INPUT);
  pinMode(GPIO_PIN_10, INPUT);
  pinMode(GPIO_PIN_15, INPUT);
  pinMode(GPIO_PIN_16, INPUT);
  pinMode(GPIO_PIN_17, INPUT);
  pinMode(GPIO_PIN_18, INPUT);
  pinMode(GPIO_PIN_0, INPUT);

  Serial.println("GPIO Status Monitoring Started");
}

void loop() {
  // Read the current state of each GPIO pin
  bool currentState[8];
  currentState[0] = digitalRead(GPIO_PIN_8);
  currentState[1] = digitalRead(GPIO_PIN_9);
  currentState[2] = digitalRead(GPIO_PIN_10);
  currentState[3] = digitalRead(GPIO_PIN_15);
  currentState[4] = digitalRead(GPIO_PIN_16);
  currentState[5] = digitalRead(GPIO_PIN_17);
  currentState[6] = digitalRead(GPIO_PIN_18);
  currentState[7] = digitalRead(GPIO_PIN_0);

  // Check for changes in GPIO pin states
  for (int i = 0; i < 8; i++) {
    if (currentState[i] != prevState[i]) {
      // Print the pin number and its new state if it has changed
      Serial.print("GPIO ");
      Serial.print(i == 0 ? GPIO_PIN_8 :
                   i == 1 ? GPIO_PIN_9 :
                   i == 2 ? GPIO_PIN_10 :
                   i == 3 ? GPIO_PIN_15 :
                   i == 4 ? GPIO_PIN_16 :
                   i == 5 ? GPIO_PIN_17 :
                   i == 6 ? GPIO_PIN_18 : GPIO_PIN_0);
      Serial.print(" changed to ");
      Serial.println(currentState[i] ? "HIGH" : "LOW");
      // Update the previous state
      prevState[i] = currentState[i];
    }
  }

  // Delay to avoid flooding the serial monitor
  delay(100); // Adjust the delay as needed
}
arduino ino file download: 
.zip   4-free-gpio-state.zip (Size: 1.04 KB / Downloads: 44)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:
.zip   4-free-gpio-state.ino.merged.zip (Size: 179.58 KB / Downloads: 52)

Print this item

  [arduino code examples for T16M]-03 RS485 communication test
Posted by: admin - 01-19-2025, 02:10 AM - Forum: T16M - No Replies

Code:
/*
* Made by KinCony IoT: https://www.kincony.com
*
* RS485 Communication Test
*
* This program is a simple test for RS485 communication using ESP32-S3.
* It will send a message over RS485 and then read incoming messages.
* The TXD pin is defined as GPIO 18 and RXD pin is defined as GPIO 8.
*/

#include <HardwareSerial.h>

// Define RS485 pins
#define RS485_RXD 14
#define RS485_TXD 13

// Create a hardware serial object
HardwareSerial rs485Serial(1);

void setup() {
  // Start serial communication for debugging
  Serial.begin(115200);
  while (!Serial);

  // Initialize RS485 Serial communication
  rs485Serial.begin(9600, SERIAL_8N1, RS485_RXD, RS485_TXD);
 
  Serial.println("RS485 Test Start");
}

void loop() {
  // Send a test message
  rs485Serial.println("Hello from KinCony T16M!");

  // Wait for a short period
  delay(1000);

  // Check if data is available to read
  if (rs485Serial.available()) {
    String receivedMessage = "";
    while (rs485Serial.available()) {
      char c = rs485Serial.read();
      receivedMessage += c;
    }
    // Print the received message
    Serial.print("Received: ");
    Serial.println(receivedMessage);
  }

  // Wait before sending the next message
  delay(2000);
}
arduino ino file download: 
.zip   3-RS485-Test.zip (Size: 763 bytes / Downloads: 49)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download: 
.zip   3-RS485-Test.ino.merged.zip (Size: 184.35 KB / Downloads: 44)

Print this item

  [arduino code examples for T16M]-02 Read digital input ports state
Posted by: admin - 01-19-2025, 02:08 AM - Forum: T16M - No Replies

Code:
/*
* Made by KinCony IoT: https://www.kincony.com
*
* Description:
* This Arduino program reads the state of a 16-channel PCF8575 I/O expander
* and prints the state of all input pins to the Serial Monitor. The state of
* each pin is represented as a bit in a 16-bit value, where each bit corresponds
* to an input pin. The program prints the input state in binary format.
*
* Pin Definitions:
* - SDA: GPIO 11
* - SCL: GPIO 12
* - PCF8575 I2C Address: 0x24
*/

#include "Arduino.h"
#include "PCF8575.h"

// Define I2C pins
#define I2C_SDA 11  // Define SDA pin
#define I2C_SCL 12  // Define SCL pin

// Set I2C address
PCF8575 pcf8575_IN1(0x24); // The I2C address of the PCF8575

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

    // Initialize I2C communication
    Wire.begin(I2C_SDA, I2C_SCL); // Initialize I2C with defined SDA and SCL pins

    pcf8575_IN1.begin(); // Initialize the PCF8575

    Serial.println("KinCony F16 16 channel input state 0:ON  1:OFF");
}

void loop() {
    uint16_t state = 0;

    // Read the state of each pin (assuming 16 pins)
    for (int pin = 0; pin < 16; pin++) {
        if (pcf8575_IN1.read(pin)) {
            state |= (1 << pin); // Set the bit for the active pin
        }
    }

    Serial.print("Input state: ");
    Serial.println(state, BIN); // Print the state of inputs in binary

    delay(500); // Delay 500ms
}
arduino ino file download:
.zip   2-digital-input.zip (Size: 839 bytes / Downloads: 48)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download: 
.zip   2-digital-input.ino.merged.zip (Size: 189.53 KB / Downloads: 47)

Print this item

  [arduino code examples for T16M]-01 Turn ON/OFF OUTPUT
Posted by: admin - 01-19-2025, 02:07 AM - Forum: T16M - No Replies

Code:
/*
* Made by KinCony IoT: https://www.kincony.com
*
* This program controls a 16-channel relay board via a PCF8575 I/O expander.
* It sequentially turns on each relay and then turns them off in a loop.
*
* Pin Definitions:
* - SDA: GPIO 11
* - SCL: GPIO 12
*
* Delay Time:
* - 200 milliseconds between switching relays
*/

#include <Wire.h>        // Include the Wire library for I2C communication
#include <PCF8575.h>     // Include the PCF8575 library to control the I/O expander

#define SDA 11           // Define the SDA pin
#define SCL 12           // Define the SCL pin
#define DELAY_TIME 200   // Define the delay time in milliseconds

// Set I2C address of the PCF8575 module
#define I2C_ADDRESS 0x25 // I2C address of the PCF8575 module

PCF8575 pcf8575_R1(I2C_ADDRESS); // Create a PCF8575 object with the specified I2C address

void setup() {
  // Initialize I2C communication
  Wire.begin(SDA, SCL); // SDA on GPIO 8, SCL on GPIO 18 (according to your board's configuration)
 
  // Initialize serial communication for debugging (optional)
  Serial.begin(115200);
  Serial.println("PCF8575 Relay Control: Starting...");

  // Initialize the PCF8575 module
  pcf8575_R1.begin();

  // Turn off all relays initially (set all pins HIGH)
  for (int i = 0; i < 16; i++) {
    pcf8575_R1.write(i, HIGH); // Set all relays to OFF (assuming HIGH means OFF for relays)
  }
}

void loop() {
  // Sequentially turn on each relay
  for (int i = 0; i < 16; i++) {
    pcf8575_R1.write(i, LOW);   // Turn on the relay at pin i (LOW means ON for the relay)
    delay(DELAY_TIME);          // Wait for DELAY_TIME milliseconds
  }

  // Sequentially turn off each relay
  for (int i = 0; i < 16; i++) {
    pcf8575_R1.write(i, HIGH);  // Turn off the relay at pin i (HIGH means OFF for the relay)
    delay(DELAY_TIME);          // Wait for DELAY_TIME milliseconds
  }
}
arduino ino file download:

.zip   1-output.zip (Size: 929 bytes / Downloads: 48)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:

.zip   1-output.ino.merged.zip (Size: 189.22 KB / Downloads: 46)

Print this item

  KC868-ATC v1.4 connect to H32 rev 2.3
Posted by: SrgX13 - 01-18-2025, 04:23 PM - Forum: KC868-ATC / Tuya adapter V2 - Replies (5)

Hello,
I have been trying for a few days to set up the KC868-ATC v1.4 with Tuya module to connect to KC868-H32 rev 2.3 and control the relays. I managed to set the KC868-ATC  Tuya module and connect using Tuya mobile App (Android), however the button/switches are not responding. 
The weird part is that I can connect to  KC868-H32 using Vircom and the IP seems to be set to 192.168.2.160 (we are using 192.168.2.x ranges). From what I have seen in the referred videos is that I should also be able to connect using the browser however this is failing.  KC868-H32 is connected to the router through Ethernet cable

I have even tried to set  KC868-ATC v1.4 to use RS232 instead of wifi. This had the same negative results.

If you require more information please let me know.
Please help me with some ideas how to set this system. I assume that I might have to change the firmware on KC868-H32 as in Tuya it was showing H32B PRO
Thank you very much and I wish you a great day

Print this item