You are on page 1of 11

1 Inkubatek [supported by : www.tokotronik.

com]

Sistem keamanan Kendaraan


Sistem Kerja Alat:
Sistem keamanan kendaraan berbasisi SMS dan GPS, jika kendaraan dicuri maka pemilik
kendaraan bisa mengetahui lokasi kendaraan dengan GPS dan dapat mengontrol power
kendaraan tersebut dengan SMS. Sisitem kendali jarak jauh menggunakan Modem SMS
sedangkan pembacaan lokasi menggunakan Modul GPS. Untuk mengetahui lokasi
kendaraan cukup dengan SMS “GET LOCATION” setelah SMS dikirim dan dibaca oleh
modem kemudian modem mengirimkan balasan berupa lokasi kendaraan ke nomor
pengirim SMS tersebut.

Kebutuhan Hardware :
 Modul GPS NEO6MV2
 Modul SMS SIM800L V2
 Modul Relay
 Modul LCD 2x16
 Modul Arduino UNO
 Power supply +9Volt

INKUBATEK
MODULE GPS NEO6MV2

MODULE SIM800L V2

Diagram Blok:
2 Inkubatek [supported by : www.tokotronik.com]

LCD 2X16
HP
Modem SMS

Arduino UNO
GETWAY

Ke kabel
Satelit Module GPS Relay starter

Schematics

Gambar Koneksi Modul GPS NEO-6M-0-001 dengan Arduino


3 Inkubatek [supported by : www.tokotronik.com]

Gambar Koneksi Modul SIM800L dengan Arduino

Koneksi Arduino UNO dengan LCD:


4 Inkubatek [supported by : www.tokotronik.com]

Pin ARDUINO LCD

2 RS
3 EN
4 D4
5 D5
6 D6
7 D7

Koneksi Modul GPS:


Pin Modul GPS Pin ARDUINO

GND GND
VCC +3.5V
RX Pin 9
TX Pin 8

Koneksi Modul SMS (SIM800L) pin power 5VIN lebih bagus menggunakan tegangan
5Volt/2A tegangan harus setabil dengan power supply eksternal:
Pin Modul GPS Pin ARDUINO

GND GND
RX Pin 9
TX Pin 8

Source Code/Sketch :
/*************************************
* Program : Project 51. Kendali dan Monitoring Posisi Kendaraan
* Input : Modul GPS NEO6MV2Sensor , Modul SMS SIM800L V2
* Output : LCD 2x16, Relay
* 125 Proyek Arduino Inkubatek
* www.tokotronik.com
* ***********************************/
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
5 Inkubatek [supported by : www.tokotronik.com]

static const uint32_t GPSBaud = 9600;

#define SMSduino_RX 8
#define SMSduino_TX 9

TinyGPSPlus gps;
SoftwareSerial SMSduino = SoftwareSerial(SMSduino_TX, SMSduino_RX);

String inString="";
String inString2="";
String Stemp="";
String inbox="";
String noPengirim="";
String no_HP="";
String SMS="";
String LS="";
String BT="";
char str,f;
int i,j,k;

void getmodem()
{
f=1;
inString="";
while(f)
{
if(SMSduino.available())
{
str=SMSduino.read();
switch (str)
{
case '\r': break;
case '\n':f=0; break;
default:inString+=(char)str;
}
}
}
}

//=========================
void getmodem2()
{
f=1;
inString2="";
6 Inkubatek [supported by : www.tokotronik.com]

while(f)
{
if(SMSduino.available()>0)
{
str=SMSduino.read();
switch (str)
{
case '\r': break;
case '\n':f=0; break;
default:inString2+=(char)str;
}
}
}
}

void bacaSMS()
{
getmodem();
getmodem2();
i=inString2.indexOf(':');
if(i>0)
{
Stemp=inString2.substring(0,i);
if(Stemp=="+CMTI")
{
i=inString2.indexOf(',');
j=inString2.length ();
i=i+1;
inbox=inString2.substring(i,j);
SMSduino.print("AT+CMGR=");
SMSduino.println(inbox);
getmodem();
getmodem();
getmodem2();
i=inString.indexOf(',');
i=i+2;
j=inString.indexOf(',',i);
j=j-1;
noPengirim=inString.substring(i,j);
no_HP=noPengirim.substring(i,j);
lcd.clear();
lcd.print("SMS:");
lcd.print(inString2);
lcd.setCursor(0,1);
lcd.print(noPengirim);
7 Inkubatek [supported by : www.tokotronik.com]

if(inString2=="GET LOCATION"){
kirimSMSlokasi(noPengirim);
delay(1000);
}
else if(inString2=="POWER OFF"){
digitalWrite(A0, HIGH);
SMS="MOTOR OFF";
kirim_SMS(noPengirim,SMS);
}
else if(inString2=="POWER ON"){
digitalWrite(A0, LOW);
SMS="MOTOR ON";
kirim_SMS(noPengirim,SMS);
}
else {
SMS="FORMAT SALAH!";
kirim_SMS(noPengirim,SMS);
}
delay(5000);
SMSduino.print("AT+CMGD=");
SMSduino.println(inbox);
getmodem();
lcd.clear();
lcd.print("Hapus Inbox="+inbox);
delay(2000);
}
}
}
//=====================
void kirimSMSlokasi(String nomor_HP){
SMSduino.print("AT+CMGS=");
SMSduino.print("\"");
SMSduino.print(nomor_HP);
SMSduino.print("\"");
SMSduino.print("\r");
delay(200);
//https://www.google.co.id/maps/@-X.XXXXXXX,XXX.XXXXXX,15z
SMSduino.println("Lokasi Kendaraan Anda");
SMSduino.print("https://www.google.co.id/maps/@");
SMSduino.print(gps.location.lat(), 6);
SMSduino.print(",");
SMSduino.print(gps.location.lng(), 6);
SMSduino.print(",20z");
SMSduino.print("\r");
8 Inkubatek [supported by : www.tokotronik.com]

delay(500);
SMSduino.print((char)26);
delay(100);
SMSduino.println();
}

//=====================
void kirim_SMS(String nomor_HP,String isi_SMS){
SMSduino.print("AT+CMGS=");
SMSduino.print("\"");
SMSduino.print(nomor_HP);
SMSduino.print("\"");
SMSduino.print("\r");
delay(200);
SMSduino.print(isi_SMS);
SMSduino.print("\r");
delay(500);
SMSduino.print((char)26);
delay(100);
SMSduino.println();
}

//===============================
void setup(){
pinMode(A0, OUTPUT);
digitalWrite(A0, LOW);
Serial.begin(9600);
//ss.begin(GPSBaud);
SMSduino.begin(9600);
lcd.begin(16, 2);
lcd.print("Tes Koneksi ..");
delay(1000);

SMSduino.println("AT");
getmodem();
getmodem();
lcd.setCursor(0, 1);
lcd.print(inString);
if(inString=="OK") {
lcd.setCursor(0,1);
lcd.print("Koneksi OK ");
}
else{
lcd.setCursor(0,1);
lcd.print("Gagal,coba lagi!");
9 Inkubatek [supported by : www.tokotronik.com]

while(1);
}

delay(2000);
lcd.clear();
lcd.print("Kendali&Monitor");
lcd.setCursor(0, 1);
lcd.print(" Kendaraan");
delay(2000);
lcd.clear();
lcd.print("berbasisi SMS &");
lcd.setCursor(0,1);
lcd.print(" GPS");
delay(2000);
}

void loop(){
while (Serial.available() > 0)
if (gps.encode(Serial.read())) displayInfo();
if (millis() > 5000 && gps.charsProcessed() < 10){
lcd.clear();
lcd.print("No GPS detected:");
lcd.setCursor(0,1);
lcd.print("check wiring.");
while(true);
}
if(SMSduino.available())bacaSMS();
}

void displayInfo(){
if (gps.location.isValid()){
lcd.setCursor(0, 0);
lcd.print(gps.location.lat(), 6);
LS=(gps.location.lat(), 6);
lcd.print(" LS ");
lcd.setCursor(0, 1);
lcd.print(gps.location.lng(), 6);
BT=(gps.location.lng(), 6);
lcd.print(" BT ");
}
else{
lcd.clear();
lcd.print("INVALID");
}
delay(500);
10 Inkubatek [supported by : www.tokotronik.com]

Jalannya Alat :
1. Pertama kali tes koneksi antara Modul SIM800L dengan Arduino dengan mengirim AT
Commant “AT” ke Modul SIM800L, tunggu sampai koneksi “OK”:

Tes Koneksi ..
Koneksi OK
2. Selanjutnya tampilkan keterangan alat:

Kendali&Monitor berbasisi SMS &


Kendaraan GPS
3. Tampilan normal menampilkan lokasi / posisi GPS tersebut:

-7.813490 LS
110.406448 BT
4. Jika ada SMS masuk maka isi SMS akan dibaca dan di balas, format SMS sebagai berikut:
Format SMS Balasan /report

GET LOCATION Berupa lokasi kendaraan


POWER OFF MOTOR OFF
POWER ON MOTOR ON
Jika format salah FORMAT SALAH!

Tulisan harus besar semua. Besar kecil tulisan berpengaruh / casesensitive.


Saran jika di apilkasikan pada kendaraan LCD tidak usah digunakan dan power supply
langsung dari aki jangan lupa gunakan regulator 5V.
11 Inkubatek [supported by : www.tokotronik.com]

[Uji coba memakai hardware “Master Mikro ARDUINO V2” :


http://tokotronik.com/master-mikro-arduino-v2/ ]

You might also like