Hi,
I have just bought and started to test my SIM800C module, but it doesn’t send the sms, and it doesn’t give me any feedback in the serial monitor.
Equipment:
- Arduino Mega
- External powersupply for the module with 5v output(laptop charger)
- SIM800C GSM / GPRS module
My setup:
Code:
//#define BLYNK_PRINT Serial
//#define TINY_GSM_MODEM_M590
#define TINY_GSM_MODEM_SIM800
#include <TinyGsmClient.h>
//#include <BlynkSimpleSIM800.h>
char apn[] = "internet.no"; //TDC Norway standard = "internet.no"
char user[] = ""; //TDC Norway standard = ""
char pass[] = ""; //TDC Norway standard = “”
#define SerialAT Serial1
TinyGsm modem(SerialAT);
void setup() {
// initialize both serial ports:
Serial.begin(9600); // Debug console
delay(10);
SerialAT.begin(2400); // Modem
delay(3000);
Serial.println("Initializing modem..");
modem.restart();
Serial.println("...... done.");
//SerialAT.println("AT+IPR=19200"); // Tell the SIM900 not to autobaud
//SerialAT.print("AT+CMGF=1\r");
//char buffer[4];
//sprintf (buffer, "AT+CMGS=+4700000000%dThis is the text message.%d",0xd, 0x1a);
//SerialAT.print(buffer);
//SerialAT.print("AT+CMGS=\"+4700000000\"\rdfgdfg" + 0x1a);
SerialAT.write("AT+CMGF=1\r"); //sending SMS in text mode
SerialAT.write("AT+CMGS=\"+4700000000\"\r"); // phone number
delay(1000);
SerialAT.write("Hello how are you?\r"); // message
delay(1000);
delay(1000);
SerialAT.write(0x1A); // Ctrl-Z EOF
}
void loop() {
// read from port 1, send to port 0:
if (SerialAT.available()) {
int inByte = SerialAT.read();
Serial.write(inByte);
}
// read from port 0, send to port 1:
if (Serial.available()) {
int inByte = Serial.read();
SerialAT.write(inByte);
}
}
Output from the serial monitor:
Questions:
- Why doesnt it send any SMS?
- Why doesnt it give me any Serial Monitor feedback?
- Should i connect to the module this way?
Arduino TX1 18 → SIM800C RXD
Arduino RX1 19 → SIM800C TXD - Is Arduino TX1 (18) og RX1 (19) the same as Serial1 on Arduino Mega?
- Should i use \r or \n or both when talking to the SIM800C module?
Thanks in advance.