The Raspiduino Project

Articles, guides & links to the Raspberry Pi & Arduino.

Send SMS Messages From Your RPi

Using a sim dongle with an accepted SIM card, plug it in, then install some software on the R-Pi, enter a one line command and your SMS is on it’s way! Sounds simple? It sure is, I’ll show you how I did it!

If you have a different sim for the dongle ie. the dongle is a “3 mobile” and your sim is a spare O2 make, then you may have to unlock the dongle. If all is compatible, then jump to step 2 – install software.

Step 1 – Unlock dongle for cross SIM usage.

  1. Visit www.dc-unlocker.com and download and run software.
  2. Insert dongle and it should pick it up.
  3. If dongle is locked, you will need to purchase enough credits pending on your dongle make & model. To find out how many credits you require, click here:
    https://www.dc-unlocker.com/buy/user_prices
  4. Register on the site, then click the “Buy Credits” button. Purchase the required amount of credits.
  5. Open your software, then on the server button, enter your username and password, click “Check Login”
  6. It will show you how many credits you have.
  7. The software should recognise your dongle modle (you have to at least specify the manufacturer first though).
  8. Then click unlocking, and then unlock.
  9. DONE!

Step 2 – Ensure RPi Detects Dongle

  1. Switch RPi on.
  2. Insert USB dongle
  3. In terminal, type:
    lsusb
  4. There should be a list of devices plugged into your system – including your dongle. If no dongle, then unplug dongle, wait 5 seconds, and reinsert it.

Step 3 – Install software onto RPi

This is nice and easy. Gammu! There are a couple of SMS apps out there, but scouting around, Gammu seems to be the one that is easier to work with.

In Terminal type:

sudo apt-get install gammu

Configure Gammu

Nothing complex here, just need to ensure that Gammu is on the right port for the dongle.

dmesg | grep ttyUSB

This will list all the devices including the modem. You will see which port the modem is on ttyUSB…

Now to set Gammu to that USB port:

sudo gammu-config

Ensure the port in the config is as per the port the RPi says the dongle is on.
Also ensure the connection baud rate is 19200.

Save.

Simple check to see if Gammu can talk to the dongle:

sudo gammu identify

All should return ok.

Send a text message

In Terminal type:

echo “Text Message Here” | sudo gammu sendsms TEXT 07806123456

Obviously the number at the end is the mobile number to send to.

That is all you need to do. Incorporating that one line into a program to let you know that the chicken house door is closed, or other system status, sounds a great feature to have for me!


References:

Above information re Gammu sourced from Mattias Norell.
Dongle unlocker info sourced from searching the web and how I did it.

Leave a Reply

Your email address will not be published. Required fields are marked *

The Raspiduino Project © 2015 Frontier Theme