Problem in serial communication between ESP32 and GSM A7670C

I am using A7670C GSM breakout board with an ESP32.

Connections

  • RX-TX
  • TX-RX
  • GND-GND

I am giving external power to the GSM module, 3.8 V according to the product description.

When I sent the AT command to GSM module, I don't get output on the serial monitor of the Arduino IDE.

The message is sent to a particular number successfully, but I don't receive the message from mobile.

This is my code:

#include <HardwareSerial.h>
#if defined(CONFIG_IDF_TARGET_ESP32)
    #define mySerial Serial2
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
    #define mySerial Serial1
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
   #define mySerial Serial2
#endif
String msg="";
void setup()
{
  Serial.begin(115200);
  delay(500);
  #if defined(CONFIG_IDF_TARGET_ESP32)
    mySerial.begin(9600);
 #elif defined(CONFIG_IDF_TARGET_ESP32S2)
    mySerial.begin(115200);
 #elif defined(CONFIG_IDF_TARGET_ESP32S3)
   mySerial.begin(115200, SERIAL_8N1, 18, 17);
 #endif
  delay(500);
  mySerial.println("ATI");
update_serial();
  delay(100);
  sent_sms();
update_serial();
  delay(100);
 RecieveMessage();
update_serial();
  delay(100);
   
}
void loop()
{    
  if (Serial.available()){
    char c = Serial.read();
    mySerial.write(c);
  }
 update_serial();
}

void update_serial()
{
    while(mySerial.available()) {
    Serial.print(mySerial.read());
  }
}

void sent_sms()
{
 mySerial.println("AT+CMGF=1");delay(500);
 mySerial.println("AT+CMGS=\"+91XXXXXXXXXX\"");delay(500);
 mySerial.print("test sent sms SIM7600");delay(500);
 mySerial.write(26);delay(500);
}

 void RecieveMessage() {
  mySerial.println("AT+CNMI=2,2,0,0,0"); // AT Command to receive a live SMS
  delay(1000);

I tried different baud rate also but I only got message on mobile with 115200 baud rate. i tried sofwareserial also but it didn,t work .


how have you connected the A7670C to the ESP32?
how do you power the device?
note that the A149126_ADIY-SIM7670C-4G-Breakout-Board-V1.1_Datasheet.pdf states that Rx and TX are 1.8V logic??

image

Thank you for the reply...
RX2(GPIO 16) and TX2(GPIO 17) connected alternate to GSM's RX and TX
ESP32 GND and GSM GND and external power supply GND are common.
I have circuit that convert the AC power supply to 3.3 Volt DC supply.
I am getting 3.2 V at RX pin of A7670 and 1.8 V at TX pin of A7670.

think you require a 3.3V <> 1.8V level converter on the ESP32 serial to A7670C

ok I will try it

going back to your code in post 1 using Serial2 when I initialise Serial2 on an ESP32 I explicitly set the pins

#define RXD2 16
#define TXD2 17

void setup() {
  // Note the format for setting a serial port is as follows: Serial2.begin(baud-rate, protocol, RX pin, TX pin);
  Serial.begin(115200);
  Serial2.begin(115200, SERIAL_8N1, RXD2, TXD2);

it may help

Thanks for the help!!!

can I use voltage divider

you can try a potential divider on the ESP32 3.3V Tx to A7670C 1.8V Rx
don't know if the A7670C 1.8V Tx will work with the ESP32 Rx

try it?

1 Like

ok, let me try i will be there ..after this

I tried it but nothing was changed

try with level converter otherwise you may have damaged the A7670C by inputting 3.3.V into the Rx

I saw some method to make bi-directional voltage level shifter but I got 5v to3.3 logic level shifter .can anyone help me to make 3.3v logic level shifter to 1.8 v

have a look at Sparkfun level converter - it states
This level converter also works with 2.8V and 1.8V devices

now my GSM module work properly . I want help to set the time of GSM by NTP server using AT commands
I tried some AT commands

  • this AT command set my time but i want to set the time automatically.
mySerial.println("AT+CCLK=\"24/04/02,16:14:00+20\"\r");delay(500);
  delay(100);
  update_serial();
  • didn't work
mySerial.println("AT+CNTP=\"193.204.114.232\",20");delay(500);
  delay(100);
  update_serial();

I am following this pdf of AT commands
SIM7500_SIM7600_Series_AT_Command_Manual_V2.00.pdf (2.7 MB)

some more AT commands likes AT+CLTS=1(give me error message),AT&W do not set the time

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.