loading

Recently, I received a relatively cheap Quad Band GSM/GPRS module to play with. It is a SIM800L module, and communicates with any micro via a serial port. It came complete with a panel mount antenna.

I decided to build a simple SMS Controller system which uses short message service (SMS) commands to control devices and indicate alarms.

Step 1: SMS Commands

AS with any communication system, specific commands need to be send to a remote device to tell it what to do. Likewise, the remote device needs to reply or react on these commands. This project consists of two parts, the SMS Controller, and an standard cellular phone.

The idea was to create a simple SMS Controller with four digital outputs. Depending on the received SMS, the unit must be able to control the individual outputs.

I also decided to include four digital inputs. This can be used to indicate alarms or other information.

Before starting the build, I decided to create specific commands for specific functions. This 'commands' will be sent using an SMS from a cellular phone.

SMS Controller Receive Commands:

o1:1 - turn output 1 On

o1:0 - turn output 1 Off

o1:p - pulse output 1 On, then turn Off

o2:1 - turn output 2 On

o2:0 - turn output 2 Off

o2:p - pulse output 2 On, then turn Off

o3:1 - turn output 3 On

o3:0 - turn output 3 Off

o3:p - pulse output 3 On, then turn Off

o4:1 - turn output 4 On

o4:0 - turn output 4 Off

o4:p - pulse output 4 On, then turn Off

???? - Request status of Inputs and Outputs

#### - Reset system

For feedback, the SMS Controller should respond to the received commands, and reply with an SMS. I decided that this reply SMS should include the status of all I/O pins.

SMS Controller Response Commands:

i1:x i2:x i3:x i4:x o1:x o2:x o3:x o4:x

where x is the I/O status, 1 for On, 0 for Off.

Step 2: Building the SMS Controller

Equipment required:

Any Arduino, or stand-alone ATMEGA328p on a breadboard

SIM800L GSM/GPRS Module with a sim card capable of sending and receiving SMS's

Step down DC/DC converter

NOTE !!!

The DC/DC converter is required to power the SIM800L module. This module operates between 3.7V and 5V, depending on the version you have. This module also requires a power supply that can deliver up to 2A when the module transmit data. It can not be powered directly from the Arduino Uno !!!

The circuit is quite simple. I have assembled and tested it on breadboard.

The power to the circuit is via the DC/DC converter, with the output voltage set to 4.5V. There are four LEDs to simulate the digital outputs, and four buttons for the digital inputs. The SIM800L is connected to the Rx/Tx pins of the ATMEGA328p.

A 5th LED is used to indicate when the system in busy sending an SMS.

Step 3: Programming the ATMEGA328p

Before programming, open the INO file, and edit the phone number. Replace 1234567890 with your own cellular phone number in line 308. Recompile, and upload the file.

Refer to this instructable to program the ATMEGA328p on the breadboard using an Arduino UNO.

https://www.instructables.com/id/Arduino-UNO-as-AtM...

Step 4: Using the SMS Controller

Using the SMS Controller

The SMS Controller will automatically send an SMS to your phone if any of the four inputs are triggered. The details of the trigger will be contained in the SMS text.

The SMS messages and commands can be edited to your needs in the INO file.

Testing the SMS Controller Outputs

From your cellular phone, send the following commands to your SIM800L simcard number:

o1:1, this will turn on output 1.

On your phone, you will receive the following SMS:

i1:0 i2:0 i3:0 i4:0 o1:1 o2:0 03:0 o4:0

01:0, this will turn off output 1.

On your phone, you will receive the following SMS:

i1:0 i2:0 i3:0 i4:0 o1:0 o2:0 03:0 o4:0

01:p, this will turn on output 1 for 1 second, then turn output 1 off again (pulsed).

On your phone, you will receive the following SMS:

i1:0 i2:0 i3:0 i4:0 o1:0 o2:0 03:0 o4:0

Testing the SMS Controller Inputs

On the SMS Controller, press button 1 briefly

On your phone, you will automatically receive the following SMS:

i1:1 i2:0 i3:0 i4:0 o1:0 o2:0 03:0 o4:0

On the SMS Controller, press button 2 briefly

On your phone, you will automatically receive the following SMS:

i1:1 i2:1 i3:0 i4:0 o1:0 o2:0 03:0 o4:0

On the SMS Controller, press button 3 briefly

On your phone, you will automatically receive the following SMS:

i1:1 i2:1i3:1 i4:0 o1:0 o2:0 03:0 o4:0

As can be seen on the received SMS, the outputs changes according to the commands received. However, the inputs does not change back from a 1 to a 0 after the buttons were pressed. Because I wanted to be able to see any changes on the inputs, I decided to seal in the input status until a reset command is send to the SMS Controller.

Reset Alarms

To reset the input status, send the following command:

####, this will reset the input status.

On your phone, you will receive the following SMS:

i1:0 i2:0 i3:0 i4:0 o1:0 o2:0 03:0 o4:0

Status Updates

You can also request the status at any time by sending the following command:

????, this will request a status update of the I/Os.

On your phone, you will receive the following SMS:

i1:x i2:x i3:x i4:x o1:x o2:x 03:x o4:x

where x indicates the status, 1 for on, 0 for off.

Step 5: Android Application

Using MIT App Inventor 2 (http://ai2.appinventor.mit.edu/), I created a simple user interface for my Android cellular phone. This app allows you to customise the description of each I/O. It also allows for entry of the telephone number.

The four buttons are used to control the Outputs, while the check boxes indicate the input status.

To edit the app, create a MIT App Inventor 2 account, and import the AIA file.

To install the app on your phone, copy the APK file to your phone, and install it. You will have to enable the installation of apps from "Unknown Sources" under your phone's security settings.

Hii eric.... <br>Can you code run in sim 808 GPS GPRS GSM BLUETOOTH MODULE ? <br><br>thanks...
<p>Hi</p><p>I am not sure. I only have the SIM800 module.</p><p>The commands used for the interface is standard &quot;AT&quot; commands, which is sent serial to the SIM800 module. As most &quot;AT&quot; commands are standard, I am sure that is should work.</p><p>Regards</p>
<p>can u please tel me how did u create this app?</p>
<p>Hi SelvamS5</p><p>I used software called MIT App Inventor to create the Android App. You can find it here:</p><p><a href="http://ai2.appinventor.mit.edu/">http://ai2.appinventor.mit.edu/</a></p><p>This is an on-line programming tool, and free of charge.</p><p>Hope this will help.</p><p>Regard, Eric.</p>
<p>how to make it reply on your phone on what is the status of the AC appliances that is connected,<br></p><p>for example it will say POWER ON when i texted to turn it on.</p>
<p>great thanks, i try build my own</p>
<p>Good job Eric and thanks for the AIA file.</p><p>I will try to edit it for my own use.</p>
Hi Eric,<br>Can I use this project SIM900 GSM / GPS module?
I think the code will work with the SIM900. The code does not make use of any &quot;special&quot; AT commands, so give it a try.
Thanks Eric.<br>I hope it works.
<p>Hi </p><p>grate project thanks for it. I have some problem with it and have to say I am new in arduino. please anyone can help will be appreciated. and this is my code problem:</p><p>Arduino: 1.7.10 (Windows 7), Board: &quot;Arduino Uno&quot;</p><p>GSM_Remot.ino: In function 'void loop()':</p><p>GSM_Remot.ino:136:8: error: ambiguous overload for<br>'operator=' (operand types are 'String' and 'char')</p><p>GSM_Remot.ino:136:8: note: candidates are:</p><p>In file included from GSM_Remot.ino:1:0:</p><p>C:\Program<br>Files\arduino-1.7.10\hardware\arduino\avr\cores\arduino/WString.h:86:11: note:<br>String&amp; String::operator=(const String&amp;) &lt;near match&gt;</p><p> String &amp;<br>operator = (const String &amp;rhs);</p><p>C:\Program Files\arduino-1.7.10\hardware\arduino\avr\cores\arduino/WString.h:86:11:<br>note: no known conversion for argument<br>1 from 'char' to 'const String&amp;'</p><p>C:\Program<br>Files\arduino-1.7.10\hardware\arduino\avr\cores\arduino/WString.h:87:11: note:<br>String&amp; String::operator=(const char*) &lt;near match&gt;</p><p> String &amp;<br>operator = (const char *cstr);</p><p>C:\Program<br>Files\arduino-1.7.10\hardware\arduino\avr\cores\arduino/WString.h:87:11:<br>note: no known conversion for argument<br>1 from 'char' to 'const char*'</p><p>C:\Program<br>Files\arduino-1.7.10\hardware\arduino\avr\cores\arduino/WString.h:88:11: note:<br>String&amp; String::operator=(const __FlashStringHelper*) &lt;near match&gt;</p><p> String &amp; operator<br>= (const __FlashStringHelper *str);</p><p>C:\Program<br>Files\arduino-1.7.10\hardware\arduino\avr\cores\arduino/WString.h:88:11:<br>note: no known conversion for argument<br>1 from 'char' to 'const __FlashStringHelper*'</p><p>Error compiling.</p><p> This report would<br>have more information with</p><p> &quot;Show verbose<br>output during compilation&quot;</p><p> enabled in File &gt;<br>Preferences.</p>
<p>I noticed that different versions of the IDE reacted differently to this code.</p><p>I have uploaded a newer file GSM_Remote_01.ino. under Step 3. <br>I was able to compile the file on three different versions now. Hope this will assist you.</p>
<p>Ok I disabled this line : //c4 = char(Serial.read()); and now it can be compiled. and I don't know why!!!</p>
<p>hello Eric,</p><p>is it possible to use HC-05 bluetooth module instead of GSM? if it's possible what are the changes on the blocks of ai2?</p>
<p>Anything is possible with an Arduino...<br>Yes, it can be changed to use Bluetooth. But it is not as simple as changing a few lines of code. The Arduino code as well as the Android app will have to be rewritten for Bluetooth.</p>
<p>Nice job. I'm using an old Motorola C261 directly conected to an arduino and work's nice (just need to wake it up some times)</p>
<p>Thank you very much.</p>
<p>HOW CAN WE MAKE TO BE CONTROLLED BY SPECIFIC MOBILE NUMBERS?(FOR SECURITY REASONS).</p>
<p>I am still working on this function. It is about 85% complete.<br>New code will only respond to numbers stored on the SIM card. <br>The new code will also include adding and deleting of user numbers via SMS. </p>
<p>Could this be re-worked for Bluetooth?</p><p>Not all of us have contracts for our phones, and Bluetooth is not network dependent.</p>
<p>It is possible to do this using Bluetooth, but the Arduino code as well as the Android app will need to be changed accordingly.<br>But then it can only be used when the phone is in range of the Bluetooth device. The idea behind this project was to get alarms and control items when I am not at home.</p><p>No special cellphone contracts are used. I am using a &quot;prepaid&quot; SIM card in the GPRS module. </p>
well prepared mate.
<p>Thank you very much</p>
<p>i love it, you know how to use the GPRS commands? send data to a webpage por example?</p>
<p>Thanks. This was my first attempt with the unit. At this stage, I can only do SMS's.</p>

About This Instructable

9,606views

212favorites

License:

More by Eric Brouwer:Arduino Based GSM/SMS Remote Control Unit 7 Segment Up/Down Counter Designing a Dual 40A PWM Speed Controller for Brushed Motors 
Add instructable to: