Smart Home Automation Forum
[Arduino IDE demo source code for KC868-A6]--#09-RS485_code - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20)
+--- Forum: KC868-A6 (https://www.kincony.com/forum/forumdisplay.php?fid=22)
+--- Thread: [Arduino IDE demo source code for KC868-A6]--#09-RS485_code (/showthread.php?tid=1867)

Pages: 1 2


[Arduino IDE demo source code for KC868-A6]--#09-RS485_code - KinCony Support - 04-25-2022

[Arduino IDE demo source code for KC868-A6]--#09-RS485_code

Code:
void setup(){

  Serial2.begin(9600);
}

void loop() {
Serial2.println("KinCony");

}

.zip   9.RS485.zip (Size: 469.3 KB / Downloads: 422)



RE: [Arduino IDE demo source code for KC868-A6]--#09-RS485_code - Alpha - 02-15-2023

Hello,
I've looked at the A6 schematic and it doesn't seem the DE/RE pins of the RS485 chip ( MAX13487E) are connected to the ESP32.

Does this mean the A6 can only transmit RS485, or am I missing something obvious?

Thanks in advance,

alex


RE: [Arduino IDE demo source code for KC868-A6]--#09-RS485_code - admin - 02-16-2023

DE/RE not need to use, MAX13487 will auto control the signal direction. for ESP32 just use RXD,TXD pins is ok.


RE: [Arduino IDE demo source code for KC868-A6]--#09-RS485_code - Alpha - 02-16-2023

(02-16-2023, 12:13 AM)admin Wrote: DE/RE not need to use, MAX13487 will auto control the signal direction. for ESP32 just use RXD,TXD pins is ok.

Hello, thanks for the quick reply!

I had a quick look at the MAX13487 datasheet and assumed it was the same as all the other 485 chips I have used.  Wrong!

Thanks again!

Cheers,

alex


RE: [Arduino IDE demo source code for KC868-A6]--#09-RS485_code - admin - 02-16-2023

DE/RE pin just connect together with 10k resistance to Vcc is ok.


RE: [Arduino IDE demo source code for KC868-A6]--#09-RS485_code - Alpha - 02-16-2023

(02-16-2023, 01:31 AM)admin Wrote: DE/RE pin just connect together with 10k resistance to Vcc is ok.

Hmm, I still don't seem to be getting any data out of the RS485 port.  I have it connected to a known working RS458 to USB on my computer, and I'm not seeing any data on my serial terminal (all set for 9600, 8N1).

What board definition should I be using in the Arduino IDE?  I'm currently using 'ESP Dev Module'.  I'm wondering if Serial2 is using the correct TX and RX pins for this board.

Thanks again!


RE: [Arduino IDE demo source code for KC868-A6]--#09-RS485_code - admin - 02-16-2023

do you have define the Serial2 pin in your arduino config fle firstly?
   
this is RS485 pin define for KC868-A6


RE: [Arduino IDE demo source code for KC868-A6]--#09-RS485_code - Alpha - 02-16-2023

(02-16-2023, 03:46 AM)admin Wrote: do you have define the Serial2 pin in your arduino config fle firstly?

this is RS485 pin define for KC868-A6

Ah!  Ok.  I made that change and my Modbus read is now working!  Excellent, thankyou very much.

Did I miss some documentation / wiki that tells me to change the RX2 and TX2 pins?  Is there other defines that I should be changing?

Thanks again, I'm really enjoying working with this board.  It's a really nice layout.

Cheers,

alex


RE: [Arduino IDE demo source code for KC868-A6]--#09-RS485_code - admin - 02-16-2023

ok, only serial port and IIC bus SDA and SCL pins need set by arduino config file firstly.


RE: [Arduino IDE demo source code for KC868-A6]--#09-RS485_code - alexandre bassi - 08-18-2024

The RS485 code you posted is empty, the compressed file contains an empty .ino