Search code examples
gsmmsp430

MSP430 And Gsm interfacing using energia


I am working on a project, which involves sending SMS from MSP430G2553 to GSM module. Below here is the code, I am using for interfacing of GSM and MSP430G2553 micro controller. This code is neither showing any error nor it is executing.

Kindly suggest some solutions.

#include<msp430.h>

void setup(){
    Serial.begin(9600);
    //pinMode(RED_LED, OUTPUT);
    //pinMode(GREEN_LED, OUTPUT);
}

void loop(){
    sendsms();
}

void sendsms()
{
    Serial.println(" AT+CMGF=1 ");
    // digitalWrite(GREEN_LED, LOW);
    Serial.println(" AT+CMGS =\"1234567890\""); //Enter Mobile Number between double "  " codes.
    Serial.println("Hello World!"); //SMS to ur Mobile Number
    delay(5000);
    delay(5000);
}

For the physical connection between the gsm and MSP430G2553 micro controller. I have connected pin

  1. Pin P1.1 -> Rx of GSM.
  2. Pin P1.2 -> Tx of GSM.
  3. Connected GND of both boards.

Is this connection correct?? OR

I need to physically connect more wires between the two boards?


Solution

  • Your Energia coding is right. but you need to add some additional at commands to send sms using gsm module.below i provide the modified code.

    and call the sendsms() function in setup() function for send sms only once when you push reset button. if it is in loop() function without any condition then the gsm module send sms continously.

    #include<msp430.h>
    void sendsms()
    {
    Serial.println("AT\r");
    delay(1000);
    Serial.println("AT+CMGF = 1\r");
    delay(1000);
    Serial.println(" AT+CMGS =\"1234567890\"\r");
    delay(1000);
    Serial.println("HELLO WORLD");
    delay(1000);
    Serial.println((char)26);
    delay(100);
    }
    void setup(){
        Serial.begin(9600);
        //pinMode(RED_LED, OUTPUT);
        //pinMode(GREEN_LED, OUTPUT);
       sendsms();
    }
    
    void loop(){
    
    }
    

    try this code. still didn't get sms then check the gsm module default baud rate is 9600 or what.