Forum >Control your Arduino by SMS via GPS/GPRS/GSM Module V3.0
Control your Arduino by SMS via GPS/GPRS/GSM Module V3.0

Hello everyone,
I saw some guys want to make an arduino remote control via GPS/GPRS/GSM Module V3.0.
And I am interesting in this topic, too. So I spend a little time on this module, and write a simple code to realize this function.
When you send the SMS "LH" to the module, it WILL turn led on; when you send the SMS "LL", it will be turned off.
If you want to watch the status, use the SoftwareSerial or the board with another serial port plese.
Here is the SoftwareSerial port:
I saw some guys want to make an arduino remote control via GPS/GPRS/GSM Module V3.0.
And I am interesting in this topic, too. So I spend a little time on this module, and write a simple code to realize this function.
When you send the SMS "LH" to the module, it WILL turn led on; when you send the SMS "LL", it will be turned off.
Code: Select all
This code use the serial port, it can't be watched the module status via the serial monitor.// Product name: GPS/GPRS/GSM Module V3.0 // # Product SKU : TEL0051 // # Description: // # The sketch for controling the GSM/GPRS/GPS module via SMS. // # Steps: // # 1. Turn the S1 switch to the Prog(right side) // # 2. Turn the S2 switch to the USB side(left side) // # 3. Plug the GSM/GPS jumper caps to the GSM side // # 4. Upload the sketch to the Arduino board(Make sure turn off other Serial monitor ) // # 5. Turn the S1 switch to the comm(left side) // # 6. Turn the S2 switch to the Arduino(right side) // # 7. RST the board until the START led is on(make sure you have >6V power supply) // # 8. Plug the long side of LED into pin 8 and short side into GND // # 9. Start sending "LH" and "LL" to your board to turn LED on and off. /* * created: 2013-11-14 * by: Grey * Version: 0.3 * Attention: if you send the wrong SMS command to the module, just need to press RST. * This version can't watch the module status via the serial monitor, it only display the Arduino command. * If you want to watch the status,use the SoftwareSerial or the board with another serial port plese. */ byte gsmDriverPin[3] = { 3,4,5};//The default digital driver pins for the GSM and GPS mode //If you want to change the digital driver pins //or you have a conflict with D3~D5 on Arduino board, //you can remove the J10~J12 jumpers to reconnect other driver pins for the module! int ledpin = 8; char inchar; void setup() { //Init the driver pins for GSM function for(int i = 0 ; i < 3; i++){ pinMode(gsmDriverPin[i],OUTPUT); } pinMode(ledpin,OUTPUT); Serial.begin(9600); //set the baud rate digitalWrite(5,HIGH); //Output GSM Timing delay(1500); digitalWrite(5,LOW); digitalWrite(3,LOW); //Enable the GSM mode digitalWrite(4,HIGH); //Disable the GPS mode delay(2000); delay(5000); //call ready delay(5000); Serial.println("AT+CMGD=1,4"); //Delete all SMS in box } void loop() { if(Serial.available()>0) { inchar=Serial.read(); if(inchar=='T') { delay(10); inchar=Serial.read(); if (inchar=='I') //When the GSM module get the message, it will display the sign '+CMTI "SM", 1' in the serial port { delay(10); Serial.println("AT+CMGR=1"); //When Arduino read the sign, send the "read" AT command to the module delay(10); } } else if (inchar=='L') { delay(10); inchar=Serial.read(); if (inchar=='H') //Thw SMS("LH") was display in the Serial port, and Arduino has recognize it. { delay(10); digitalWrite(ledpin,HIGH); //Turn on led delay(50); Serial.println("AT+CMGD=1,4"); //Delete all message delay(500); } if (inchar=='L') //Thw SMS("LH") was display in the Serial port, and Arduino has recognize it. { delay(10); digitalWrite(ledpin,LOW); //Turn off led delay(50); Serial.println("AT+CMGD=1,4"); //Delete all message delay(500); } } } }
If you want to watch the status, use the SoftwareSerial or the board with another serial port plese.
Here is the SoftwareSerial port:
Code: Select all
// Product name: GPS/GPRS/GSM Module V3.0 // # Product SKU : TEL0051 // # Description: // # The sketch for controling the GSM/GPRS/GPS module via SMS. // # Steps: // # 1. Curved the pin 0 and 1. Make sure when you plug the module to UNO, they won't connect to the RX and TX. // # 2. At the same time , connect P0 to P10, and P1 to P11 by jumper cable. // # 3. Upload the sketch to the Arduino board(Make sure turn off other Serial monitor ) // # 4. Turn the S1 switch to the comm(left side) // # 6. Turn the S2 switch to the Arduino(right side) // # 7. RST the board until the START led is on(make sure you have >6V power supply) // # 8. Plug the long side of LED into pin 8 and short side into GND // # 9. Start sending "LH" and "LL" to your board to turn LED on and off. /* * created: 2013-11-14 * by: Grey * Version: 0.3 * Attention: if you send the wrong SMS command to the module, just need to press RST. * This version use the SoftwareSerial port. You can check the status of the module in the serial port for debuging */ #include <SoftwareSerial.h> SoftwareSerial mySerial(10, 11); // Define SoftwareSerial pin RX, TX int gsmDriverPin[3] = { 3,4,5}; //The default digital driver pins for the GSM and GPS mode //If you want to change the digital driver pins //or you have a conflict with D3~D5 on Arduino board, //you can remove the J10~J12 jumpers to reconnect other driver pins for the module! int ledpin = 8; char inchar; void InitGsm() { for(int i = 0 ; i < 3; i++) { pinMode(gsmDriverPin[i],OUTPUT); } pinMode(ledpin,OUTPUT); digitalWrite(5,HIGH); //Output GSM Timing delay(1500); digitalWrite(5,LOW); digitalWrite(3,LOW); //Enable the GSM mode digitalWrite(4,HIGH); //Disable the GPS mode delay(5000); //call ready delay(5000); mySerial.println("AT+CMGD=1,4"); //Delete all SMS in box } void setup() { Serial.begin(9600); //set Serial port baud rate mySerial.begin(9600); //set SoftwareSerial port baud rate InitGsm(); //initialize GSM module } void loop() { if(mySerial.available()>0) { inchar=mySerial.read(); Serial.print(inchar); //Display the GPS/GPRS/GSM Module status if(inchar=='T') { delay(10); inchar=mySerial.read(); if (inchar=='I') //When the GSM module get the message, it will display the sign '+CMTI "SM", 1' in the SoftwareSerial port { delay(10); mySerial.println("AT+CMGR=1"); //When Arduino read the sign, send the "read" AT command to the module delay(10); } } else if (inchar=='L') { delay(10); inchar=mySerial.read(); if (inchar=='H') //Thw SMS("LH") was display in the SoftwareSerial port, and Arduino has recognize it. { delay(10); digitalWrite(ledpin,HIGH); //Turn on led delay(50); mySerial.println("AT+CMGD=1,4"); //Delete all message delay(500); } if (inchar=='L') //Thw SMS("LH") was display in the SoftwareSerial port, and Arduino has recognize it. { delay(10); digitalWrite(ledpin,LOW); //Turn off led delay(50); mySerial.println("AT+CMGD=1,4");//Delete all message delay(500); } } } }
2013-11-20 19:42:07 Hello ef,
I check the SoftwareSerial port. It seems that the delete command sometimes does not work when it turn on /off the led. I guess that it need a little time to response. After I added a delay time, my module work fine.I have modified the sketch, maybe you can have a try.
Grey.CC
I check the SoftwareSerial port. It seems that the delete command sometimes does not work when it turn on /off the led. I guess that it need a little time to response. After I added a delay time, my module work fine.I have modified the sketch, maybe you can have a try.

2013-11-20 19:42:07 Hello ef,
I check the SoftwareSerial port. It seems that the delete command sometimes does not work when it turn on /off the led. I guess that it need a little time to response. After I added a delay time, my module work fine.I have modified the sketch, maybe you can have a try.
Grey.CC
I check the SoftwareSerial port. It seems that the delete command sometimes does not work when it turn on /off the led. I guess that it need a little time to response. After I added a delay time, my module work fine.I have modified the sketch, maybe you can have a try.

2013-11-20 19:42:07 Hello ef,
I check the SoftwareSerial port. It seems that the delete command sometimes does not work when it turn on /off the led. I guess that it need a little time to response. After I added a delay time, my module work fine.I have modified the sketch, maybe you can have a try.
Grey.CC
I check the SoftwareSerial port. It seems that the delete command sometimes does not work when it turn on /off the led. I guess that it need a little time to response. After I added a delay time, my module work fine.I have modified the sketch, maybe you can have a try.

2013-11-20 19:42:07 Hello ef,
I check the SoftwareSerial port. It seems that the delete command sometimes does not work when it turn on /off the led. I guess that it need a little time to response. After I added a delay time, my module work fine.I have modified the sketch, maybe you can have a try.
Grey.CC
I check the SoftwareSerial port. It seems that the delete command sometimes does not work when it turn on /off the led. I guess that it need a little time to response. After I added a delay time, my module work fine.I have modified the sketch, maybe you can have a try.

2013-11-20 19:42:07 Hello ef,
I check the SoftwareSerial port. It seems that the delete command sometimes does not work when it turn on /off the led. I guess that it need a little time to response. After I added a delay time, my module work fine.I have modified the sketch, maybe you can have a try.
Grey.CC
I check the SoftwareSerial port. It seems that the delete command sometimes does not work when it turn on /off the led. I guess that it need a little time to response. After I added a delay time, my module work fine.I have modified the sketch, maybe you can have a try.

2013-11-20 19:42:07 Hello ef,
I check the SoftwareSerial port. It seems that the delete command sometimes does not work when it turn on /off the led. I guess that it need a little time to response. After I added a delay time, my module work fine.I have modified the sketch, maybe you can have a try.
Grey.CC
I check the SoftwareSerial port. It seems that the delete command sometimes does not work when it turn on /off the led. I guess that it need a little time to response. After I added a delay time, my module work fine.I have modified the sketch, maybe you can have a try.

2013-11-20 19:42:07 Hello ef,
I check the SoftwareSerial port. It seems that the delete command sometimes does not work when it turn on /off the led. I guess that it need a little time to response. After I added a delay time, my module work fine.I have modified the sketch, maybe you can have a try.
Grey.CC
I check the SoftwareSerial port. It seems that the delete command sometimes does not work when it turn on /off the led. I guess that it need a little time to response. After I added a delay time, my module work fine.I have modified the sketch, maybe you can have a try.

2013-11-20 19:42:07 Hello ef,
I check the SoftwareSerial port. It seems that the delete command sometimes does not work when it turn on /off the led. I guess that it need a little time to response. After I added a delay time, my module work fine.I have modified the sketch, maybe you can have a try.
Grey.CC
I check the SoftwareSerial port. It seems that the delete command sometimes does not work when it turn on /off the led. I guess that it need a little time to response. After I added a delay time, my module work fine.I have modified the sketch, maybe you can have a try.

2013-11-20 19:42:07 Hello ef,
I check the SoftwareSerial port. It seems that the delete command sometimes does not work when it turn on /off the led. I guess that it need a little time to response. After I added a delay time, my module work fine.I have modified the sketch, maybe you can have a try.
Grey.CC
I check the SoftwareSerial port. It seems that the delete command sometimes does not work when it turn on /off the led. I guess that it need a little time to response. After I added a delay time, my module work fine.I have modified the sketch, maybe you can have a try.

2013-11-20 01:36:00 Hello Grey,
thank you for your fast answer. I did everything according to instructions, but nothing helps. I made a short video that shows the problems. Here is the address: https://drive.google.com/file/d/0B9jGYS ... sp=sharing
ef
thank you for your fast answer. I did everything according to instructions, but nothing helps. I made a short video that shows the problems. Here is the address: https://drive.google.com/file/d/0B9jGYS ... sp=sharing

2013-11-20 01:36:00 Hello Grey,
thank you for your fast answer. I did everything according to instructions, but nothing helps. I made a short video that shows the problems. Here is the address: https://drive.google.com/file/d/0B9jGYS ... sp=sharing
ef
thank you for your fast answer. I did everything according to instructions, but nothing helps. I made a short video that shows the problems. Here is the address: https://drive.google.com/file/d/0B9jGYS ... sp=sharing
