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.
- Visit www.dc-unlocker.com and download and run software.
- Insert dongle and it should pick it up.
- 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 - Register on the site, then click the “Buy Credits” button. Purchase the required amount of credits.
- Open your software, then on the server button, enter your username and password, click “Check Login”
- It will show you how many credits you have.
- The software should recognise your dongle modle (you have to at least specify the manufacturer first though).
- Then click unlocking, and then unlock.
- DONE!
Step 2 – Ensure RPi Detects Dongle
- Switch RPi on.
- Insert USB dongle
- In terminal, type:
lsusb - 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.