Arduino projects

GSM Based Notice Board using Arduino and SIM900A

SIM900A GSM Based Notice Board

Hey, folks. In this tutorial, we are making a GSM Based Notice Board using SIM900A GSM module and Arduino Uno. Whenever an SMS is sent to the GSM, it forwards that to microcontroller i.e. Arduino and that message is updated to the notice board (here, using 16X2 LCD as an example). The project is very straightforward and takes less than 10 minutes to make.

List of the items required for this project :

  • GSM/GPRS Module ( Here, we are using SIM900A)
  • Arduino Uno
  • 2G Sim Card
  • Jumper Wires
  • 16X2 LCD Display
  • Few connectors/jumper wires

Why SIM900A?

SIM900A works on frequencies 900/ 1800 MHz and it generally comes with an RS232 interface, which allows us to connect microcontroller as well as PC with RS232 Chip(MAX232). There are other modular versions that have the different set of hardware architecture but all work the same ways. Baud rate can be configurable from 9600-115200 using AT command. The GSM/GPRS Modem have internal TCP/IP stack which enables us to connect with internet via GPRS. Thus, it is suitable for SMS, Voice as well as DATA transfer application in M2M interface.

Note: You can choose other GSM modules too and also the code and connection of pins
 will work fine for that particular module too.
This SIM900A module needs a dedicated supply of 12V 1A.

Since GSM modules are manufactured by different vendors. So, they all have work on different input power supply. So, before using one blindly it is recommended to double check the GSM modules power requirements. Here, our gsm module requires a 12 volts input, so we supplying 12V,1A DC power to it. Some GSM modules require 15 volts and some other needs only 5 volts. In that cases, we can power it directly from Arduino’s 5V out.

Guide on Booting GSM module:

1. Insert the SIM card to the module and lock it properly in position.

2. Connect the power adapter to the module and turn it ON!

3. Now wait for few seconds (say around 60sec) and see the blinking rate of ‘status LED’ (GSM module will take some time to establish a connection with the mobile network)

4. Once the connection is established successfully, the status LED will blink continuously every 2sec (or 3sec).

Here, is the flow diagram of the project that shows how the whole system works-Whenever an SMS is sent to the GSM, it forwards that to microcontroller i.e. Arduino and thereafter that particular message is updated to LCD Display.

Connection:

Sim900A GSM module’s Tx and Rx pins to Arduino Rx and Tx respectively.

Common the Ground(GND) of both Arduino and Sim900A GSM Module.

16X2 LCD as shown below :

Code:

// This code is written by Ashish Maurya in collaboration with Roboshala
#include <LiquidCrystal.h>
LiquidCrystal lcd(7,6,5,4,3,2);

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);
  pinMode(led, OUTPUT);
  digitalWrite(led, HIGH);
  lcd.print("GSM Initilizing...");
  gsm_init();
  lcd.setCursor(0,0);
  lcd.print("Wireless Notice");
  lcd.setCursor(0,1);
  lcd.print("    Board      ");
  delay(2000);
  lcd.clear();
  lcd.print("Technolab creation");
  delay(1000);
  lcd.setCursor(0,1);
  lcd.print("System Ready");
  Serial.println("AT+CNMI=2,2,0,0,0");
  delay(500);
  Serial.println("AT+CMGF=1");
  delay(1000);
  digitalWrite(led, LOW);
}

void loop()    
{
  for(unsigned int t=0;t<60000;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++];
        }
      }
      x++;
    }
    msg[k]='\0';
    lcd.clear();
    lcd.print(msg);
    delay(1000);
    temp=0;
    i=0;
    x=0;
    k=0;
  }
  }
  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);
    }
  }
}

void gsm_init()
{
  lcd.clear();
  lcd.print("Finding Module..");
  boolean at_flag=1;
  while(at_flag)
  {
    Serial.println("AT");
    while(Serial.available()>0)
    {
      if(Serial.find("OK"))
      at_flag=0;
    }
    delay(1000);
  }

  lcd.clear();
  lcd.print("Module Connected..");
  delay(1000);
  lcd.clear();
  lcd.print("Disabling ECHO");
  boolean echo_flag=1;
  while(echo_flag)
  {
    Serial.println("ATE0");
    while(Serial.available()>0)
    {
      if(Serial.find("OK"))
      echo_flag=0;
    }
    delay(1000);
  }

  lcd.clear();
  lcd.print("Echo OFF");
  delay(1000);
  lcd.clear();
  lcd.print("Finding Network..");
  boolean net_flag=1;
  while(net_flag)
  {
    Serial.println("AT+CPIN?");
    while(Serial.available()>0)
    {
      if(Serial.find("+CPIN: READY"))
      net_flag=0;
    }
    delay(1000);
  }
  lcd.clear();
  lcd.print("Network Found..");
  delay(1000);
  lcd.clear();
}

Direct Download:  Sharing is Caring

 

Check other projects on GSM Module :

Arduino SIM900A Home Automation

Phone Call Automation using DTMF Decoder

Tags
Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button
Close