NodeMCU and Siemens TC35 for SMS sending

Hello,

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

#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.

I have just bought a logical analyzer to see whats going on.

Recently I found out there is also a problem with the TC35 connecting to the GSM net, I guess there is
a problem with power consumption, the NodeMCU could probably not offer the current neccessary.

Any ideas about the problem?

Cheers
BM

Are you sure your nodeMCU pin mapping are those ones ?

Some Chinese units or old ones got weird wiring so I would put a resistor + led to D5 and then D6 and write a small program to turn the led on and see if it works addressing 14 and 12 directly (by the way, why don't you use the constant D5 and D6 instead of re-defining them?)

The other diffence between a uno is your unit is likely 3.3v and not 5V for pin HIGH - might confuse the unit and sending 5V into a 3.3v tolerant pin is not great

How are you powering the TC35?

I wrote that little program and everything works fine with D5 / D6. So mapping is okay.

This is the information from the datasheet of TC35:

The data interface is implemented as a serial asynchronous transmitter and receiver
conforming to ITU-T RS-232 Interchange Circuits DCE. It operates at CMOS level (2.65V).
All RS-232 signals on the ZIF connector are low active.
The GSM engine is designed for use as a DCE. Based on the conventions for DCE-DTE
connections it communicates with the customer application (DTE) using the following
signals:
• Port TxD @ application sends data to /TxD0 of the GSM engine
• Port RxD @ application receives data from /RXD0 of the GSM

It worked with the Arduino uno (I guess 5V logic level). Next week I get my logic analyzer,
so there is a chance to see whats going on.

The TC35 was powered by the NodeMCU, this is probably a problem, I will try with battery (AA)
later on.
But curiously it worked with the arduino powering the TC35, but this µC could be more powerful
compared to the NodeMCU.

how do you power the NodeMCU? I would double check the exact Voltage you get out of the 3.3V pins of your nodeMCU as there is a voltage drop from the source voltage due to the voltage regulator (a bit more than 1V from the top of my head) so if you power through battery Lithium Ion event at 4.2 V you might not have 3.3 on those pins

the TC35 might operate at 2.65V but do you know what minimum voltage needs to be provided if your board includes as well a regulator?

okay, thank you.

I fixed it. I used a 5V/2A supply for the tc35. now everything works fine. :smiley:
so it was a problem with insufficient amperes....