Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
KC868-A6 Relays
#1
Hi there
I'm trying to get the relays to work on a KC868-A6.
I'm using the KC868-A8 example source code as the basis for this and modified it as shown below:

#include “Arduino.h”
#include “PCF8574.h”

#define I2C_RELAYS_ADR 0x24
PCF8574 pcf(I2C_RELAYS_ADR);

void setup() {
Serial.begin(115200);
Serial.println(F(“Start Kincony KC868-A6 Relays example…”));
pcf.pinMode(P0, OUTPUT);
pcf.pinMode(P1, OUTPUT);
pcf.pinMode(P2, OUTPUT);
pcf.pinMode(P3, OUTPUT);
pcf.pinMode(P4, OUTPUT);
pcf.pinMode(P5, OUTPUT);
Serial.print(“Init PCF8574… “);
if (pcf.begin()){Serial.println(F(“Ok”));}
else {Serial.println(F(“Error”));}
}

void loop() {
pcf.digitalWrite(P0, HIGH);
Serial.print(F(“Relay #”)); Serial.print(P0); Serial.println(F(” ON”));
delay(10000);
pcf.digitalWrite(P0, LOW);
Serial.print(F(“Relay #”)); Serial.print(P0); Serial.println(F(” OFF”));
delay(10000);
}


Using this example, the pcf.begin statement fails and returns "Error".
Looking at the schematic diagram for the KC868-A6, the I2C SDA is set to pin 26, and the SCL is set to pin 23.  By default the PCF8574 library will default to other values, so I tried changing the statement below to the following which matches the format noted in the readme file for the PCF8574 library
 PCF8574 pcf(0x24, 26, 23);

This didn't work either and so I tried the various I2C scanners and they don't find any I2C device.

I've also ensured that the relevant pins_arduino.h file has been edited to reflect the correct SDA and SCL pin values.

One other thing I have noticed is on startup there is a strange error, see below:

ets Jun  8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
modeBig GrinIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:13160
load:0x40080400,len:3036
entry 0x400805e4
E (309) i2c: i2c_set_pin(873): scl an⸮4⸮⸮⸮gpio numbers are the same


The highlighted line in red looks odd but I can't find anything online to help. 

Any assistance would be appreciated.
Reply
#2
here is arduino demo source code for use KC868-A6 relay:
https://www.kincony.com/forum/showthread.php?tid=1866

you can find many KC868-A6 source in this forum link: https://www.kincony.com/forum/forumdisplay.php?fid=22
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)