Close or Esc Key

Arduino Projects   |   Raspberry Pi   |   Electronic Circuits   |   AVR   |   PIC   |   8051   |   Electronic Projects

GSM Display system using arduino

2 posts / 0 new
Last post
Sachin
Sachin's picture
Offline
Last seen: 2 years 6 months ago
Joined: 17/12/2015 - 15:14
GSM Display system using arduino

Dear sir,

I have modified the code attached because initially it wasn’t working.

Still it is not working i.e. the message send through gsm module is not displaying on LCD but it showing on the serial monitor.

Is there any problem in reading data serially and displaying??

According to your code the string is in # and *???

Please help me out….

Resolve the issue.

 

 

 

Thanks and Regards

Sachin Telgote

 

 

code as

#include <SoftwareSerial.h>

#include <LiquidCrystal.h>

LiquidCrystal lcd(12,11,5,4,3,2);

SoftwareSerial mySerial(7,8);

int led=13;

int temp=0,i=0,x=0,k=0;

char str[100],msg[32];

void setup()

{

  lcd.begin(16,2);

  Serial.begin(9600);

  mySerial.begin(9600);

  pinMode(led, OUTPUT);

  digitalWrite(led, HIGH);

  lcd.setCursor(0,0);

  lcd.print("GSM Initilizing...");

  gsm_init();

 

  lcd.print("Wireless Notice");

  lcd.setCursor(0,1);

  lcd.print("    Board      ");

  delay(2000);

  lcd.clear();

  lcd.print("Forklift");

  delay(1000);

  lcd.setCursor(0,1);

  lcd.print("Communication");

  mySerial.println("AT+CNMI=2,2,0,0,0"); // AT Command to recieve a live SMS

  delay(1000);

 

  mySerial.println("AT+CMGF=1"); // AT Command to recieve a live SMS

  delay(1000);

 

 mySerial.println("AT+CPMS='SM' "); // AT Command to recieve a live SMS

  delay(1000);

 

 mySerial.println("AT+CMGL= 'ALL' "); // AT Command to recieve a live SMS

  delay(1000);

 

 mySerial.println("AT+CMGR=2"); // AT Command to recieve a live SMS

  delay(1000);

 

 mySerial.println("AT+CMGD=2"); // AT Command to recieve a live SMS

  delay(1000);

  

  digitalWrite(led, LOW);

}

void loop()   

{

  for(unsigned int t=0;t<10000;t++)

  {

    serialEvent();

  if(temp==1)

  {

    x=0,k=0,temp=0;

    while(x<i)

    {

      while(str[x]=='#')

      {

        x++;

        while(str[x]!='*')

        {

          msg[k++]=str[x++];

          Serial.print( msg[k++]);

        }

      }

      x++; 

   

    msg[k]='\0';

    }

    lcd.clear();

    lcd.print(msg[k++]);

    delay(1000);

    temp=0;

    i=0;

    x=0;

    k=0;

  }

  }

 

 

      if (mySerial.available())

    Serial.write(mySerial.read());

 

  lcd.scrollDisplayLeft();

}

void serialEvent()

{

  while(Serial.available())

  {

    char ch=(char)Serial.read();

    str[i++]=ch;

    if(ch == '*')

    {

      temp=1;

      lcd.clear();

      lcd.print("Message Received");

      delay(1000);

    }

     }

 

          if (mySerial.available())

        Serial.write(mySerial.read());

}

void gsm_init()

{

  lcd.clear();

  lcd.print("Finding Module..");

  boolean at_flag=1;

  if (mySerial.available())

      Serial.write(mySerial.read());

         mySerial.println("AT");

 

    delay(1000);

 

  lcd.clear();

  lcd.print("Module Connected..");

  delay(1000);

  lcd.clear();

  lcd.print("Disabling ECHO");

  boolean echo_flag=1;

 

     if (mySerial.available())

        Serial.write(mySerial.read());

 

   mySerial.println("ATE0");

    delay(1000);

 

  lcd.clear();

  lcd.print("Echo OFF");

  delay(1000);

  lcd.clear();

  lcd.print("Finding Network..");

  boolean net_flag=1;

 

     if (mySerial.available())

        Serial.write(mySerial.read());

 

        mySerial.println("AT+CPIN?");

   

           delay(1000);

 

  lcd.clear();

  lcd.print("Network Found..");

  delay(1000);

  lcd.clear();

}

 

 

 

 

 

 

 

 

 

 

 

Hari Prasaath K
Hari Prasaath K's picture
Offline
Last seen: 1 month 6 days ago
Joined: 20/01/2015 - 23:56
LCD Issues

Check with your hardware interface connection between arduiono and LCD and refer the below code how the LCD code functions

https://www.engineersgarage.com/embedded/arduino/how-to-interface-4-bit-...