ALIEN – ALtitude Imaging Entering Near-space

April 14, 2009

AT commands with the W800

Filed under: Uncategorized — Tags: , , , , , , , — sbasuita @ 18:51

Well, I’ve finally had a chance to mess about with the data cable (Ericsson 12-pin <=> USB) that I ordered off ebay last week. The cable itself cost just under £2 (inc. shipping), so in the (hopefully) unlikely event that our future hacking of its pins fails, it shouldn’t be too much of a loss.

12-pin <==> USB

12-pin <==> USB

The phone that we’ve chosen to use for the project is my Sony Ericsson W800i (the ‘i’ is a regional identifier). It is useful to note that the phone is essentially identical to the K750 (excepting software and cosmetics) – this adds more keywords to our googling.

Sony Ericsson W800i

Sony Ericsson W800i

The W800 supports the use of ‘AT commands’ over a serial interface, allowing us to access a wide variety of the phone’s functions without having to physically push its buttons. Note that in the following sections I will be using Linux (Ubuntu Intrepid) to connect to and interface with the phone (although the AT commands used are the same for any O/S).

Getting a connection to the phone after plugging it in was pretty painless: the kernel recognised it as a ‘USB Communications Device’ and promptly set up /dev/ttyACM0 and ttyACM1 for me to play with.

[15853.116762] cdc_acm 6-1:1.1: ttyACM0: USB ACM device
[15853.124197] cdc_acm 6-1:1.3: ttyACM1: USB ACM device
[15853.134130] cdc_wdm 6-1:1.7: cdc-wdm0: USB WDM device

I used the terminal program ‘Minicom’ to access the device. The first step is to install and configure it:

$ sudo aptitude install minicom
$ minicom -s

From the menu, make your way to “Serial port setup” and change the “Serial Device” to /dev/ttyACM0. Next, choose “Exit”. Minicom will initialise the modem and connect to the phone. To confirm things are going well, type the command ‘ATI0’ and hit enter – the phone should respond with its model.

Sony Ericsson W800


This is evidently one of the more boring AT commands that the phone supports. Thankfully, Sony Ericsson have been kind enough to publish a 300-page manual detailing all the juicy commands at our disposal: from “Control and Identification” right through to “GSM Subscriber Information”, and beyond. I picked up an older (January 2007) revision of the manual because it specifically lists the w800i in the document.

As we’re specifically interested in sending SMS, our first move is to figure out which message formats it supports. For this, we enter the command ‘AT+CMGF?’.

+CMGF: 0


The response ‘0’ corresponds to PDU mode. Thus, we will send our message to the phone encoded as a hexadecimal string. The procedure to prepare our ASCII message for transmission to the phone is far from simple; this guide was invaluable, and served as a great reference. Make sure you read it thoroughly; there is much room for silly mistakes here!

All of the example values used in the guide are sane, and I simply copied them rather than having to figure out which bits I needed to set to achieve obscure (at least to the untrained) network functionality. The parts we need to worry about are the recipient’s telephone number, and the message itself.

For the former, we used the national format (ie. 441234567890, where 44 is the UK country code). Encoding the number is a simple operation of swapping every pair of digits.

By far the trickiest part of crafting your hex-string is encoding your 7-bit ASCII message into octets (8 bits). At first I followed the guide’s instructions by hand, which worked fine after a few careless errors with all the little bits. However, Daniel soon decided that coding a C implementation of the routine was much more enjoyable than his holiday in France:

/* Code snippet to encode 7-bit ASCII (intext) as 8-bit data (sms_string)
for transmission to a phone in PDU mode for SMS */

/* Copyright (C) 2009 Daniel Richman & Simrun Basuita
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see . */

/* Now lets check the instring for non-ascii, and convert to sms string */
l = 1; /* L will represent the bit that we are modifying in smsstr */
m = 0; /* M will represent the byte that we are modifying */

for (i = 0; i < intext_length; i++) { for (n = 0; n < 7; n++) /* For each of the 7 bits... */ { if ( ((unsigned char) intext[i]) & (1 << n) ) /* If it is set... */ { sms_string[m] |= l; /* Set the bit by ORing l */ } /* Now shift l left, effectivly multiplying by 2 and selecting the next * bit in the output string */ l = l << 1; /* If the 9th bit is set, ie. it == 256, then we must roll it back to * 1 (1st bit) and move onto the next byte. */ if (l == 256) { l = 1; m++; } } } [/sourcecode]

danielrichman – update: Both the full C file from which the code above is taken, and a new version of the sms-example software are available on our new SVN repository. You can find the files in question at the link below; they are called sms-example-v1.c and sms-example-v2.c

Once you’ve composed your very own hex-string, send it to the phone with the ‘AT+CMGS’ command. You will need to know the number of octets in your string, excluding the first (00 – the length of SMSC information). After the first line, the phone will print a ‘>’, indicating you can send your hex-string, followed by a CTRL-z (0x1a).



There is usually a pause of a few seconds after you fire off the CTRL-z, but if you’ve encoded everything right you should be met with a nice OK, indicating the message was sent. Note that your message won’t show up in the “Sent Items” folder of the phone’s messaging software.


  1. […] the inital testing. And then even worse things happened. It’s 9600 baud, and the AT commands are exactly the same as in the w800i. However, note these pitfalls – each one consumed atleast 30minutes of me banging my head […]

    Pingback by A motherload « ALIEN – ALtitude Imaging Entering Near-space — June 12, 2009 @ 22:46

  2. can i get sms thou this process

    Comment by ahmed mohamed — April 27, 2010 @ 14:48

  3. Ahmed, yes, you can access pretty much all of the phone’s functionality – take a look at the reference documents that Sony Ericsson publish for the commands.

    Comment by sbasuita — April 29, 2010 @ 17:19

  4. i want to explain at command for sony ericsson in vb 2008

    Comment by Anonymous — December 4, 2012 @ 07:56

  5. my email is

    Comment by Anonymous — December 4, 2012 @ 07:57

  6. To transition your thing as the temperature gradually rises, adding is key.

    When looking for a good host, make sure these folks agree to well-liked kinds of settlement.

    The one that employs Take a variety of is regarded just like the popular range.
    Wel be giving away great prizes throughout the two-day event.

    Comment by designer dresses — June 18, 2013 @ 02:36

  7. Thank you for good article!
    But, I had a problem with my SE w800i:
    when I entered command AT , my phone answered OK. But when I entered «AT+CMGF?» or «AT+CMGS=17» SE w800i sends ERROR. Why? What I do wrong?

    Comment by Ihar — October 22, 2014 @ 19:45

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: