วันศุกร์ที่ 12 พฤษภาคม พ.ศ. 2560

GSM Sim900 Module Send/Recieve Message




Hardware



SIM900A GSM/GPRS Module Specification



Power supply by 5V, can be powered by USB, for long term use it is better to still use 1A current power source. XH2.54-2P connector.TTL 5V and 3V3 interface (yellow pins marked on board), compatible with arduino, STM32, raspberry pi, etc.On board RS232 interface, easy for debugging. On the left, white pins.On board ring signal LED, on the left-top corner of SIM900A IC.On Board reset and restart pins, on the bottom of the SIM900A IC.Reserved IPX mini connector, but not yet soldered.Standard SMA antenna connector.Serial port is protected by TVS and beads circuit, to prevent any surging current or HV.SIM circuit has SMF05C electrostatics releasing IC.Package includes antenna and DC jack.Do NOT have audio power jack on board, which means you can not hearing or speaking through the call.Board size is 5×5 CM


Wiring

GSM   >>> Arduino pin

5VT(TX) >>> 2
5VR(RX) >>> 3
Gnd >>> Gnd

Power external ภายนอกเท่านั้นเพราะบอร์ดกระแสไม่พอ

Make sure all device common  Gnd .กราวน์ของบอร์ดและแหล่งจ่ายไฟต้องร่วมกัน




SIM900A True move AIS available (THAI)




POWER 5 Volt supply external recommend 




5 volt operate 










5VR connect to Pin3




 5VT connect to Pin 2



Make sure all ground connected






 Library Link



Copy library GSM900 to Arduino library








Video










CODE
#include "SIM900.h"
#include <SoftwareSerial.h>
//If not used, is better to exclude the HTTP library,
//for RAM saving.
//If your sketch reboots itself proprably you have finished,
//your memory available.
//#include "inetGSM.h"

//If you want to use the Arduino functions to manage SMS, uncomment the lines below.
#include "sms.h"
SMSGSM sms;

//To change pins for Software Serial, use the two lines in GSM.cpp.

//GSM Shield for Arduino
//www.open-electronics.org
//this code is based on the example of Arduino Labs.

//Simple sketch to send and receive SMS.

int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];

void setup()
{
     //Serial connection.
     Serial.begin(9600);
     Serial.println("GSM Shield testing.");
     //Start configuration of shield with baudrate.
     //For http uses is raccomanded to use 4800 or slower.
     if (gsm.begin(2400)) {
          Serial.println("\nstatus=READY");
          started=true;
     } else Serial.println("\nstatus=IDLE");

     if(started) {
          //Enable this two lines if you want to send an SMS.
          if (sms.SendSMS("0843545655", "Arduino SMS"))
          Serial.println("\nSMS sent OK");
     }

};

void loop()
{
     if(started) {
          //Read if there are messages on SIM card and print them.
        // deprecated method
        //if(gsm.readSMS(smsbuffer, 160, n, 20)) {
             //  Serial.println(n);
              // Serial.println(smsbuffer);
          //}
          
          //get 1st sms
         sms.GetSMS(1,n,20,smsbuffer,160);
         Serial.println(n);
         Serial.println(smsbuffer);
          
          delay(1000);
     }

};











ไม่มีความคิดเห็น:

แสดงความคิดเห็น