From few month now, i was using my android phone to transmit new SMS to my computer using Android Notifier. All the new SMS was sent over Wifi/UDP. Now i was searching a standalone and cheap alternative. Recently, Hack a Day have published an article: Cheap and easy SMS via GMS for your MCU. And they talk about something very interesting: a USB GSM modem for only $25.
To be able to use this modem, i need also a SIM card. You have lot of possibilities to explore, but the one i’ve take is a prepaid card on Bouygues, for only 9.90€. You have only 5 minutes for dialing.. but you don’t care. What you must care about is the availability of the phone number. On this case, the number is still available 6 month. 9.90€ for having a 6 month number, that’s totally enough for only receiving SMS.
The GSM modem is internally a BenQ M23 (Specifications). You can use a simple serial command line to talk with :
$ cu -l /dev/ttyUSB0
SW ver: 1.80
HW ver: 1.00
FS ver: 1.00
Build Date: 2004/6/25
Build Time: 18:40:37
After exploring some documentation and specifications, what i found out:
- Messaging system can be read in 2 form, text and PDU
- Text mode is not ok for our French encoding. All specials characters are stripped.
Exemple of a session in text mode (AT+CMGF=1) :
+CMGL: 1,"REC UNREAD","336XXXXXXXXX",,"11/01/07,12:15:53+04",145,21
Voici les rsultats.
The correct word must be “résultats”, not “rsultats”. When switching to PDU mode (AT+CMGF=0), we obtain :
The big hexadecimal string is the PDU. For decoding this string, we can use the Python Messaging library, very simple to use :
from messaging.sms import SmsDeliver
# output => u'Voici les r\xe9sultats. '
Here we are !
Next blog post: how to read MMS from Bouygues Telecom 🙂