Arduino digunakan untuk memproses data SMS dan menampilkannya pada LCD 20x4 yang terhubung dengan koneksi I2C. Modul GSM yang digunakan adalah SIM900A.
Kebutuhan Hardware
- Modem SMS Getway (SIM900A)
- PC / Laptop dengan Arduino IDE
- Modul Serial RS232
- Modul LCD 2x16 atau 20x4 (dengan koneksi i2c)
- Modul Arduino UNO
- Power supply +5Volt
SIM900A | Source
Diagram Blok
Schematic
Arduino - LCD 20x4
#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();
}
}
Cara Kerja Alat
1. Koneksikan antara sistem Arduino dengan peripheral lain seperti pada rangkaian (skematik).
2. Pasang power supply (adaptor 5 V) dan hidupkan (colokkan ke sumber PLN 220V) sehingga
lampu LED indikator nyala, LCD juga nyala.
3. Ketika pertama kali dihidupkan.
4. Setelah beberapa detik
5. Ketika ada satu pesan masuk, maka akan langsung ditampilkan pada LCD nomor pengirim dan isi
pesan
6. Tampilan akan kembali ke normal
Video untuk Project V - 8. Membaca SMS menggunakan SIM900A berbasis Arduino
File yang dibutuhkan
Sumber : Tutorial dasar Arduino
Posting Komentar