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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 9,078
» Latest member: ashutoshsinghrajput0025
» Forum threads: 3,989
» Forum posts: 20,253

Full Statistics

Online Users
There are currently 36 online users.
» 0 Member(s) | 22 Guest(s)
Amazonbot, Applebot, Baidu, Bing, Bytespider, PetalBot, bot

Latest Threads
problem with kc868 has v2
Forum: News
Last Post: Gianfranco Pepi
1 hour ago
» Replies: 3
» Views: 17
Cant flash esphom
Forum: B16M
Last Post: H_spadacini
8 hours ago
» Replies: 9
» Views: 641
Las Firmware ?
Forum: KC868-A16
Last Post: admin
8 hours ago
» Replies: 3
» Views: 44
CRC Errors with ESP Home ...
Forum: N60
Last Post: admin
Yesterday, 07:43 AM
» Replies: 3
» Views: 12
KC868-A8 ethernet work wi...
Forum: KC868-A8
Last Post: admin
Yesterday, 12:23 AM
» Replies: 9
» Views: 7,382
RS485
Forum: DIY Project
Last Post: admin
Yesterday, 12:21 AM
» Replies: 4
» Views: 35
N30 no Energy (kWh)
Forum: "KCS" v3 firmware
Last Post: admin
05-19-2026, 10:21 PM
» Replies: 13
» Views: 159
Questions about KinCony F...
Forum: F16
Last Post: admin
05-19-2026, 12:12 PM
» Replies: 1
» Views: 15
"KCS" v3.25.0 firmware BI...
Forum: "KCS" v3 firmware
Last Post: admin
05-19-2026, 12:03 PM
» Replies: 2
» Views: 203
Energy calculation for ne...
Forum: N30
Last Post: GWS
05-19-2026, 06:23 AM
» Replies: 4
» Views: 53

  [arduino code examples for B16M]-04 RS485 communication test
Posted by: admin - 09-27-2024, 02:26 AM - Forum: B16M - 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 8
#define RS485_TXD 18

// 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 F16!");

  // 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   4-RS485-Test.zip (Size: 762 bytes / Downloads: 537)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download: 
.zip   4-RS485-Test.ino.merged.zip (Size: 184.53 KB / Downloads: 503)

Print this item

  [arduino code examples for B16M]-03 Read ADS1115 analog input ports value
Posted by: admin - 09-27-2024, 02:24 AM - Forum: B16M - No Replies

Code:
/*
* This program reads voltage values from the ADS1115 analog-to-digital converter
* on all four channels (A0, A1, A2, A3) and prints the results through the serial port.
* The ADS1115 communicates via the I2C protocol. This version of the code includes
* the capability to specify custom SDA and SCL pins for I2C communication.
*
* Copyright: Made by KinCony IoT: https://www.kincony.com
*
*/

#include <Wire.h>                // Library for I2C communication
#include <DFRobot_ADS1115.h>     // Library for ADS1115 ADC module

// Define the I2C SDA and SCL pins for communication with ADS1115
#define SDA_PIN 38 
#define SCL_PIN 39 

// Initialize ADS1115 instance using the Wire library
DFRobot_ADS1115 ads(&Wire);

void setup(void)
{
    // Begin serial communication at a baud rate of 115200
    Serial.begin(115200);

    // Initialize the I2C bus using the defined SDA and SCL pins
    Wire.begin(SDA_PIN, SCL_PIN);

    // Set the I2C address for the ADS1115 (default: 0x49)
    ads.setAddr_ADS1115(ADS1115_IIC_ADDRESS0);   // Address is 0x49

    // Set the gain for the ADS1115 (2/3x gain allows for a maximum input voltage of 6.144V)
    ads.setGain(eGAIN_TWOTHIRDS);

    // Set the ADS1115 to operate in single-shot mode (each reading is a single conversion)
    ads.setMode(eMODE_SINGLE);

    // Set the sample rate to 128 samples per second (SPS)
    ads.setRate(eRATE_128);

    // Set the operational status mode to single-conversion start
    ads.setOSMode(eOSMODE_SINGLE);

    // Initialize the ADS1115 module
    ads.init();
}

void loop(void)
{
    // Check if the ADS1115 is properly connected and functioning
    if (ads.checkADS1115())
    {
        // Variables to store the voltage readings for each channel
        int16_t adc0, adc1, adc2, adc3;

        // Read the voltage from channel A0 and print the value
        adc0 = ads.readVoltage(0);
        Serial.print("A0:");
        Serial.print(adc0);
        Serial.print("mV,  ");    // Print the value in millivolts

        // Read the voltage from channel A1 and print the value
        adc1 = ads.readVoltage(1);
        Serial.print("A1:");
        Serial.print(adc1);
        Serial.print("mV,  ");    // Print the value in millivolts

        // Read the voltage from channel A2 and print the value
        adc2 = ads.readVoltage(2);
        Serial.print("A2:");
        Serial.print(adc2);
        Serial.print("mV,  ");    // Print the value in millivolts

        // Read the voltage from channel A3 and print the value
        adc3 = ads.readVoltage(3);
        Serial.print("A3:");
        Serial.print(adc3);
        Serial.println("mV");     // Print the value in millivolts and end the line
    }
    else
    {
        // If ADS1115 is not connected, print a message indicating disconnection
        Serial.println("ADS1115 Disconnected!");
    }

    // Wait for 1 second before the next loop iteration
    delay(1000);
}
arduino ino file download: 
.zip   3-ads1115_adc.zip (Size: 1.2 KB / Downloads: 567)
BIN file (you can use esp32 download tool download to ESP32-S3 with address 0x0 then directly to use) download:
.zip   3-ads1115_adc.ino.merged.zip (Size: 190.35 KB / Downloads: 591)

Print this item

  [arduino code examples for B16M]-02 Read digital input ports state
Posted by: admin - 09-27-2024, 02:22 AM - Forum: B16M - 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 38
* - SCL: GPIO 39
* - PCF8575 I2C Address: 0x24
*/

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

// Define I2C pins
#define I2C_SDA 38  // Define SDA pin
#define I2C_SCL 39  // 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: 840 bytes / Downloads: 553)
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.81 KB / Downloads: 516)

Print this item

  [arduino code examples for B16M]-01 Turn ON/OFF OUTPUT
Posted by: admin - 09-27-2024, 02:19 AM - Forum: B16M - 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 38
* - SCL: GPIO 39
*
* 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 38           // Define the SDA pin
#define SCL 39           // 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: 931 bytes / Downloads: 549)
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.62 KB / Downloads: 527)

Print this item

  B16M ESPHome yaml for home assistant with tuya
Posted by: admin - 09-27-2024, 02:16 AM - Forum: B16M - No Replies

Code:
esphome:
  name: b16m
  friendly_name: b16m
  platformio_options:
    board_build.flash_mode: dio
esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf

# Enable logging
logger:
  hardware_uart: USB_SERIAL_JTAG
# Enable Home Assistant API
api:
  encryption:
    key: "WeVOuL5oNhjXcfzXtTirlOwvtWvCD5yqIxd3oV4es1k="

ethernet:
  type: W5500
  clk_pin: GPIO42
  mosi_pin: GPIO43
  miso_pin: GPIO44
  cs_pin: GPIO41
  interrupt_pin: GPIO2
  reset_pin: GPIO1

i2c:
   - id: bus_a
     sda: 38
     scl: 39
     scan: true
     frequency: 400kHz

pcf8574:
  - id: 'pcf8574_hub_out_1'  # for output channel 1-16
    i2c_id: bus_a
    address: 0x25
    pcf8575: true

  - id: 'pcf8574_hub_in_1'  # for input channel 1-16
    i2c_id: bus_a
    address: 0x24
    pcf8575: true

uart:
  - id: uart_1
    baud_rate: 9600
    debug:
      direction: BOTH
      dummy_receiver: true
      after:
        timeout: 10ms
    tx_pin: 18
    rx_pin: 8

switch:
  - platform: uart
    uart_id: uart_1
    name: "RS485 Button"
    data: [0x11, 0x22, 0x33, 0x44, 0x55]

  - platform: gpio
    name: "b16m-output01"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 0
      mode: OUTPUT
      inverted: true

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

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

  - platform: gpio
    name: "b16m-output04"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 3
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b16m-output05"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 4
      mode: OUTPUT
      inverted: true

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

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

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

  - platform: gpio
    name: "b16m-output09"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 8
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b16m-output10"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 9
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b16m-output11"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 10
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b16m-output12"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 11
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b16m-output13"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 12
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b16m-output14"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 13
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b16m-output15"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 14
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "b16m-output16"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 15
      mode: OUTPUT
      inverted: true

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

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

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

  - platform: gpio
    name: "b16m-input04"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 3
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b16m-input05"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 4
      mode: INPUT
      inverted: true

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

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

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

  - platform: gpio
    name: "b16m-input09"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 8
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b16m-input10"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 9
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b16m-input11"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 10
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b16m-input12"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 11
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b16m-input13"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 12
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b16m-input14"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 13
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b16m-input15"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 14
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "b16m-input16"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 15
      mode: INPUT
      inverted: true
##pull-up resistance on PCB
  - platform: gpio
    name: "b16m-W1-io40"
    pin:
      number: 40
      inverted: true

  - platform: gpio
    name: "b16m-W1-io15"
    pin:
      number: 15
      inverted: true

  - platform: gpio
    name: "b16m-W1-io48"
    pin:
      number: 48
      inverted: true

  - platform: gpio
    name: "b16m-W1-io47"
    pin:
      number: 47
      inverted: true
## without resistance on PCB
  - platform: gpio
    name: "b16m-W1-io13"
    pin:
      number: 13
      inverted: false

  - platform: gpio
    name: "b16m-W1-io14"
    pin:
      number: 14
      inverted:  false

  - platform: gpio
    name: "b16m-W1-io21"
    pin:
      number: 21
      inverted: false

ads1115:
  - address: 0x48
sensor:
  - platform: ads1115
    multiplexer: 'A0_GND'
    gain: 6.144
    resolution: 16_BITS
    name: "ADS1115 Channel A0-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A1_GND'
    gain: 6.144
    name: "ADS1115 Channel A1-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A2_GND'
    gain: 6.144
    name: "ADS1115 Channel A2-GND"
    update_interval: 5s
  - platform: ads1115
    multiplexer: 'A3_GND'
    gain: 6.144
    name: "ADS1115 Channel A3-GND"
    update_interval: 5s

web_server:
  port: 80
download yaml file:
.txt   B16M_HA.txt (Size: 7.15 KB / Downloads: 626)

Print this item

  B16M ESP32-S3 IO pins define
Posted by: admin - 09-27-2024, 02:13 AM - Forum: B16M - Replies (2)

IIC Bus:

SDA:GPIO38
SCL:GPIO39

PCF8575:U57 (relay1-16): i2c address:0x25
PCF8575:U58 (input1-16): i2c address:0x24

DS3231 RTC i2c address: 0x68
SSD1306 display: i2c address:0x3c
ADS1115 (4CH ADC): i2c address:0x48
-----------------

1-wire (pull-up resistance on PCB):
1-wire1:GPIO40
1-wire2:GPIO15
1-wire3:GPIO48
1-wire4:GPIO47

free GPIOs (without pull-up resistance on PCB):
free gpio-1:GPIO13
free gpio-2:GPIO14
free gpio-3:GPIO21
-----------------

Ethernet (W5500) I/O define:

clk_pin: GPIO42
mosi_pin: GPIO43
miso_pin: GPIO44
cs_pin: GPIO41

interrupt_pin: GPIO2
reset_pin: GPIO1

--------------------
RS485:
RXD:GPIO8
TXD:GPIO18

Tuya module:
RXD:GPIO17
TXD:GPIO16

Tuya network button: Tuya module's P28
Tuya network LED: Tuya module's P16
--------------------
SD Card:
SPI-MOSI:GPIO10
SPI-SCK:GPIO11
SPI-MISO:GPIO12
SPI-CS:GPIO9

Print this item

  ESPHome PCF8575 and XL9535 yaml format define updated
Posted by: admin - 09-25-2024, 12:54 AM - Forum: Getting Started with ESPHome and Home Assistant - No Replies

if using PCF8575 , the pin number will begin 0-7 and 8-15
if using XL9535 , the pin number will begin 0-7 and 10-17

Print this item

  OLED display for A4
Posted by: tarajas - 09-24-2024, 10:02 PM - Forum: KC868-A4 - Replies (6)

Hi,

Is it possible to add an I2C OlED display to the A4 via using the 433MHz PINs? On 1.2.4 board I have those available...

Maybe I could add the display to the DIN plastic enclosure creating a cutout with a dremel and fixing the display with screws, so that some important info could be shown there...

P3 has looking the board from head on:
VCC ? ? GND
Where should the SDA and SCL be connected?

Print this item

  Any plans for KC868-D16 update?
Posted by: VKAN - 09-24-2024, 05:55 PM - Forum: Suggestions and feedback on KinCony's products - Replies (1)

Hi,

Time to time I see that Kincony updates and improves existing boards. Do you considering updating KC868-D16?
Probably running with ESP32?

Print this item

  Free sample for IT/tech education in a countryside school
Posted by: tarajas - 09-24-2024, 05:31 PM - Forum: Apply for free sample product - Replies (1)

Hi,

I was wondering if a countryside school's IT/technology teacher in Hungary (my cousin actually) could be eligible for a sample pack. After my own experiences and hobby tinkering with Kincony products I bought up the idea for my cousin to introduce the product to interested kids at the high school and she is all in about this... potentially sparking more interest out of the average bored student... What is your take on this? Is this an initiative that Kincony could support?

Kind Regards

Print this item