Control Motor using GSM Shield

Hallo,

I new member in arduino forum

I have aproject controlling motor using handphone(GSM Shield),without display/monitor
but ,difficult make the sketch (if I send sms =1 motor on & sms = 0 motor off).

can you help me?

Are you using an official Arduino GSM shield?

What code have you developed so far?

I used Shield model GSM antena connector(original from arduino).

my sketch :

#include <SoftwareSerial.h>

// EN: String buffer for the GPRS shield message
String msg = String("");
// EN: Set to 1 when the next GPRS shield message will contains the SMS message
int SmsContentFlag = 0;
//control pins of relay.
int relay_a=4;
int relay_b=5;
int relay_c=6;
int relay_d=7;

// EN: Code PIN of the SIM card (if applied)
//String SIM_PIN_CODE = String( "XXXX" );

void setup()
{
Serial.begin(19200); // the GPRS baud rate
// Initialize PINs
pinMode( 4, OUTPUT );
pinMode( 5, OUTPUT );
pinMode( 6, OUTPUT );
pinMode( 7, OUTPUT );
digitalWrite( 4, LOW );
digitalWrite( 5, LOW );
digitalWrite( 6, LOW );
digitalWrite( 7, LOW );
Serial.println( "AT+CMGF=1" );
delay(200);
}

void loop()
{
char SerialInByte;
if(Serial.available())
{
SerialInByte = (unsigned char)Serial.read();
delay(5);

// -------------------------------------------------------------------
// EN: Program also listen to the GPRS shield message.
// -------------------------------------------------------------------
// EN: If the message ends with then process the message
if( SerialInByte == 13 ){
// EN: Store the char into the message buffer
ProcessGprsMsg();
}
if( SerialInByte == 10 ){
// EN: Skip Line feed
}
else {
// EN: store the current character in the message string buffer
msg += String(SerialInByte);
}
}
}
// EN: Make action based on the content of the SMS.
// Notice than SMS content is the result of the processing of several GPRS shield messages.
void ProcessSms( String sms ){

if( sms.indexOf("ona") >= 0 ){
digitalWrite( relay_a, HIGH );
}
if( sms.indexOf("onb") >= 0 ){
digitalWrite( relay_b, HIGH );
}
if( sms.indexOf("onc") >= 0 ){
digitalWrite( relay_c, HIGH );
}
if( sms.indexOf("ond") >= 0 ){
digitalWrite( relay_d, HIGH );
}
if( sms.indexOf("offa") >= 0 ){
digitalWrite( relay_a, LOW );
}
if( sms.indexOf("offb") >= 0 ){
digitalWrite( relay_b, LOW );
}
if( sms.indexOf("offc") >= 0 ){
digitalWrite( relay_c, LOW );
}
if( sms.indexOf("offd") >= 0 ){
digitalWrite( relay_d, LOW );
}
}

Please use code tags, it makes it easier to read.

So, what actually happens when you send an SMS? Have you tried putting any debug statements in to see what is happening?

Here's a link to a similar project: http://www.dfrobot.com/forum/index.php?topic=924.0.

from sketch( indexof ) not indentify by arduino GSM software.

and now, I using GSM Library sketch(editing).

If you can't post all of your error messages then we can't help you.

im now doing for my project on"arduino pump motor on with ultrasonic and gsm"

the ultrasonic sensor sensing the water level,if the water level decrease the information passing via sms through gsm

then the person receive the sms and give missed call or replay the motor get started

then the tank level is fill the motor stop automatically....

i need for coding..
any one help me