Introduction: Arduino GSM SMS Forwarder
Having two phones can be a pain! Forwarding calls from on phone to the other is usually a simple process where you instruct your carrier to forward all incoming calls. Text messages on the other hand are always delivered to the original recipient since there is now convenient way to forward these on the carrier side.
This is a small project to build a SMS forwarder which allows me to keep my private number and forward all incoming text messages to my work phone. There are Android apps out there that solve this exact problem but since I did not have a spare android phone to act as a repeater/forwarder I took my Arduino Uno and the GSM-shield I had lying around to make this project. The GSM shield draws more power than the computer can feed through the USB cable so a separate 9v power supply is needed, found on eBay as well. The external power supply lets you keep the Arduino running without the computer which is really convenient for this project.
Step 1: What You Need
I use a Ardunio Uno and the associate Arduino IDE software which provides drivers for windows and a simple editing/programming software. The Arduino is programmed in C and comes with an extensive suite of standard libraries.
Attached to the Ardunio is a SIM900 GSM Shield which can be bought off eBay for a few bucks. This particular one is from TinySine. This shield only uses 3 pins on the Arduino for communication which frees up a lot of pins to add extras. I also have a spare 16x2 LCD display which I will try to integrate on-top of the GSM shield later on.
This GMS shield was delivered with a library which works fine and includes some basic functions.
Step 2: Get the GSM Shield Up and Running
First of all we want to make sure that the GSM shield registers on the network correctly. To do that I put in my sim-card on the bottom side of the shield and stacked the GSM shield on-top of the Arduino.
Add the GSM_GPRS_GPS_IDE... library to your Arduino C:\Program Files (x86)\Arduino\libraries\ folder. After restarting the Arduino IDE program will make a few new code examples show up under File->Examples.
I use the SMS example to test the connection of the GSM shield. This just outputs each new incoming SMS on the serial monitor.
Step 3: Write Some Code
I am no programming wizard but I have put together some bits and pieces to make this work. The objectives I want to achieve is: Initialize the GSM shield -> Tell me somehow that it is up and running -> Be able to receive commands through SMS, including a 'Kill Switch' to stop the loop if the forwarding goes berserk and start sending me tons of messages -> Forward all incoming texts to a predefined number.
My small piece of code is attached here. There are probably a ton of improvements to be made to this, please comment with suggestions!
This allows me to send three commands to the Arduino, HELP which just lists the commands, CLRALL which will empty the sim-card of text-messages and STOP which will put the program in an endless loop to prevent it from sending new messages.
Step 4: Test It Out!
And it is up and running!
Apart from not handling special characters and emoji very well, it at least give me a notification that someone is trying to reach me on my other number. And I have a great starting point for future remote control projects through SMS.
*Enable the commands only from the target number to prevent other people from sending commands to the Arduino
*Integrate the LCD display and show a log of the activity on the Arduino.
Let me know what you think about this small project in the comments and feel free to suggest improvements. Thank you!
We have a be nice policy.
Please be positive and constructive.