Go Down

Topic: I want to send data from my website to SIM900 (Read 1 time) previous topic - next topic

Far27

Hello Everyone,

I am quite new with working with electronics generally and I gave it my first short with Arduino Uno R3 and a SIM900 GPRS/GSM Shield.

I have been able to send and receive sms and make phone calls. I know a little about web design so I have been able to send HTTP request to a web server, and most of the resources I used was from this forum. Thank you so much guys for the repository of knowledge you have ongoing here.

I want to be able to send data to the GSM shield through the website to make a phone call. Presently I am using the Arduino's and SIM900 Shields to send Information to the website.

I have searched online for information but I have not gotten anything reasonable. I want to have 4 Arduino Uno and SIM900 shields interact with the website and receive data from the website. Which method or device do you think is feasible for a job like this and  what are the required steps.

Please I need your assistance.

Thanks for your concern.

Far27


This is the primary task I have set for this my little project and this is how far I have gone..
I want a standalone processor that can do the following:
1. Receive SMS ----------    SOLVED
2. Read the SMS as in get, sender number, message content and timestamp -----UNRESOLVED
3a. Send the SMS to a database on my website --------------    SOLVED
3b. Delete SMS from the SIM card -------------- UNRESOLVED
4. Use the SMS for operation on my website ------------------ SOLVED
5. Send data to Arduino/SIM900 to make a phone call based on the operation in 4 above. -------------UNRESOLVED


The ones marked SOLVED has been completely resolved, but the ones not completely resolved is remarked UNRESOLVED. This is what I am trying to achieve and I need it to be automated. I will like to know if I am using the right approach and device. Your assistance will be highly appreciated.

Thank you for your time and concern.

Far27

I have been able to receive SMS using the following code

Code: [Select]

#include <SoftwareSerial.h>
SoftwareSerial GSM(2, 3); // RX, TX

String d;
int i=0;
void setup()
{
  Serial.begin(19200);
  GSM.begin(2400);
  GSM.println("AT \r");
  delay(500);                 
 GSM.println("AT+CMGF=1 \r");   
  delay(1000);
  GSM.println("AT+CNMI=1,2,0,0 \r");
  delay(2000);
 
}

void loop()
{
  while ( !GSM.available() );
    d = GSM.readString();
    Serial.println(d);
    delay(2000);
   
           
}




AT

OK

AT+CMGF=1

OK

AT+CNMI=1,2,0,0
OK

+CMT: "+23470357XXXXX","","2017/10/10","10:12:40+23"
Hello Message to SIM900


Please i will like to store the sender number, timestamp and message into variables.
Any clue on how to do this will be highly appreciated.
Thanks.

dannable

You need to parse the incoming data. There are several tutorials around showing you how to acomplish this.
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

Far27

I have been able to find a parse and I got help from Nikhil Joji.

Code: [Select]

#include <SoftwareSerial.h>
SoftwareSerial GSM(2, 3); // RX, TX

String d;
int i=0;
void setup()
{
  Serial.begin(19200);
  GSM.begin(19200);
  GSM.println("AT \r");
  delay(500);                 
 GSM.println("AT+CMGF=1 \r");   
  delay(1000);
  GSM.println("AT+CNMI=1,2,0,0 \r");
  delay(2000);
 
}
void loop()
{
  while ( !GSM.available() );
    d = GSM.readString();
    Serial.println(d);
    delay(2000);
    int indexOne = d.indexOf('"');       //position of "
    Serial.print("IndexOne is ");     //printing the position number
    Serial.println(indexOne);
   
    String sender_number = d.substring(indexOne,indexOne+16);
    Serial.println("Sender number is ");    //Printing
    Serial.println(sender_number);

    //int indexTwo = d.substring('","","');
    String send_date = d.substring(indexOne+21,indexOne+41);
    Serial.println("Send date is ");    //Printing
    Serial.println(send_date);

   // int indexThree = d.indexOf('\n');
    String msg = d.substring(indexOne+41,indexOne+250);
    Serial.println("Message is ");    //Printing
    Serial.println(msg);
   
         
}


}
   





The out put is

AT


OK
AT+CMGF=1


OK
AT+CNMI=1,2,0,0


OK

IndexOne is -1
Sender number is
CMGF=1


OK
AT+CNMI=1,2,0,0


OK

Send date is
1


OK
AT+CNMI=1
Message is
,2,0,0


OK


+CMT: "+234703XXXXXXX","","17/10/15,20:52:32+04"
No wahala bro,i got ya..we neva even stat so i'm tryng to revise ahead of d time. Stil on ctrl bro!

IndexOne is 8
Sender number is
"+234703XXXXXXX"
Send date is
17/10/15,20:52:32+04
Message is
"
No wahala bro,i got ya..we neva even stat so i'm tryng to revise ahead of d time. Stil on ctrl bro!



I have been able to break it down into variables but I am having problem paring the variables to to a database using HTTP GET request.

I have tried using
Code: [Select]
sendGSM("AT+HTTPPARA=\"URL\",\"kiopay.net/webservice/data.php?network_id=5&senderNo=234703XXXXXXX&recMsg=Hello+World&timeArrived=201710112134\"");
It works my data is passed to the database but I want to use the variables which I have gotten from the sms. when I used the variable  names I get the identifier instead of the value.

Please your help will be highly appreciated..
Thannks .

Go Up