B4R Tutorial GSM / GPRS - Control the Arduino with SMS messages

Discussion in 'B4R Tutorials' started by Erel, May 11, 2016.

  1. Tayfur

    Tayfur Well-Known Member Licensed User

  2. roberto64

    roberto64 Active Member Licensed User

    Hi Erel,
    How can I convert the GSM module so that I can carry it to B4J, I'm experimenting with an example with B4J to connect with my smartphone and send and receive messages directly from B4J.
    Greetings
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Is this an Android device?
     
  4. roberto64

    roberto64 Active Member Licensed User

  5. Erel

    Erel Administrator Staff Member Licensed User

    It is completely different in Android. Please start a new thread in B4A forum.
     
  6. falbertini

    falbertini Member Licensed User

    Hello Erel, could you post wire schema of GPRS Shield to Arduino for the project as in your initial image ? Thanks.
     
  7. Erel

    Erel Administrator Staff Member Licensed User

  8. Shay

    Shay Well-Known Member Licensed User

    I got the A6 module,
    I have this code:
    Code:
    Sub MessageArrived(msg() As Byte)
        
    Log ("Got SMS", msg)
    End Sub
    when I am getting SMS, I see only gibrish in the logs
    I tried changing both Serial baudrate, and GSM serial baud rate
    still cannot see any text.
    beside appstart, all is gibrish from A6
     
  9. Shay

    Shay Well-Known Member Licensed User

    update: I switch between rx and tx pin, now I can see text (weird since it is connected ok),
    but I am getting this:
    ****************
    +CIEV: "MESSAGE",1
    +CMT: ,29
    07917952939899F9040C91795224229BFD06DDDF723619

    and I am sending to the a6: "Hello World"
     
  10. Erel

    Erel Administrator Staff Member Licensed User

  11. Shay

    Shay Well-Known Member Licensed User

    How do I put responses to variable so be used?
     
  12. Erel

    Erel Administrator Staff Member Licensed User

    Not sure that I understand the question. However as you are using a different module then it is better to post it in a new thread.
     
  13. Shay

    Shay Well-Known Member Licensed User

    Not related to my board, this is general question,
    if for example I am getting SMS, how do I manipulate the text, since all is in byte()
    meaning putting into var (do I need to use bc.copy?)
     
  14. Erel

    Erel Administrator Staff Member Licensed User

    You should always start a new thread for your questions.
     
  15. MaurizioRoma

    MaurizioRoma Member

    Hi everybody, I recently purchased a GSM/GPRS shield identical to the one used in the example posted by Erel and uploaded the GSM_Example code. Unfortunately it doesn't work. More specifically, I noticed that in GSM Module, the "busy" variable remains setted to TRUE after the Sub SendCommand is executed, therefore I cannot send any SMS.

    I also forced the execution of the sub by commenting the line

    Code:
    If busy Then Return False
    but, anyway, it doesn't send any SMS.

    I tried uploading the source code via the .ino sketch attached and it works properly.

    #include <SoftwareSerial.h>

    SoftwareSerial SIM900(7, 8);

    void setup() {
    Serial.begin(115200);
    SIM900.begin(19200);

    Serial.println("AppStart");
    delay(20000);
    sendSMS();
    }

    void loop() {

    }

    void sendSMS() {

    SIM900.print("AT+CMGF=1\r");
    delay(100);
    SIM900.println("AT + CMGS = \"+xxxxxxxxx\"");
    delay(100);
    SIM900.println("Hello, how doin'?!!");
    delay(100);
    SIM900.println((char)26);
    delay(100);
    SIM900.println();
    delay(5000);
    }

    I also tried to substitute the original code in the Sub EnableSMSEvents with the "AT+CMGF=1" command, and to add the slashes (\) to the phone number, but I failed.
    Has anyone an idea of what I've done wrong?

    Thanks in advance

    Maurizio
     
  16. Erel

    Erel Administrator Staff Member Licensed User

    Please start a new thread for this.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice