Mobiles, Shakespeare, Politics, Usability, Security.

SMS PDU in Python for Raspberry Pi

Cracking on with my Raspberry Pi, I've written my first program in Python.

The aim - to be able to send an SMS via a 3G USB dongle.
The problem - the way SMS needs to be encoded is hideously complicated.

For example, suppose you want to send "This is a very simple message :-)" to the phone number +447700900123.

This is the command that you need to send to your dongle:

WHAT? THE? JUDDERING? FUCK?!

I found an excellent JavaScript PDU tool - which I have adapted. Also of great help was Lars Pettersson's PDU explanation and Jeron's discussion of the SMS PDU. I would have been totally lost without them.

Python is already pre-installed on the Raspberry Pi - which is handy. So here is a tool I whipped up which will generate the above gibberish.

Running the program should show this:

And will output this:

The source is on GitHub - or please find in below for your edification and delight.

This is my first outing in Python, so I'm sure I've made a few syntactic and stylistic mistakes. Any corrections gratefully received.

The source is on GitHub.

In order to actually send the SMS, you will need to put the modem into PDU mode, this is done by the command

So, as per my earlier post on sending SMS, the complete sequence is

Then press CTRL+Z to send.

3 Comments

A picture of A.andalys A.andalys

Hi !
Thanks for your article.
I was wondering if it's possible to replace the sender telephone number by another thing (let's say another one or even my company name) ?

Grettings-

Reply

What do you reckon?

%d bloggers like this: