Raspberry Pi and Frontline SMS
https://shkspr.mobi/blog/2012/06/raspberry-pi-and-frontline-sms/
(I think I'm the first person to try this - so I decided to document the process.)
A few weeks ago, I won a Raspberry Pi at the #OTA12 hackday. It arrived on Friday, so I thought I would turn it into an SMS server using the incredible FrontlineSMS.
0. Setting up the Pi
This is the easy part. Follow the excellent guide on the eLinux wiki. Essentially, download the Debian image, extract, and dd it onto an SD card.
The hardest part was finding a full sized SD! In the end, I found an old adapter and stuck in a 2GB micro SD card.
1. First Boot
My first boot was a failure. Nothing appeared on the screen. So, I switched off the power, unplugged every lead, plugged them back in, and powered it on. Success!
The first thing I did was ensure the operating system was up to date.
Check for updates:
sudo apt-get updateThen, apply those updates
sudo apt-get upgradeThis took a few minutes.
Finally, set up SSH or VNC if you plan on using the machine remotely.
2. Dongle Hardware
FrontlineSMS maintains a list of USB dongles which work with its service. I used a Vodafone branded Huawei E220. Sold as Vodafone K3565The Raspberry Pi only has 2 USB slots - the dongle was slim enough not to interfere with the other USB cable, but it did mean I could only run either a keyboard or a mouse without using a hub. It's recommended that you use a powered USB hub - although my keyboard and mouse didn't seem to draw too much power.
3. Frontline SMS
Downloading Frontline SMS via the commandline (using v1.6 because v2 isn't ready for Linux yet)
wget http://frontlinesms.com/download/secure/FrontlineSMS-distribution-1.6.16.3-linux_i686-dist.zipUnzip
unzip FrontlineSMS-distribution-1.6.16.3-linux_i686-dist.zipRun
cd FrontlineSMS-distribution-1.6.16.3./FrontlineSMS.shGave an error - FrontlineSMS requires Java.
4. Installing Java
The Java install takes about 140MB of disk space. After downloading and extracting FrontlineSMS, I only had about 220MB of free space. I deleted the FrontlineSMS zip file and had 234MB free. Just about enough room!
sudo apt-get install openjdk-6-jdkWait several minutes and you'll be good to go.
5. Running for the First Time
Frontline SMS requires a GUI.
Running a GUI is as easy as typing
startxThe resolution was set at the slightly odd dimensions of 1264*672 - which meant there was a large black border around the screen.
Open a terminal (Start, Accessories, LXTerminal, then type
cd FrontlineSMS-distribution-1.6.16.3./FrontlineSMS.shAfter several minutes of waiting, FrontlineSMS started!
However, no matter what I tried, I couldn't get FrontlineSMS to detect the dongle. The OS could see it fine (using "lsusb" and "dmesg"), but it just didn't appear to be detected by FrontlineSMS.
A delve into the commandline, showed this error:
librxtxSerial.so: cannot open shared object file: No such file or directory(Possible cause: can't load IA 32-bit .so on a ARM-bit platform)thrown while loading gnu.io.RXTXCommDriver6. Installing the Correct Libraries
We need to load the correct (ARM) version of rxtx.
sudo apt-get install librxtx-javaFind where the install process has dumped it
find . -name "librxtxSerial.so"It should show you two location - the first being where the correct version is, the second where the FrontlineSMS version is.
./usr/lib/jni/librxtxSerial.so./home/pi/Desktop/FrontlineSMS-distribution-1.6.16.3/librxtxSerial.soAll we need to do is overwrite the incorrect version.
cp /usr/lib/jni/librxtxSerial.so /home/pi/Desktop/FrontlineSMS-distribution-1.6.16.3/Then, run
./FrontlineSMS.shAnd, after some warnings and waitings, you should see
Hey Presto! FrontlineSMS up and running on a Raspberry Pi!
(Oh! I finally worked out how to do screenshots! install scrot and run "scrot -d 10" to take a screenshot after 10 seconds.)
7. Manually Sending an SMS
Running FrontlineSMS via Java on a 700MHz ARM device is very slow. It is possible to talk directly to the dongle and manually tell it to send SMS.
First, I installed picocom.
sudo apt-get install picocomTo find out where the dongle has been installed, type:
dmesgWhich will give an long output, which should contain some text like this like this:
option 1-1.2:1.1: GSM modem (1-port) converter detectedusb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB0option 1-1.2:1.0: GSM modem (1-port) converter detectedusb 1-1.2: GSM modem (1-port) converter now attached to ttyUSB1The dongle installs itself in two places - ttyUSB0 & 1. It's the first one we want.
Connect by issuing this command
picocom /dev/ttyUSB0 -b 115200 -lWhich will give you the output
port is : /dev/ttyUSB0flowcontrol : nonebaudrate is : 115200parity is : nonedatabits are : 8escape is : C-anoinit is : nonoreset is : nonolock is : yessend_cmd is : ascii_xfr -s -v -l10receive_cmd is : rz -vvTerminal readyFrom now on in, we're typing commands directly into the dongle. You cannot press the delete key! Copy & paste, or be careful when typing!
First, to make sure everything is working, we type
ATWe should see this response
OKNext, set the dongle to text mode
AT+CMGF=1Again, the response should be
OKLet's send our first SMS!
AT+CMGS="+447700900123"This will not say "OK", rather, it will prompt us to type a message
>Type your message, so the screen looks like
> This is a testDO NOT HIT ENTER. Instead, hit CTRL and Z at the same time.
You should see a response like
+CMGS: 193OKThe number is the "sent items" reference. Within a few moments, the SMS should have been received.
You can send an SMS to the dongle. To check for messages, type the command
AT+CMGL="ALL"You should see all the messages in the inbox
+CMGL: 0,"REC READ","+447700900000",,"12/06/19,13:53:19+04"Received+CMGL: 1,"REC READ","+447700900321",,"12/06/23,17:16:29+04"Testing+CMGL: 2,"REC UNREAD","+447700900555",,"12/06/23,23:27:48+04"This is another testTo quit picocom, hold down CTRL, then hold down A, then hold down X.
Useful Links
A collection of links I found useful when writing this blog post
- http://designbuildtestrepeat.wordpress.com/2008/04/29/huawei-e220-on-linux-for-sms/
- http://www.diafaan.com/sms-tutorials/gsm-modem-tutorial/
- http://www.shapeshifter.se/2008/04/30/list-of-at-commands/
- http://raspberrypi.homelabs.org.uk/raspberrypi-the-arduino-development-tool/
- http://developer.vodafone.com/labs/opensource/linux- connection-manager/operating-systems/ubuntu-linux-setup/
- For unlocking Huawei modems
#frontlinesms #hack #hacking #hardware #linux #ota12 #RaspberryPi #sms
Raspberry Pi and Frontline SMS
(I think I'm the first person to try this - so I decided to document the process.) A few weeks ago, I won a Raspberry Pi at the #OTA12 hackday. It arrived on Friday, so I thought I would turn it into an SMS server using the incredible FrontlineSMS. 0. Setting up the Pi This is the easy part. Follow the excellent guide on the eLinux wiki. Essentially, download the Debian image, extract, and dd…