Hi,
I'm struggling with this problem for few days already, trying different troubleshooting approaches, but still not able to figure out what is the problem.
I'm working on small basic project with Arduino REV3 and sim800L evb module, trying to send and receive SMSs. Eventually I plan to control something upon SMS received, but there are still few steps before that.
Problem: what ever I do, sim800l is not responding on commands entered either by code or via Serial monitor. Anyhow, if I remove power supply (5V/3A) from sim800l, I'm able to capture response coming from sim800l, which are stating everything is ok.
But, when I want to send out some command from code or via Serial monitor, no response.
I'm aware my code needs improvements, but this is sketch until I have prototype working, so I would like next use cases to be working:
communication with sim800l using AT commands
sending SMS
receiving SMS
Here are Serial monitor outputs:
- startup
12:55:04.140 -> Initializing OLED module...
12:55:05.213 -> OLED module intialized
12:55:05.213 -> Initializing SIM module...
12:55:05.248 -> Sleep...
12:55:07.211 -> Sleep...
12:55:09.213 -> Sleep...
12:55:11.197 -> Sleep...
12:55:13.191 -> SIM module intialized
- unplug sim800l from power and plug it back
12:59:08.537 -> -------------------------------
12:59:09.536 ->
12:59:09.582 -> simSerial end
12:59:12.362 -> -------------------------------
12:59:13.366 ->
12:59:13.366 -> simSerial end
12:59:15.905 -> -------------------------------
12:59:16.921 ->
12:59:16.921 -> RDY
12:59:16.921 ->
12:59:16.967 -> +CFUN: 1
12:59:16.967 ->
12:59:16.968 -> simSerial end
12:59:17.695 -> -------------------------------
12:59:18.710 ->
12:59:18.710 -> +CPIN: READY
12:59:18.710 ->
12:59:18.756 -> simSerial end
12:59:20.912 -> -------------------------------
12:59:22.626 ->
12:59:22.626 -> Call Ready
12:59:22.659 ->
12:59:22.659 -> SMS Ready
12:59:22.659 ->
- try to send AT command in different way, no success
13:01:44.179 -> -------------------------------
13:01:44.212 -> Serial status: 1
13:01:45.213 -> AT
13:01:45.213 ->
13:01:45.213 -> Serial end
13:01:52.387 -> -------------------------------
13:01:52.427 -> Serial status: 1
13:01:53.398 -> AT\r
13:01:53.398 ->
13:01:53.398 -> Serial end
Also, I tried to send SMS from my phone to sim800l, it works fine, information printed out in Serial monitor as well:
12:01:40.616 -> -------------------------------
12:01:40.663 -> simSerial status: 1
12:01:41.633 ->
12:01:41.633 -> +CMTI: "SM",6
12:01:41.633 ->
12:01:41.675 -> simSerial end
Here is the wiring diagram:
Not sure is it wort to mention, but wiring part with resistors is done on breadboard.
Here is the code:
#include <AltSoftSerial.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// arduinoRxPin = 8;
// arduinoTxPin = 9;
AltSoftSerial simSerial;
// OLED 0.91 display
Adafruit_SSD1306 display = Adafruit_SSD1306(128, 32, &Wire);
void getSim800LResponse() {
while (simSerial.available()) {
Serial.println("-------------------------------");
String reponse = simSerial.readString();
Serial.println(reponse);
dispayMsg(reponse);
Serial.println("simSerial end");
}
}
void dispayMsg(String input) {
display.clearDisplay();
display.setCursor(0, 0);
display.println(input);
display.display();
}
void setup() {
//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);
//Begin serial communication with Arduino and SIM800L
simSerial.begin(9600);
/*********************/
/* OLED module setup */
/*********************/
// Address 0x3C for 128x32
Serial.println("Initializing OLED module...");
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.display();
delay(1000);
// Clear the buffer.
display.clearDisplay();
display.display();
// text display tests
display.setTextSize(1);
display.setTextColor(WHITE);
Serial.println("OLED module intialized");
/*************************/
/* OLED module setup end */
/*************************/
/********************/
/* SIM module setup */
/********************/
Serial.println("Initializing SIM module...");
String command = "AT";
//Once the handshake test is successful, it will back to OK
simSerial.println(command);
getSim800LResponse();
Serial.println("Sleep...");
delay(2000);
//Signal quality test, value range is 0-31 , 31 is the best
simSerial.println("AT+CSQ");
getSim800LResponse();
Serial.println("Sleep...");
delay(2000);
//Read SIM information to confirm whether the SIM is plugged
simSerial.println("AT+CCID");
getSim800LResponse();
Serial.println("Sleep...");
delay(2000);
//Check whether it has registered in the network
simSerial.println("AT+CREG?");
getSim800LResponse();
Serial.println("Sleep...");
delay(2000);
Serial.println("SIM module intialized");
/************************/
/* SIM module setup end */
/************************/
}
void loop() {
if (Serial.available()) {
Serial.println("-------------------------------");
Serial.print("Serial status: ");
Serial.println(Serial.available());
String command = Serial.readString();
Serial.println(command);
simSerial.println(command);
Serial.println("Serial end");
}
getSim800LResponse();
}
Any hint/comment/ help will be appreciated.
If there is something missing in description, don't hesitate to ask.
Cheers!