Go Down

Topic: Readinf SMS Using arduino UNO and SIM800L and print on LCD(16x2 alphanumeric). (Read 1 time) previous topic - next topic


Well, I making device, which have to receive sms and print the text using LCD display. Now I have a code which can receive sms and store it into String variable using serial connection.
Here is my code:

#include <LiquidCrystal.h>
#include <SoftwareSerial.h>

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;  //LCD pins
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);                 
String Arsp, Grsp;
SoftwareSerial gsm(6,7); // RX, TX

void setup()
  Serial.println("Testing GSM SIM800L");
  gsm.println("AT");    //checking
  gsm.println("AT+CMGF=1");  //Set to Text mode
  gsm.println("AT+CNMI=1,2,0,0,0"); //Set to notification for new message, New message indication
  lcd.begin(16, 2);

void loop()
  if(gsm.available())                  //Check if GSM Send any data

    Grsp = gsm.readString();           //Read data received from SIM800L GSM Module
    lcd.clear();                       //Clear LCD Screen
    lcd.setCursor(0,0);                //Set LCD cursor to First line, first row
    for(int i = 0; i<=100; i++)        //Print received string character by character
        lcd.print(Grsp);            //Print string which received from GSM (sms, sender, sms index, receive time, etc)
        lcd.print("        ");
        lcd.print(i);                  //Print the string index
When my Arduino UNO is connected to PC and Arduino serial monitor is already open, 
it prints correctly this text received from GSM
"  +CMT: "+995599093230","","18/01/05,16:29:57+16"  0.
In this case i sen message whch text was "0".
When i disconnect USB and connect my arduino Uno to 9V power supply and send the same message text it print "  +CMTI:  "ME", "+995598403536", 40) in this case 40 is the index of the message which receive.
I want to get whole string აas in the first case when the USB was connected.
I using arduni GND and 5V to power SIM800L.


Also posted at:
If you're going to do that then please be considerate enough to add links to the other places you cross posted. This will let us avoid wasting time due to duplicate effort and also help others who have the same questions and find your post to discover all the relevant information. When you post links please always use the chain links icon on the toolbar to make them clickable.

Go Up