1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Sending sms through gsm900 using 8051

Discussion in '8051/8951' started by Veeramani.T, Apr 20, 2014.

  1. Veeramani.T

    Veeramani.T New Member

    Joined:
    Apr 18, 2014
    Messages:
    5
    Likes:
    1
    Location:
    India
    hi ,
    i am using 8051 for sending sms through gsm900.
    i got the AT commands correctly in hyper terminal.
    the problem is ......
    manually i send the AT commands from hyperterminal to gsm900, the module is sending the sms to my mobile correctly.
    but, gsm module is connected to MC , i could not get the sms.
    and my hardware connections are correct- MC - Max232- Gsm900 ( checked it)

    i dont know what is happening?
    my code is ...

    #include<reg51.h>

    void serial_int()
    {
    TMOD=0x20;
    TH1=0xfd;
    SCON=0x50;
    TR1=1;
    }

    void delay (unsigned int x)
    {
    unsigned int i,j;
    for(i=0;i<x;i++)
    {
    for(j=0;j<1275;j++);
    }
    }

    void serial (unsigned char s)
    {
    SBUF=s;
    while (TI==0);
    TI=0;
    }

    void send (char *z)
    {
    unsigned int k;
    for(k=0;z[k]!=0;k++)
    {
    serial (z[k]);
    }
    }

    void main()
    {
    serial_int();
    send ("AT\r\n");
    delay(200);
    send ("AT+CMGF=1\r\n");
    delay(200);
    send ("AT+CMGS=\"+91xxxxxxxx;\"\r\n");
    delay(200);
    send ("This is my message");
    serial (0x1a);
    while (1);
    }


    pls help me !!!!....
     
    Last edited: Apr 20, 2014
  2. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    I bet one hundred million dollars that this is a baudrate mismatch..
     
  3. JonSea

    JonSea Well-Known Member

    Joined:
    Oct 1, 2012
    Messages:
    1,119
    Likes:
    90
    Location:
    Seattle, WA
    You could connect the PC and hyperterm in place of the modem to verify what's being sent. This would verify the baud rate and the MAX232 circuit.

    Also, there may be issues with <CRLF> (carriage return / line feed) message terminators.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Veeramani.T

    Veeramani.T New Member

    Joined:
    Apr 18, 2014
    Messages:
    5
    Likes:
    1
    Location:
    India

    thanks for ur comments bros...
    i sent the AT commands from MC to hyperterm, I got the AT commands correctly.
    if baud rate is mismatched means how can i get the AT commands in hyperterm ....
    sorry sir i could not understand, how to modify my code and match baudrate ....
    pls help ..
    modify my posted code in #1 for getting sms from gsm module.
    i trying this for long time ....

    help help ......
     
  6. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    Maybe you need to send "\r\n" after send ("This is my message");
     
  7. Veeramani.T

    Veeramani.T New Member

    Joined:
    Apr 18, 2014
    Messages:
    5
    Likes:
    1
    Location:
    India
    Thanks mister T, i will do it.
     
  8. Wilksey

    Wilksey Member

    Joined:
    Aug 16, 2009
    Messages:
    553
    Likes:
    20
    Location:
    Somerset, UK
    What chipset in your GSM900, a SIM900?
    Some require you send characters such as CTRL+Z, or double "\r\n" to show the message is terminated.

    Read the AT command guide for your module it should give a clear example.
     
  9. Veeramani.T

    Veeramani.T New Member

    Joined:
    Apr 18, 2014
    Messages:
    5
    Likes:
    1
    Location:
    India
    My gsm module is
    GSM900A-R3
    i am trying, but i could not get the output...
    i am using four 0.1uf for max232, is it OK...
    but i am getting the output in hyperterm.....
    any one send me the working code for me....
     
  10. Wilksey

    Wilksey Member

    Joined:
    Aug 16, 2009
    Messages:
    553
    Likes:
    20
    Location:
    Somerset, UK
    hmm,
    Not familiar with the GSM900A, can you post a link or pic of it? I am suspecting a SIM900.

    MAX232 some i've had to use 1uF, think its voltage dependant, also you need to make sure the chip is wired correctly, do you have a schematic?
     
  11. Veeramani.T

    Veeramani.T New Member

    Joined:
    Apr 18, 2014
    Messages:
    5
    Likes:
    1
    Location:
    India
    thanks to jonsea, mister and wilksey for supporting me.
    i got the output after some corrections in my ckt and program as you suggested.
    thanks a lot...
     
    • Like Like x 1
  12. Amanjeet Singh

    Amanjeet Singh New Member

    Joined:
    Aug 14, 2014
    Messages:
    1
    Likes:
    0
    Location:
    Delhi
    it could be the error of baud rate, check baud rate
     
  13. Muruga

    Muruga New Member

    Joined:
    Jun 26, 2015
    Messages:
    1
    Likes:
    0
    hi veeramani sir, i too have an error on interface GSM sim 900 module, sms was not sending..what is the problem,
     
  14. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,166
    Likes:
    910
    Location:
    Rochdale UK
    ONLINE
    veeramani hasn't been seen here since.... I doubt you'll get a reply.... That's the problem when resurrecting older threads ....
     

Share This Page