Arduino Code for 4G LTE SIM A7670C Development board

Hi,

I am trying to interface 4g LTE SIM A7670C development board to Arduino Uno to send and SMS and initiate a call. I could not find right interfacing diagram as well as Arduino code to do this. Can someone please guide me through this or provide a right link to achieve this.

Whatever I am finding is for SIM 7600 only and not this module. Thanks for your help.

How to connect 4g LTE SIM A7670C with my Arduino Uno. Any PIN diagram will be helpful here.

Try Google on "Arduino UNO + A7670C"

I am having below code to send SMS through 4g LTE SIM A7670C which is connected to Arduino Uno.

#include <SoftwareSerial.h>

SoftwareSerial SIM7670Serial(2, 3); // RX, TX

void setup() {
  Serial.begin(9600);
  SIM7670Serial.begin(115200);

  sendATCommand("AT", "OK", 1000); // check communication
  sendATCommand("AT+CMGF=1", "OK", 1000); // set SMS format to text
}

void loop() {
  sendSMS("+91XXXXXXXXX", "Hello from Arduino!");
  delay(30000);
}

void sendSMS(String number, String message) {
  String cmd = "AT+CMGS=\"" + number + "\"\r\n";
  SIM7670Serial.print(cmd);
  delay(100);
  SIM7670Serial.println(message);
  delay(100);
  SIM7670Serial.write(0x1A); // send ctrl-z
  delay(100);
}

void sendATCommand(String cmd, String expectedResponse, int timeout) {
  SIM7670Serial.println(cmd);
  String response = "";
  long timeStart = millis();
  while (millis() - timeStart < timeout) {
    while (SIM7670Serial.available() > 0) {
      char c = SIM7670Serial.read();
      response += c;
    }
    if (response.indexOf(expectedResponse) != -1) {
      break;
    }
  }
  Serial.println(response);
}

SIM is of JIO. I am not able to recieve SMS on desired number. Also I can only see some Junk Square characters on the Serial monitor. Can anyone provide solution to this.?

1 Like

what's you Serial monitor baud rate?

  • Serial should be set much higher (115200 would make sense for example, and of course the terminal should match that)

  • are you sure your SIM7670 is configured at 115200 bauds? that's a lot for a SoftwareSerial communication. configure it down to 9600 bauds

I tried setting Serial Monitor Baud rate to 115200 and also 9600 as well. In both cases, I am getting junk characters only.

  • are you sure your SIM7670 is configured at 115200 bauds? that's a lot for a SoftwareSerial communication. configure it down to 9600 bauds

Can you explain what you mean by above statement?

when you do

it means your arduino "speaks" to your 4g LTE SIM A7670C module at 115200 bauds. This is the default baud rate for your module but SoftwareSerial does not behave very well at that speed.

I think the module offers support for automatic recognition baud rate (check the doc, may be some configuration is needed), so might be worth setting that at 9600 bauds

#include <SoftwareSerial.h>

SoftwareSerial SIM7670Serial(2, 3); // RX, TX

void setup() {
  Serial.begin(115200);
  SIM7670Serial.begin(9600);
...

open the Serial monitor at 115200 bauds

side question : How do you power the module?

side question : How do you power the module?

4g LTE SIM A7670C Module is powered through Arduino Uno

I changed code as below,

#include <SoftwareSerial.h>

SoftwareSerial SIM7670Serial(0, 1); // RX, TX

void setup() {
  Serial.begin(115200);
  SIM7670Serial.begin(9600);

  sendATCommand("AT", "OK", 1000); // check communication
  sendATCommand("AT+CMGF=1", "OK", 1000); // set SMS format to text
}

void loop() {
  sendSMS("+919979874557", "Hello from Arduino!");
  delay(30000);
}

void sendSMS(String number, String message) {
  String cmd = "AT+CMGS=\"" + number + "\"\r\n";
  SIM7670Serial.print(cmd);
  delay(100);
  SIM7670Serial.println(message);
  delay(100);
  SIM7670Serial.write(0x1A); // send ctrl-z
  delay(100);
}

void sendATCommand(String cmd, String expectedResponse, int timeout) {
  SIM7670Serial.println(cmd);
  String response = "";
  long timeStart = millis();
  while (millis() - timeStart < timeout) {
    while (SIM7670Serial.available() > 0) {
      char c = SIM7670Serial.read();
      response += c;
    }
    if (response.indexOf(expectedResponse) != -1) {
      break;
    }
  }
  Serial.println(response);
}

with Serial monitor baud rate to 115200 (NewLine). Now nothing is coming up.Preformatted text

Is there any external library needs to be imported to Arduino IDE to make it work?

you can't have the module on the hardware port and use at the same time the Serial monitor

your module requires at least 300mA, powering it through the Arduino might be a challenge

SoftwareSerial SIM7670Serial(0, 1)

Here we tried with PIN 2,3 as well

you need to do a few things:

  • Make sure the module is 5V compatible for the pins
  • power the module separately
  • join GNDs
  • connect Rx and Tx to pin 2 and 3 (in the right way - module Tx connected to pin 2, module's Rx to pin 3).

try this code and open the Serial monitor at 115200 bauds

#include <SoftwareSerial.h>

SoftwareSerial SIM7670Serial(2, 3); // RX, TX

void sendATCommand(const char* cmd, const char* expectedResponse, unsigned long timeout) {
  SIM7670Serial.println(cmd);
  String response = "";
  response.reserve(50);
  unsigned long startTime = millis();
  bool responseOK = false;

  while (millis() - startTime < timeout) {
    while (SIM7670Serial.available() > 0) {
      char c = SIM7670Serial.read();
      response += c;
    }
    if (response.indexOf(expectedResponse) != -1) {
      responseOK = true;
      break; // found it
    }
  }
  Serial.println(response);

  if (responseOK)
    Serial.println("Response OK");
  else
    Serial.println("Timeout without expected Response");

}

void setup() {
  Serial.begin(115200);
  SIM7670Serial.begin(9600);
  sendATCommand("AT", "OK", 1000); // check communication
}

void loop() {}

until you get a proper answer to the AT command, there is no need to try to send an SMS

if that does not work, try with

  SIM7670Serial.begin(115200);
1 Like

I have merged your cross-posts @vimalp.

Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting can result in a suspension from the forum.

In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

It worked! worked with 115200. I have also tested sending SMS and call, they are also working now.

Sharing code here

#include <SoftwareSerial.h>

SoftwareSerial SIM7670Serial(2, 3); // RX, TX

void sendATCommand(const char* cmd, const char* expectedResponse, unsigned long timeout) {
  SIM7670Serial.println(cmd);
  String response = "";
  unsigned long startTime = millis();
  bool responseOK = false;

  while (millis() - startTime < timeout) {
    while (SIM7670Serial.available() > 0) {
      char c = SIM7670Serial.read();
      response += c;
    }
    if (response.indexOf(expectedResponse) != -1) {
      responseOK = true;
      break; // found it
    }
  }
  Serial.println(response);

  if (responseOK)
    Serial.println("Response OK");
  else
    Serial.println("Timeout without expected Response");

}

void setup() {
  Serial.begin(115200);
  SIM7670Serial.begin(115200);
  sendATCommand("AT+CGMM", "OK", 1000); // check communication
  sendATCommand("AT+CMGF=1", "OK", 1000); // set SMS format to text

}

void sendSMS(String number, String message) {
  String cmd = "AT+CMGS=\"" + number + "\"\r\n";
  SIM7670Serial.print(cmd);
  delay(100);
  SIM7670Serial.println(message);
  delay(100);
  SIM7670Serial.write(0x1A); // send ctrl-z
  delay(100);
}
void loop() {
   sendSMS("123456789", "Hello from Arduino!");
  delay(30000);

   //SIM7670Serial.println("ATD +123456789;"); // Replace +123456789 with the desired phone number
  //delay(1000);

 if(SIM7670Serial.available()) {
    String response = SIM7670Serial.readString();
    Serial.println(response);
    // Check if the response indicates a call has been connected
    if(response.indexOf("CONNECT") != -1) {
      // Call connected
      Serial.println("Call Connected");
      // Add code here to perform actions during the call
    }
  }  
}

Thanks a bunch!

1 Like

add a call to reserve just after you instantiate the local String. that will help mitigate some of the challenge with using the String class with a growing container

Hello Jackson! I have just created the account to say... thank you, I have been a whole day trying to make it work and nothing.

Your code works perfect, thank you, really!

Good to hear. Have fun

1 Like

Hii can i get code for A7670C using single relay controll by call and sms

hii buddy , can get code for relay control by sms and call , can you help on this same module A7670C

Same project here, Astra + A7670 for SMS relay to replace my old Teltonika Relay