--> Project V - 8. Read SMS using SIM900A Based on Arduino | basic arduino tutorial

Thursday, September 7, 2017

Project V - 8. Read SMS using SIM900A Based on Arduino

| Thursday, September 7, 2017
Read SMS using SIM900A


Arduino is used to process SMS data and display it on a 20x4 LCD connected to an I2C connection. The GSM module used is SIM900A.

Hardware Requirement
  • Arduino Uno Board
  • SIM900A GSM Module (you can also use Wavecom)
  • LCD 16*2 or 20*4 (with i2c connection is recomended)
  • Power supply +5 Volt
  • Jumper

SIM900A | Source

Block Diagram


  Schematic




Arduino LCD 20x4
 Learn more about I2C connections --> Project V - 14


Arduino - SIM900A


Source Code

#include <GPRS_Shield_Arduino.h>
#include <SoftwareSerial.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F, 20, 4);
#define PIN_TX    9
#define PIN_RX    8
#define BAUDRATE  9600

#define MESSAGE_LENGTH 160
char message[MESSAGE_LENGTH];
int messageIndex = 0;

char phone[16];
char datetime[24];

GPRS gprsTest(PIN_TX, PIN_RX, BAUDRATE); //RX,TX,PWR,BaudRate

void setup() {
  lcd.begin();
  delay(6000);
  lcd.setCursor(0, 0);
  lcd.print("Initialization.....");
  while (!gprsTest.init()) {
    delay(1000);
    lcd.setCursor(0, 1);
    lcd.print("   init error  ");
  }
  lcd.setCursor(0, 1);
  lcd.print(" Gprs init success");
  delay(3000);
}

void loop() {
  messageIndex = gprsTest.isSMSunread();
  lcd.setCursor(0, 0);
  lcd.print("  System is ready  ");
  lcd.setCursor(0, 1);
  lcd.print(" Waiting a message");
  if (messageIndex > 0) { //At least, there is one UNREAD SMS
    gprsTest.readSMS(messageIndex, message, MESSAGE_LENGTH, phone, datetime);
    //In order not to full SIM Memory, is better to delete it
    gprsTest.deleteSMS(messageIndex);
    lcd.setCursor(3, 2);
    lcd.print(phone);
    lcd.setCursor(2, 3);
    lcd.print(message);
    delay(5000);
    lcd.clear();
  }
}

How it Works

1. Connect the Arduino with Peripherals needed.
2. Plug in the Power Source on the device.

3. Add some library if needed
4. Compile and upload the script program
5. First, Modem will initialize and it takes about 3 seconds



6. After a few second


7. When there is one incoming message, it will be directly displayed on the LCD of the sender
    number and the contents message

8. Lcd will return to normal view.


Video for Project V - 8. Read SMS using SIM900A Based on Arduino



Required file


Related Posts

No comments:

Post a Comment