image1

LET'S MAKE SOMETHING|I'M MAKER FROM SANTRI

GPRS SHIELD SIM900 SMS TELPON

Latar belakang, emang suka ngoprek  jadi nya pengen wehh beli ini module. Cuman biasalah cari2 yang murah meriah. Cerita dapet nih module, belinya sekitar dua tahun yang lalu dari ebay.com harganya sekitar $22, lumayan lah segitumah.

Fitur Singakat :
Support Board : Arduino UNO / MEGA / Leonardo
Support Frequency :Quad-Band 850 / 900/ 1800 / 1900 MH
Bisa sms atau nelpon .
Communication : RX  SIM900, bisa gunakan D1 atau D3. Untuk TX SIM900, bisa digunakan pin D0/D2/D8/D10 pilih jumper nya
Power Button : 7

Berikut penampakan shield gsm yg udah kepasang ama arduino uno, gk perlu lagi ribet2 pasang jumper tinggal pasang ke Arduinonya

GPRS SHIELD SIM900
GPRS SHIELD SIM900

GPRS SHIELD SIM900
GPRS SHIELD SIM900, TELPONAN JUGA
Sebelum lanjut ke koding, perlu dinyalain dulu shieldnya. Berikut kode nya di taro di void setup()


1
2
3
4
5
6
  //NYALAIN SHIELDNYA
  pinMode(7, OUTPUT);
  digitalWrite(7, LOW);
  delay(4000);
  digitalWrite(7, HIGH);
  delay(3000);

Untuk Test komunikasi gunakan Software serial, berikut contoh kodingnya

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <SoftwareSerial.h>
SoftwareSerial SIM900A(2, 3); // RX | TX
// Connect the SIM900A TX to Arduino pin 2 RX.
// Connect the SIM900A RX to Arduino pin 3 TX.
char c = ' ';
void setup()
{

  //NYALAIN SHIELDNYA
  pinMode(7, OUTPUT);
  digitalWrite(7, LOW);
  delay(4000);
  digitalWrite(7, HIGH);
  delay(3000);
  // start th serial communication with the host computer
  Serial.begin(9600);
  while (!Serial);
  Serial.println("Serial udah siap");

  // start communication with the SIM900 in 9600
  SIM900A.begin(9600);
  Serial.println("SIM900 udah oke);
  delay(1000);
  Serial.println("Siap menerima perintah!");
}

void loop()
{

  // Keep reading from SIM900 and send to Arduino Serial Monitor
  if (SIM900A.available())
  { c = SIM900A.read();
    Serial.write(c);
  }

  // Keep reading from Arduino Serial Monitor and send to SIM900
  if (Serial.available())
  { c = Serial.read();
    SIM900A.write(c);
  }

}

Ketikan AT maka akan ada balasan OK, berarti sudah berhasil komunikasi dengan Shield nya.
Lanjut coba kirim sms via Software serial.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <SoftwareSerial.h>

SoftwareSerial SIM900A(2, 3);

void setup()
{
  SIM900A.begin(9600);   // Setting  baud rate GSM Module
  Serial.begin(9600);    // Setting  baud rate Serial Monitor (Arduino)
  Serial.println ("SIM900 Ready");
  delay(100);

  SendMessage(); // KIRIM SMS

}


void loop()
{
}


void SendMessage()
{
  Serial.println ("SIM900 Mengirim SMS");
  SIM900A.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
  delay(1000);  // Delay of 1000 milli seconds or 1 second
  Serial.println ("Set SMS Number");
  SIM900A.println("AT+CMGS=\"+6282213542319\"\r"); // JGN lup ahganti dulu sebelum upload
  delay(1000);
  Serial.println ("Set SMS Content");
  SIM900A.println("HELLO TEST MSMSMSSSS");// The SMS text you want to send
  delay(100);
  Serial.println ("Finish");
  SIM900A.println((char)26);// ASCII code of CTRL+Z
  delay(1000);
  Serial.println (" ->SMS Terkirim sudah");
}

Ditas contoh koding tanpa library, ribet yaa???
Langsung aja lahhh biar gampang ngoding nya.
pertama download library nya dulu
https://github.com/Seeed-Studio/GPRS_SIM900
Ini sample koding buat kirim sms, 
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
GPRS Connect TCP

This sketch is used to test seeeduino GPRS_Shield's send SMS func.
to make it work, you should insert SIM card to Seeeduino GPRS 
and replace the phoneNumber,enjoy it!

create on 2015/05/14, version: 1.0
by lawliet.zou(lawliet.zou@gmail.com)
*/
#include <GPRS_Shield_Arduino.h>
#include <SoftwareSerial.h>
#include <Wire.h>

#define PIN_TX    2 //DEFAULT nYA
#define PIN_RX    3 //DEFAULT nYA
#define BAUDRATE  9600 //DEFAULT nYA
#define PHONE_NUMBER "082213542319" 
#define MESSAGE  "HALOOW DUINO"

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

void setup() {
//NYALAIN SHIELDNYA
  pinMode(7, OUTPUT);
  digitalWrite(7, LOW);
  delay(4000);
  digitalWrite(7, HIGH);
  delay(3000);

//MULAI --------------
  Serial.begin(9600);
  while(!gprsTest.init()) {
      delay(1000);
      Serial.print("init error\r\n");
  }  
  Serial.println("gprs init success");
  Serial.println("start to send message ...");
  gprsTest.sendSMS(PHONE_NUMBER,MESSAGE); //define phone number and text
}

void loop() {
  //nothing to do
}


Gmn kalo mau neplon??
ini contoh kodingnyaa

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
GPRS Call Up

This sketch is used to test seeeduino GPRS_Shield's callUp function.
to make it work, you should insert SIM card to Seeeduino GPRS
and replace the phoneNumber,enjoy it!

create on 2015/05/14, version: 1.0
by lawliet.zou(lawliet.zou@gmail.com)
*/
#include <GPRS_Shield_Arduino.h>
#include <SoftwareSerial.h>
#include <Wire.h>

#define PIN_TX    2
#define PIN_RX    3
#define BAUDRATE  9600
#define PHONE_NUMBER  "082213542319"

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

void setup() {
  //NYALAIN SHIELDNYA
  pinMode(7, OUTPUT);
  digitalWrite(7, LOW);
  delay(4000);
  digitalWrite(7, HIGH);
  delay(3000);

  //MULAI --------------
  Serial.begin(9600);
  while (!gprsTest.init()) { //gprs init
    delay(1000);
    Serial.print("gagal euyyy\r\n");
  }
  Serial.println("gprs init success");
  Serial.println("start to call ...");
  gprsTest.callUp(PHONE_NUMBER);
}

void loop() {
  //nothing to do
}

Gampang yaa pakai library.
Selesai. dulu yaaa. moga manfaat

Share this:

CONVERSATION

0 comments: