SIM7670E doesn't send SMS

Hi all,

i'm currently having trouble getting my SIM7670E module to send SMS.
The module itself works fine, it has a working connection and i can make phone calls without a problem. Problem is, i can't seem to send SMS. There is no error displayed.
Does anyone know where the problem is? I've browsed through many example sketches, but nothing so far has worked.

image

*Arduino Nano

Any help is really appreciated!

Code:

#include <SoftwareSerial.h>

SoftwareSerial SIM7670Serial(2, 3); // RX, TX
unsigned long ringLEDon = 500;
unsigned long ringLEDoff = 500;
unsigned long rememberTime = 0;
byte LEDState = 0;
byte pushButtonPin = 12;
byte callLED = 6;
int callLEDState = 0;
int buttonOld = 0;
int buttonNew;
int ringPin = 9;
bool ringStatus=false;

//+++++AT COMMANDS+++++
//ATA: Answer call
//AT+CHUP: Hang up call
//ATDXXX;: Call number XXX ([;] is important!)
//AT+CMEE=2: More detailed error messages
//AT+CNUM: Own mobile number
//AT+CPIN?: Check which PIN is required
//AT+IPREX=?: Check supported BAUD rates. 
//AT+CMGF=1: Set SMS format to text

//https://m2msupport.net/m2msupport/voice-call-at-commands-to-set-up-voice-call/

void setup() {
  Serial.begin(9600);
  SIM7670Serial.begin(9600);
  pinMode(ringPin,OUTPUT);
  pinMode(pushButtonPin,INPUT);
  digitalWrite(pushButtonPin,LOW);
  pinMode(callLED,OUTPUT);
  delay(1000);
  sendATCheck("AT+CGMM", "OK", 1000);         // check communication
  sendATCommand("AT+CPIN?",1000);
  sendATCommand("AT+CMGF=1",1000);
}

void loop() {
  //sendATcommand(XXX,1000);
  //sendSMS("123456789", "Hello from Arduino!");
  //delay(30000);

  if(SIM7670Serial.available()) {
    String response = SIM7670Serial.readString();
    Serial.println(response);
    
    if(response.indexOf("BEGIN") != -1) {     // Call connected
      Serial.println("Call Connected");
      digitalWrite(callLED,HIGH);
      }
      else{
      digitalWrite(callLED,LOW);
       }

    if(response.indexOf("RING") != -1) {        // Ringing
      ringStatus = true;
      }
    else{
      ringStatus = false;
      digitalWrite(ringPin,LOW);
      }
    } 
   

  if(ringStatus==true){
    ringLED();
    }

  buttonNew=digitalRead(pushButtonPin);
  if(buttonOld==0 && buttonNew==1){
    SIM7670Serial.println("ATA");
    }
  buttonOld=buttonNew;  

  sendSMS("+4917XXXXXXXXX","This is a test SMS");
  while(1);
}

void sendATCheck(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 sendATCommand(const char* cmd, unsigned long timeout) {
  SIM7670Serial.println(cmd);
  String response = "";
  response.reserve(50);
  unsigned long startTime = millis();

  while (millis() - startTime < timeout) {
    while (SIM7670Serial.available() > 0) {
      char c = SIM7670Serial.read();
      response += c;
    }
  }
  Serial.println(response);
  }
  
void ringLED(){
  if(LEDState==0){
    if(millis()-rememberTime > ringLEDoff){
      digitalWrite(ringPin,HIGH);
      LEDState = 1;
      rememberTime = millis();
      }
    }  
  else{
    if(millis()-rememberTime > ringLEDon){
      digitalWrite(ringPin,LOW);
      LEDState = 0;
      rememberTime = millis();
      } 
    }
  }
void sendSMS(String number, String message) {
  String cmd = "AT+CMGS=\"" + number + "\"\r";
  Serial.println(cmd);
  SIM7670Serial.print(cmd);
  delay(1000);
  SIM7670Serial.print(message);
  // String response = SIM7670Serial.readString();
  // Serial.println(response);
  // Serial.println(message);
  delay(1000);
  SIM7670Serial.println((char)0x1A); // send ctrl-z
  delay(1000);
  }```

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