Smart Home Automation Forum
Sample code for SIM800L and schematics - 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-A2 (https://www.kincony.com/forum/forumdisplay.php?fid=43)
+--- Thread: Sample code for SIM800L and schematics (/showthread.php?tid=2899)

Pages: 1 2


Sample code for SIM800L and schematics - ebelingtec - 05-10-2023

Hello everyone!

I would like to kinldy ask for some help with the KC868-A2. I am unable to communicate with the SIM800L module. I have tried to use the example code for KC868-A8S sms-relay and adapt it but it didn't work.

I have changed the Serial2 pins in "HardwareSerial.cpp" to RX2 34 and TX2 13.

Could you provide me with an Arduino source code for the KC868-A2 with the SIM800L module?

Thank you Blush


RE: Sample code for SIM800L and schematics - admin - 05-10-2023

your TXD,RXD define error. here is config file for A2 and demo source code, this code can monitor GSM module's data,it's useful.
   

.zip   KC868-A2-AT-debug.zip (Size: 303 bytes / Downloads: 194)


RE: Sample code for SIM800L and schematics - ebelingtec - 05-11-2023

Okay, thank you for the response. I have tried changing the "HardwareSerial.cpp" to RX2 13 and TX2 34 like you suggested. I couldn't get a communication going with your debug code. Also I looked at your pinout definition in LINK_ KC838-A2_pinout and it showed the following:

Quote:Relay1:15
Relay2:2

DS18B20/DHT11/DHT21/LED strip -1: 33
DS18B20/DHT11/DHT21/LED strip -2: 14

Ethernet (LAN8720) I/O define:

#define ETH_ADDR        0
#define ETH_POWER_PIN  -1
#define ETH_MDC_PIN    23
#define ETH_MDIO_PIN  18
#define ETH_TYPE      ETH_PHY_LAN8720
#define ETH_CLK_MODE  ETH_CLOCK_GPIO17_OUT

RS485:
RXD:35
TXD:32

GSM:
RXD:34
TXD:13


DI1:36
DI2:39

IIC BUS:
SDA:4
SCL:16

Looking at the schematics LINK_KC868_A2_schematic the GSM_RX is connected to I34 and the GSM_TX is connected to IO13. I think here lies the problem: I34 is an input only, and the GSM_RX is an input as well.
What I did to make the communication work:

In "HardwareSerial.cpp" : RX2 34 and TX2 13

I had to rewire the gsm module physically. In Header 5 (P4) I switched GSM_RX and GSM_TX


Code:
AT
OK
ATI
SIM800 R14.18

OK

Then it worked. With your configuration it did not work for me. I think it is because pin 34 can't work as a TX pin, as it is an input pin only.

That took a while... Tell me what you think Smile


RE: Sample code for SIM800L and schematics - admin - 05-12-2023

just RXD and TXD by ESP32 or by SIM800L, TXD->RXD, RXD->TXD.
if sometimes can't work, just exchange the pin define will be ok.


RE: Sample code for SIM800L and schematics - ebelingtec - 05-12-2023

(05-12-2023, 12:25 AM)admin Wrote: just RXD and TXD by ESP32 or by SIM800L, TXD->RXD, RXD->TXD.
if sometimes can't work, just exchange the pin define will be ok.

From the ESP32-WROOM32E manual, pin 34 is type I=input, so it cannot be used for TX as I understand.

Name       No.       Type       Function
IO34        6         I           GPIO34, ADC1_CH6, RTC_GPIO4


Is there a way to switch the RXD and TXD pins on the SIM800L module with AT commands?


RE: Sample code for SIM800L and schematics - admin - 05-12-2023

Is there a way to switch the RXD and TXD pins on the SIM800L module with AT commands? No, it's fixed.


RE: Sample code for SIM800L and schematics - ebelingtec - 05-16-2023

Do you have a specification for the IIC connector? I cannot find a jumper calble that fits.


RE: Sample code for SIM800L and schematics - admin - 05-16-2023

it's 2.54mm connector, very commonly used.


RE: Sample code for SIM800L and schematics - Anthonio - 06-25-2023

(05-11-2023, 07:05 PM)ebelingtec Wrote: Okay, thank you for the response. I have tried changing the "HardwareSerial.cpp" to RX2 13 and TX2 34 like you suggested. I couldn't get a communication going with your debug code. Also I looked at your pinout definition in LINK_ KC838-A2_pinout and it showed the following:

Quote:Relay1:15
Relay2:2

DS18B20/DHT11/DHT21/LED strip -1: 33
DS18B20/DHT11/DHT21/LED strip -2: 14

Ethernet (LAN8720) I/O define:

#define ETH_ADDR        0
#define ETH_POWER_PIN  -1
#define ETH_MDC_PIN    23
#define ETH_MDIO_PIN  18
#define ETH_TYPE      ETH_PHY_LAN8720
#define ETH_CLK_MODE  ETH_CLOCK_GPIO17_OUT

RS485:
RXD:35
TXD:32

GSM:
RXD:34
TXD:13


DI1:36
DI2:39

IIC BUS:
SDA:4
SCL:16

Looking at the schematics LINK_KC868_A2_schematic the GSM_RX is connected to I34 and the GSM_TX is connected to IO13. I think here lies the problem: I34 is an input only, and the GSM_RX is an input as well.
What I did to make the communication work:

In "HardwareSerial.cpp" : RX2 34 and TX2 13

I had to rewire the gsm module physically. In Header 5 (P4) I switched GSM_RX and GSM_TX


Code:
AT
OK
ATI
SIM800 R14.18

OK

Then it worked. With your configuration it did not work for me. I think it is because pin 34 can't work as a TX pin, as it is an input pin only.

That took a while... Tell me what you think Smile

Hello, 

I think i have the same problem, i can receive information for the A7600E but i can't send now i use IO13 for RX and IO34 
Can you says my what wiring you have make and what IO have you choose for now it's working ?

Thanks


RE: Sample code for SIM800L and schematics - ebelingtec - 06-27-2023

Hello Anthonio,

you cannot make it work by changing the pins ins "HardwareSerial.cpp" only. You need to get wires and physically reconnect (see picture):

In "HardwareSerial.cpp" : RX2 34 and TX2 13

I had to rewire the gsm module physically. In Header 5 (P4) I switched GSM_RX and GSM_TX