Categories
Price Range
Manufacturers
Themes
    Home > Products > 021- Wireless > SIM900A GSM Module - GPRS Wireless SIM 900A Board Arduino PIC
    SIM900A GSM Module - GPRS Wireless SIM 900A Board Arduino PIC
    enlarge

    SIM900A GSM Module - GPRS Wireless SIM 900A Board Arduino PIC

    RM90.00  
    Item details
    SKU: 021-002
    Weight: 100 grams
    Stock: Out of stock


      Share This   Add To Facebook   Add To MySpace   

    Modul GSM SIM900A direka menggunakan modul SIM900A dari SIMCOM dan sesuai digunakan bersama sama dengan Arduino. Modul GSM ini membolehkan pengguna untuk berkomunikasi menggunakan rangkaian telefon bimbit GSM. Modul ini membolehkan anda untuk menggunakan fungsi khidmat pesanan ringkas atau SMS melalui komunikasi UART dengan menghantar AT Command.

    Baca lebih lanjut di Arduino Bagaimana Untuk Menggunakan Modul GSM SIM900A.

    DIY Projek menggunakan GSM SIM900A : 9 Sensor Gas Membentuk Sistem Pengesan Kebocoran Gas Arduino

    DIY Projek menggunakan GSM SIM900A : Sistem Pengesan Kebocoran Gas Arduino Menghantar SMS Amaran

    Pautan:

    Fail utama SIM900 : Muat turun fail di sini

    Fail tambahan SIM900 : Muat turun fail di sini

    Sambungan Litar

    Kod Arduino

    /* Programmer : Muhammad Ilyasaa Bin Abdul Rahman
     * More info at https://www.nadieleczone.com.my
     */
    
    int debug = 0;  // 1=disableDebugMode , 0=enableDebugMode
    
    #include <SoftwareSerial.h>
    #include <String.h>
    
    SoftwareSerial gsmSerial(7, 8); // RX, TX
    
    void setup()
    {
      pinMode(LED_BUILTIN, OUTPUT);
      digitalWrite(LED_BUILTIN, LOW);
      delay(1000);
      
      gsmSerial.begin(19200);  //Connect to SIM900  
      Serial.begin(9600);    //Connect to computer 
      delay(10000); //10s
    
      powerOn();
      sendTextMessage();
      Serial.println("Done, sms should be sent to the number written in the code.");
      digitalWrite(LED_BUILTIN, HIGH);
      delay(1000);  
    }
    
    void loop()
    {
    
    }
    
    void powerOn()
    {
        uint8_t answer=0;
        
        while(1)
        {    
          answer = sendATcommand("AT", "OK", 2000);          // checks if the module is started
          if( debug == 0 )  Serial.println();
          if (answer == 0);
          else  break;
        }
        if( debug == 0 )  Serial.println("Succesful ON");
    }
    
    void sendTextMessage()
    {
      gsmSerial.print("AT+CMGF=1\r");    //Because we want to send the SMS in text mode
      delay(500);
      gsmSerial.println("AT + CMGS = \"+60194339489\"");//send sms message, be careful need to add a country code before the cellphone number
      delay(500);
      gsmSerial.println("A test message!");//the content of the message
      delay(500);
      gsmSerial.println((char)26);//the ASCII code of the ctrl+z is 26
      delay(500);
    }
    
    int8_t sendATcommand(char* ATcommand, char* expected_answer, unsigned int timeout)
    {
        uint8_t x=0,  answer=0;
        char response[100];
        unsigned long previous;
        memset(response, '\0', 100);
        delay(500);              
        
        while( gsmSerial.available() > 0) gsmSerial.read();    // Clean the input buffer
        gsmSerial.println(ATcommand);    // Send the AT command 
        if( debug == 0 )  Serial.println(ATcommand); 
        
        x = 0;
        previous = millis();
        // this loop waits for the answer
        do
        {
            // if there are data in the UART input buffer, reads it and checks for the asnwer
            if(gsmSerial.available() != 0)
            {    
                response[x] = gsmSerial.read();
                if( debug == 0 )  Serial.write(response[x]); 
                x++;
                // check if the desired answer is in the response of the module
                if (strstr(response, expected_answer) != NULL)    
                {
                    answer = 1;
                    if( debug == 0 )  Serial.println(); 
                    for( int count = 0; count < x ; count++)
                    {
                       if( debug == 0 )  Serial.write(response[count]); 
                    }
                }
            }
            // Waits for the asnwer with time out
        }while((answer == 0) && ((millis() - previous) < timeout));    
        return answer;
    }