Pages: [1]   Go Down
Author Topic: control servo with shield GPRS  (Read 893 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
I like the project as the title says can control a servo by sending a sms via gprs shield.
I when I send a sms "on" the front motor rotation is 90 and "off" to resume its original position.
Being new to programming I really mess I do not really capture the AT commands and stuff .. So if any of you have a program similar to the one that I need I'm enormously grateful to him for letting me share
thank you very much
Logged

Switzerland
Offline Offline
Newbie
*
Karma: 0
Posts: 35
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I guess you want the gsm shield to receive the sms and then control a servo, right?

How about that code: GSMExamplesReceiveSMS
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

in fact I have a sim900 and a map arduino uno. I want a program I guess for under arduino to drive a servomotor. eg when I send it activates the motor is off and it stops him ..
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In pseduocode:

setup() {
  Serial.write("AT+CMGF=1"); //Use text mode for sms

}

loop() {
  Serial.write("AT+CMGL=\"ALL\"\r\n"); //Check which AT commands that will send you the first sms in the sms memory. If there is none you will get an error, but that is ok.
  delay(1000); //Wait for modem to send response
  a = Serial.read(); //Read the modem response
  if ( a.find("off") ) //If off is anywhere in modem response,
     servo(0);   //move servo to zero degrees
  if (a.find("90") ) //If 90 is anywhere in response
     servo(90);  /Move servo to zero degrees
  Serial.write("AT+yyyyy\r\n"); //Check which AT commands delete the first sms
  delay(1000); //Wait for modem response
  Serial.read(); //Read and throw away modem response
}

I don't think you need to initialize the modem to send you notifications if there is an incoming sms. Just loop and check if there is an sms that contains the keywords to act upon.
Then delete all sms's as they might fill up the sms-memory in the module.
You are just sending very short messages so I guess the read-buffer can handle this.
You are just sending a single sms not very fast so you can afford the wait between receiving a sms and deleting it. If you send sms to fast, you might delete an sms with a new command. Can be handled but require more checks...

Most SMS-commands are standardized, random google link might be useful http://www.developer.nokia.com/Community/Wiki/Using_AT_commands_to_send_and_read_SMS But you need to verify the AT-commands with your paritcular modems AT-commands.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I read in the forum to communicate that I had to use special commands: https://github.com/mchobby/GoGprs/blob/master/GoGprs.h
I looked at the link you posted on the tutorial but I do not understand how I can use, and whether to communicate with my card I need to download anything other than arduino?
And the end of the program you put how do I use it?
Logged

Pages: [1]   Go Up
Jump to: