So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Brewmaster15
#69889 Hello,

I would like to connect my NodeMCU with my GSM Borad (Siemens TC 35).
The code works fine with an arduino, but not with the nodemcu.

Code: Select all//Es kann ein Text im seriellen Monitor eingegeben werden, der dann per SMS verschickt wird
//Pin D5 an Rx TC35, Pin D6 an Tx TC35, Pin D1 an IGT TC35
// Ground Arduino und TC verbinden
// Seriellen Monitor starten, Nachricht eingeben, mit "." abschliessen und senden

#include <SoftwareSerial.h>
#define rxPin 14 //D5
#define txPin 12 //D6
 
SoftwareSerial gsmSerial(rxPin, txPin);
char recu[150];    // Array for message
String message = "";
int i;
 
void setup() {
  // initialize digital pin 13 as an output.
  pinMode(13, OUTPUT);
 
  Serial.begin(9600);
  while(!Serial) {}
 
  //--- turn on TC35 ---
  // wire D1 NodeMCU to IGT pin on TC35
  // ground pin for 100 ms - this is the same as pressing the button on the TC35 to start it up
  pinMode(5, INPUT);
  digitalWrite(5, LOW);
  pinMode(5, OUTPUT);
  delay(100);
  pinMode(5, INPUT);
 
  gsmSerial.begin(9600);
  delay(5000);
  Serial.println("GSM Modul bereit");
  Serial.println("Nachricht eingeben und mit Punkt beenden");
}
 
void loop() {
  i = 0;
  while (Serial.available() > 0) {
    recu[i] = Serial.read();
    if ((recu[i] != 46) && (recu[i] != 13) && (recu[i] != 10))
    {
      message += char(recu[i]);
    }
    i++;
    // 46 is ASCII code for "."
    if (recu[i - 1] == 46) {
      SendTextMessage();
      ShowSerialData();
      delay(1000);
      message = "";
      i = 0;
    }
  }
}
 
void SendTextMessage() {
  digitalWrite(13, HIGH);
  Serial.println("Sende SMS...");
 
  gsmSerial.println("AT+CMGF=1");
  delay(500);
  gsmSerial.print("AT+CMGS=\"+4915150725424\"\r");
  delay(500);
  gsmSerial.print(message);
  delay(500);
  gsmSerial.println((char)26); // ASCII Ctrl-Z
  delay(500);
 
  Serial.println("SMS gesendet.");
  digitalWrite(13, LOW);
}
 
void ShowSerialData() {
  while(gsmSerial.available() > 0) {
    Serial.write(gsmSerial.read());
  }
}


I guess its a problem with the serial communication, I used the libs from the arduino, I hope thats
okay. There is no reaction from the TC35. I used PIN D5/D6 for software serial.
Any ideas about the problem?

Cheers
BM
User avatar
By nikxha
#70122 Hihi...

one question first: can you post details on how you wire esp to tc35? RX ==> TX and TX ==> RX right...???
:D

You can check software serial working by just connecting a second esp to D5/D6 (or any arduino... just to be sure Software Serial is ok...) then focus on startup procedure of TC35...

Also you may just send AT Command to TC to see if it respond....
I think TC35 also needs \r at end of command... but not sure about it...

Br
-nikxha-