controlling the motor through sms with GPS/GPRS/GSM V3 Arduino UNO

please help make a listing for controlling the motor through sms with GPS / GPRS / GSM V3
please listings receive sms, read, and approved the process sms and delete sms :(
please listings receive sms, read, and approved the process sms and delete sms :(
2013-11-04 15:40:24 sorry grey longtime not login to forum becuz i'm very busy...
yes grey...motor Controlling but without PWM...
thx for reply...i will try it... :)
karaeng_android
yes grey...motor Controlling but without PWM...
thx for reply...i will try it... :)

2013-11-01 13:21:28 Hello karaeng_android
Have you still working on this issue?
I write a sketch about how to control arduino by GSM module.
when I input the message by myself via serial port, it works fine, but l plug the module on the arduino
it won't work.And what I input is what module outputs. It has been bothering me for a long time.
[code]#include <Wire.h>
#include <Arduino.h>
#define S_IDLE 0
#define S_ATOK 1
#define S_GETMESSAGE 2
#define S_READMESSAGE 3
#define M_ATOK "OK"
#define M_GETMESSAGE "+CMTI"
#define M_READMESSAGE "+CMGR"
#define M_CALLREADY "Call Ready"
#define M_FLAG "DF" //DF the the flag to position the Command in the data recevied by Serial port.you also can change it using other flag.
char messageCMD[2]=""; //using to hold Command,for example,if the value is H8,stands the pin 8 will output a high level.
String comdata = "";
int gsmDriverPin[3] = {10,11,12};
int messageControlPin[7]={3,4,5,6,7,8,9};
void setup(){
Serial.begin(9600); // The rate should not too high.It's ralated with the delay time of reading data from the Serial port.
for(int i = 0 ; i < 3; i++)
{
pinMode(gsmDriverPin[i],OUTPUT);
}
digitalWrite(12,HIGH);
delay(1500);
digitalWrite(12,LOW);
digitalWrite(10,LOW); //Enable the GSM mode
digitalWrite(11,HIGH); //Disable the GPS mode
delay(5000);//need test
delay(5000);//need test
delay(5000);//need test
Serial.print("AT");
//Serial.write(0x0D);
Serial.print("ATE0"); // echo off
// Serial.write(0x0D);
delay(20);
Serial.print("AT+CMGF=1"); //Set the format of message to Text Mode
// Serial.write(0x0D);
delay(20);
Serial.print("AT+CNMI=2,1,0,0,0"); //Set new SMS message indications
// Serial.write(0x0D);
delay(20);
delay(100);
for(int i=0;i<7;i++)
{
pinMode(messageControlPin[i],OUTPUT);//Initial the controlled pin
}
}
void loop(){
String event_message="";
int at_event=0;
while(1)
{
event_message=SerialDataRead(event_message);
event_message=SerialMessageCheck(event_message,&at_event);
MessageCommand(&at_event,messageCMD);
}
}
//---------------------------Read data------------------------------------//
String SerialDataRead(String MessageData){
while(Serial.available()>0) //serial data read
{
char CharRead=Serial.read();
if(CharRead!=10&&CharRead!=13)
{
MessageData=MessageData+CharRead;
}
delay(5);
}
return MessageData;
}
//-----------------------------Check data---------------------------------------//
String SerialMessageCheck(String Message,int *Event){
if(Message.indexOf(M_ATOK)!=-1) //check AT OK
{
Message="";
*Event=S_IDLE;
}
else if(Message.indexOf(M_CALLREADY)!=-1) //check CALL READY
{
Message="";
*Event=S_ATOK;
}
else if(Message.indexOf(M_GETMESSAGE)!=-1)
{
Message="";
*Event=S_GETMESSAGE;
delay(20);
}
else ;
return Message;
}
//----------------------The most important part!----------------------------//
void MessageCommand(int *Event,char *messageCMD) {
if(*Event==S_GETMESSAGE) // when get new SMS,execute follows
{
Serial.print("AT+CMGR=1"); //Attention,we will read the message from zone No.1
// Serial.write(0x0D);
delay(20);
while(Serial.available()<1);
while(Serial.available()>0) //Read out the data that has just been print,AT+CMGR=1.
{
char CharRead=Serial.read();
delay(5);
}
comdata="";
while(Serial.available()<1); //waiting data.......
while(Serial.available())
{
char CharRead=char(Serial.read());
if(CharRead!=10&&CharRead!=13)
{
comdata +=CharRead;
}
delay(2);
}
int messageIndex1=comdata.lastIndexOf(M_FLAG);
if( messageIndex1!=-1)
{
for(int i=0;i<2;i++)
{
messageCMD[i]=comdata[messageIndex1+2+i];
}
comdata="";
}
*Event=S_READMESSAGE;
if(*Event==S_READMESSAGE)
{
if(messageCMD[0]=='H'||messageCMD[0]=='h')
{
digitalWrite(int(messageCMD[1]-'0'),HIGH);
}
if(messageCMD[0]=='L'||messageCMD[0]=='l')
{
digitalWrite(int(messageCMD[1]-'0'),LOW);
}
}
Serial.print("AT+CMGD=1"); //deleted the Received SMS message in Card.
// Serial.write(0x0D);
delay(20);
*Event=0;
}
}
[/code]
Grey.CC
Have you still working on this issue?
I write a sketch about how to control arduino by GSM module.
when I input the message by myself via serial port, it works fine, but l plug the module on the arduino
it won't work.And what I input is what module outputs. It has been bothering me for a long time.
[code]#include <Wire.h>
#include <Arduino.h>
#define S_IDLE 0
#define S_ATOK 1
#define S_GETMESSAGE 2
#define S_READMESSAGE 3
#define M_ATOK "OK"
#define M_GETMESSAGE "+CMTI"
#define M_READMESSAGE "+CMGR"
#define M_CALLREADY "Call Ready"
#define M_FLAG "DF" //DF the the flag to position the Command in the data recevied by Serial port.you also can change it using other flag.
char messageCMD[2]=""; //using to hold Command,for example,if the value is H8,stands the pin 8 will output a high level.
String comdata = "";
int gsmDriverPin[3] = {10,11,12};
int messageControlPin[7]={3,4,5,6,7,8,9};
void setup(){
Serial.begin(9600); // The rate should not too high.It's ralated with the delay time of reading data from the Serial port.
for(int i = 0 ; i < 3; i++)
{
pinMode(gsmDriverPin[i],OUTPUT);
}
digitalWrite(12,HIGH);
delay(1500);
digitalWrite(12,LOW);
digitalWrite(10,LOW); //Enable the GSM mode
digitalWrite(11,HIGH); //Disable the GPS mode
delay(5000);//need test
delay(5000);//need test
delay(5000);//need test
Serial.print("AT");
//Serial.write(0x0D);
Serial.print("ATE0"); // echo off
// Serial.write(0x0D);
delay(20);
Serial.print("AT+CMGF=1"); //Set the format of message to Text Mode
// Serial.write(0x0D);
delay(20);
Serial.print("AT+CNMI=2,1,0,0,0"); //Set new SMS message indications
// Serial.write(0x0D);
delay(20);
delay(100);
for(int i=0;i<7;i++)
{
pinMode(messageControlPin[i],OUTPUT);//Initial the controlled pin
}
}
void loop(){
String event_message="";
int at_event=0;
while(1)
{
event_message=SerialDataRead(event_message);
event_message=SerialMessageCheck(event_message,&at_event);
MessageCommand(&at_event,messageCMD);
}
}
//---------------------------Read data------------------------------------//
String SerialDataRead(String MessageData){
while(Serial.available()>0) //serial data read
{
char CharRead=Serial.read();
if(CharRead!=10&&CharRead!=13)
{
MessageData=MessageData+CharRead;
}
delay(5);
}
return MessageData;
}
//-----------------------------Check data---------------------------------------//
String SerialMessageCheck(String Message,int *Event){
if(Message.indexOf(M_ATOK)!=-1) //check AT OK
{
Message="";
*Event=S_IDLE;
}
else if(Message.indexOf(M_CALLREADY)!=-1) //check CALL READY
{
Message="";
*Event=S_ATOK;
}
else if(Message.indexOf(M_GETMESSAGE)!=-1)
{
Message="";
*Event=S_GETMESSAGE;
delay(20);
}
else ;
return Message;
}
//----------------------The most important part!----------------------------//
void MessageCommand(int *Event,char *messageCMD) {
if(*Event==S_GETMESSAGE) // when get new SMS,execute follows
{
Serial.print("AT+CMGR=1"); //Attention,we will read the message from zone No.1
// Serial.write(0x0D);
delay(20);
while(Serial.available()<1);
while(Serial.available()>0) //Read out the data that has just been print,AT+CMGR=1.
{
char CharRead=Serial.read();
delay(5);
}
comdata="";
while(Serial.available()<1); //waiting data.......
while(Serial.available())
{
char CharRead=char(Serial.read());
if(CharRead!=10&&CharRead!=13)
{
comdata +=CharRead;
}
delay(2);
}
int messageIndex1=comdata.lastIndexOf(M_FLAG);
if( messageIndex1!=-1)
{
for(int i=0;i<2;i++)
{
messageCMD[i]=comdata[messageIndex1+2+i];
}
comdata="";
}
*Event=S_READMESSAGE;
if(*Event==S_READMESSAGE)
{
if(messageCMD[0]=='H'||messageCMD[0]=='h')
{
digitalWrite(int(messageCMD[1]-'0'),HIGH);
}
if(messageCMD[0]=='L'||messageCMD[0]=='l')
{
digitalWrite(int(messageCMD[1]-'0'),LOW);
}
}
Serial.print("AT+CMGD=1"); //deleted the Received SMS message in Card.
// Serial.write(0x0D);
delay(20);
*Event=0;
}
}
[/code]

2013-10-23 16:24:28 Hello, karaeng_android
What do you want to do?
Just control the motor? PWM motor control?
And you just want to control it by your phone message,right?
Grey.CC
What do you want to do?
Just control the motor? PWM motor control?
And you just want to control it by your phone message,right?
