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

roberto64

Active Member
Licensed User
Longtime 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
 

falbertini

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

Erel

B4X founder
Staff member
Licensed User
Longtime User

Shay

Well-Known Member
Licensed User
Longtime User
I got the A6 module,
I have this code:
B4X:
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
 

Shay

Well-Known Member
Licensed User
Longtime 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"
 

Shay

Well-Known Member
Licensed User
Longtime 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?)
 
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

B4X:
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
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…