Feed on
Posts
Comments

A few months ago I was looking into how to use Fbus with a Nokia phone but didn’t have much luck and instead just wired up the keypad. I decided to revisit Fbus and this time happened to find some AVR code which could send/receive SMS’s so now I’m able to send an SMS using the Arduino and I’ll explain how we do this.

IMG_2674

Before I go any further the 3 resources I used were:
Embedtronics – F-bus packet explanation with some examples of a packet
Avr and nokia3310 interface(sms) project on AVRfreaks – Code for an AVR to send/receive SMS
Gnokii – F-bus documentation and code to run on a computer

Firstly you need a Nokia phone which the F-bus commands are known, the best documentation is available for the Nokia 6110 and derivatives (Nokia 6130, 6150, 6190, 5110, 5130, 5150, 5190, 3210, 3310) – this was found in \gnokii-0.6.31\Docs\protocol\nk6110.txt

305px-Nokia_6150_pinout

I was able to purchase a Nokia 6150 from Ebay for under $20. You can search up the Nokia pinout for your mobile phone – I found the TX, RX and GND for my phone.

fbus-1

The F-bus protocol uses 115,200bps so we can easily use the Arduino’s serial function to communication with the phone. All you need to is hook up the phones TX to the Arduino’s RX and then use a resistor divider (I choose 330 ohm resistors) to connect the Arduino’s TX to the phones RX as shown above.

Understanding F-bus packets

So now we have it all hooked up and ready to go, we have to know the frame format which F-bus uses, the \gnokii-0.6.31\Docs\protocol\nokia.txt provides us with this. For my phone it was F-bus version 2.

Frame format for FBUS version 2/Direct IRDA:
{ FrameID, DestDEV, SrcDEV, MsgType, 0x00, FrameLength, {block}, FramesToGo,
 SeqNo, PaddingByte?, ChkSum1, ChkSum2 }

 where FrameID:   0x1c: IR / FBUS
                  0x1e: Serial / FBUS
 DestDev, SrcDev: 0x00: mobile phone
                  0x0c: TE (FBUS) [eg. PC]
 MsgType:         see List
 FrameLength:     {block} + 2 (+ 1 if PaddingByte exists)
 FramesToGo:      0x01 means the last frame
 SeqNo:           [0xXY]
                  X: 4: first block
                  0: continuing block
                  Y: sequence number
 PaddingByte:     0x00 if FrameLength would be an odd number anyways it doesn't exists
 ChkSum1:         XOR on frame's odd numbers
 ChkSum2?:        XOR on frame's even numbers

The Embedtronics website has an example packet which is sent to the phone requesting its hardware/software information and the phones reply with the explanation. I’ll try to combine all the information together in my explanation so you can hopefully understand where everything fits in.

Request phone’s hardware/software information (the data is in hex):

Byte: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
Data: 1E 00 0C D1 00 07 00 01 00 03 00 01 60 00 72 D5

1E: Frame ID – this packet is being sent using F-bus
00: DestDev – this packet is being sent to the phone
0C: SrcDev – this packet is coming from F-bus
D1: MsgType – the type of message we are going to send/receive
If you check out \gnokii-0.6.31\Docs\protocol\nk6110.txt, it will say:
0xd1:
s Get HW&SW version     { 0×0003, 0×00 }
So 0xD1 is the MsgType, the “s” stands for the command we send to the phone and “0×0003, 0×00” is the command we will send to the phone.
00 07: Frame length – the length of the data that follows, in this case it’s 7 bytes going from byte 06 to byte 12.
00 01: Unknown – even though Embedtronics website has an explanation it doesn’t make sense as the only time this appears is if we are sending/receiving data that isn’t an acknowledgement packet, so something to keep in mind. These bytes can be ignored.
00 03 00: Command – in this case we send the Get HW&SW version command as shown above.
01: Frames to go – since we aren’t sending the phone any other frames this is the last frame so we send 0×01 (this isn’t sent in an acknowledgement packet)
60: SeqNo – this is the sequence number we send to the phone, it will ignore the 6 but keep track of the 0. When we or the phone sends an acknowledge to each others packets, we need send back the sequence number we received. The sequence number is incremented for each new packet we send or receive that isn’t an acknowledgement and the sender/receiver have their own sequence numbers which overflow once they reach 3 bits (0, 1, 2, 3, 4, 5, 6, 7, 0, 1, etc)
00: Padding byte – Anything we send to the phone needs to have an even number of bytes, we add this to our packet to bring us up to 16 bytes total length.
72: Chksum1 – An XOR of all odd bytes up to the SeqNo
D5: Chksum2 – An XOR of all even bytes up to the SeqNo

We will take the reply from Embedtronics website:

1E 0C 00 7F 00 02 D1 00 CF 71

1E 0C 00 D2 00 26 01 00 00 03 56 20 30 34 2E 34 35 0A 32 31 2D 30 36 2D 30 31 0A 4E 48 4D 2D 35 0A 28 63 29 20 4E 4D
 50 2E 00 01 41 3F A4

The first frame is an acknowledgement from the phone to us saying it received our request.
1E 0C 00 – Destination and source are swapped around since the phone is now sending a frame back to us
7F: MsgType – the phone is sending us an acknowledgement packet
From nk6110.txt it says:
0x7f: Acknowledge(FBUS/IRDA){+type, seq }
Acknowledge(MBUS)…
00 02: Frame length – 2 bytes.
D1: Command – in this case “+type” is the Msgtype we sent the phone in the previous frame
00: SeqNo – the phone sends back the last number of our sequence number which was 0×60 so it sends back 0×00 (0×60 & 0×07, it only cares about the last 3 bits)
CF: Chksum1
71: Chksum2

The second frame is the information we requested.
1E 0C 00 – Destination and source are swapped around since the phone is now sending a frame back to us
D2: MsgType – the type of message
From nk6110.txt it says:
0xd2:
r Get HW&SW version     { 0×0003 “V ” “firmware\n” “firmware date\n”
“model\n” “(c) NMP.” }
So 0xD2 is the MsgType, the “r” stands for the command we will receive from the phone and “0×0003” is the start of the hardware/software version.

00 26: Frame length – 38 bytes.
01 00: Unknown – looks like this time the unknown data is reversed, can be ignored
00 03: Command – in this case we receive the get HW&SW version
56 20 30 34 2E 34 35 0A 32 31 2D 30 36 2D 30 31 0A 4E 48 4D 2D 35 0A 28 63 29 20 4E 4D
50 2E 00: The HW&SW version which if you put in a hex editor reads as: V 04.45.21-06-01.NHM-5.(c) NMP..
01: Frames to go – last frame
41: SeqNo – the phone has generated it’s own sequence number
3F: Chksum1
A4: Chksum2

Now we have a chance to reply to the phone. If we don’t reply with an acknowledgement packet, the phone will try to send the information to us 3 times but it will still perform the action/command we sent it.

Let’s send a reply, from the Embedtronics website:

1E 00 0C 7F 00 02 D2 01 C0 7C

1E 00 0C – We are sending a frame to the phone
7F: MsgType – we are sending the phone an acknowledgement packet
00 02: Frame length – 2 bytes
D2: Command – in this case we acknowledge the phones message type it sent us in the previous frame
01: SeqNo – we send the phone its own sequence number which was 0×41 so we send back 0×01 (0×41 & 0×07)
C0: Chksum1
7F: Chksum2

Hopefully the above has given you an idea of how we send and receive information from the phone, let’s try this out on the Arduino now. Remember when programming the Arduino, you need to disconnect the phones TX/RX (pin 0 and 1) from the Arduino.

Sending the HW&SW version request

byte msg[] = {
0x1E, 0x00, 0x0C, 0xD1, 0x00, 0x07, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x60, 0x00, 0x72, 0xD5 };

void setup() {
  Serial.begin(115200);
  delay(1000);
}

void loop() {
  // Initialise the F-bus
  for (int z = 0; z < 128; z++) {
    Serial.write(0x55);
  }
  Serial.println("");
  delay(100);

  // Send our command
  for (int x = 0; x < (sizeof(msg) / sizeof(byte)); x++) {
    Serial.write(msg[x]);
  }
  Serial.println("");

  // Wait for a reply
  while (1) {
    while (Serial.available() > 0) {
      int incomingByte = Serial.read();
      Serial.print(incomingByte, HEX);
      Serial.print(" ");
    }
  }
}

Download fbus_hw_sw_version. In this example, we have our message stored in an array, we initialise the F-bus by sending (0×55) “U” 128 times, send our command from the array, wait for a reply and we don’t send any acknowledgements back.

UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
1E C 0 7F 0 2 D1 0 CF 71
1E C 0 D2 0 26 1 0 0 3 56 20 20 35 2E 30 32 A 30 32 2D 30 32 2D 39 39 A 4E 53 4D 2D 31 A 28 63 29 20 4E 4D 50 2E 0 1 41 3C AE
1E C 0 D2 0 26 1 0 0 3 56 20 20 35 2E 30 32 A 30 32 2D 30 32 2D 39 39 A 4E 53 4D 2D 31 A 28 63 29 20 4E 4D 50 2E 0 1 41 3C AE
1E C 0 D2 0 26 1 0 0 3 56 20 20 35 2E 30 32 A 30 32 2D 30 32 2D 39 39 A 4E 53 4D 2D 31 A 28 63 29 20 4E 4D 50 2E 0 1 41 3C AE

Above we see the results – the 128 U’s we sent, the acknowledgement packet received and the HW&SW version received 3 times, notice that the single characters we receive back such as C, 0, are actually 0x0C, 0×00, etc. There will be random looking characters in-between the 128 U’s and the reply (that I can’t insert into wordpress), which is the command we sent.

fbus-2

I have made a very basic C file fbus_checksum_and_output which can be used to calculate the checksum for any commands you want to send so you can easily modify the code above by just changing the msg array variable.

Sending an SMS

Now we can move on to sending an SMS. Using code provided from the AVRfreaks project, I was able to clean it up and modify it to only send an SMS and do nothing else.

To send an SMS we use:

0x02: SMS handling
s Send SMS message      { 0x0001, 0x02, 0x00 (SEND REQUEST), ... }

But I wasn’t able to find what SEND REQUEST meant which is where the reviewing the Embedtronics website helped find the SMS format.

unsigned char FBusFrame[200];
unsigned char SMSC[] = {0x07, 0x91, 0x16, 0x14, 0x91, 0x09, 0x00, 0xF1, 0x00, 0x00, 0x00, 0x00};
unsigned char RecipientNo[] = {0x0A, 0x81, 0x40, 0x21, 0x43, 0x65, 0x87};

void setup() {
  Serial.begin(115200);
  delay(100);
}

void loop() {
  // Initialise the Fbus by sending "U" 128 times
  for (int x = 0; x < 128; x++) {
    Serial.write("U");
  }

  // Send the SMS message
  SendSMS("Hi All. This message was sent through F-Bus. Cool!!");

  // Keep listening for a reply (we won't send any acknowledgements back)
  while (1) {
    ...
  }
}

We only really have to worry about 2 variables and the SMS message to send.The SMS center number is provided by your mobile phone provider which is relaying the SMS we send on to our recipient. The data in this case isn’t really hex but rather are the actual numbers and are back to front. The SMSC we are using would really read +61 411 990 001 (0×16 reads as 61, 0×14 reads as 41, etc). The same back to front format applies to the ReceipientNo which would really read as 0412 345 678

unsigned char SendSMS(const char *Message) {
  // Clear buffer
  unsigned char j = 0;
  memset(FBusFrame, 0, sizeof(FBusFrame));

  unsigned char MsgLen = strlen(Message), FrameSize = 0;
  unsigned char c, w, n, shift = 0, frameIndex = 0;
  unsigned char oddCheckSum, evenCheckSum = 0;

  // Encode the message into 7 bit characters
  for (n = 0; n < MsgLen; n++) {
    c = Message[n] & 0x7f;
    c >>= shift;
    w = Message[n+1] & 0x7f;
    w <<= (7-shift);
    shift += 1;
    c = c | w;
    if (shift == 7) {
      shift = 0x00;
      n++;
    }
    FBusFrame[frameIndex + MsgStartIndex] = c;
    frameIndex++;
}
FBusFrame[frameIndex + MsgStartIndex] = 0x01;
FrameSize = frameIndex + 44; // The size of the frame is frameIndex+48 (FrameIndex + 48 + 1 - 5)

We encode the SMS message which converts our 8bit ASCII into a 7bit because readable text in ASCII only ranges between 0 – 127 (7 bits) which means if our message starts off with “Hi”, the last bit of the “i” would be on the first bit of the “H”, the Embedtronics website explains this is more detail.

// Insert the frame values to prepare to send an SMS
FBusFrame[0] = 0x1E;
FBusFrame[1] = 0x00;
FBusFrame[2] = 0x0C;
FBusFrame[3] = 0x02;
FBusFrame[4] = 0x00;
FBusFrame[5] = FrameSize;
FBusFrame[6] = 0x00;
FBusFrame[7] = 0x01;
FBusFrame[8] = 0x00;
FBusFrame[9] = 0x01;
FBusFrame[10] = 0x02;
FBusFrame[11] = 0x00;

// Insert the SMS Center number
for (j = 0; j < sizeof(SMSC); j++) {
  FBusFrame[12 + j] = SMSC[j];
}

FBusFrame[24] = 0x15; // Message type
FBusFrame[28] = MsgLen; // Message length (uncompressed)

// Insert the Recipient number
for (j = 0; j < sizeof(RecipientNo); j++) {
  FBusFrame[j + 29] = RecipientNo[j];
}

FBusFrame[41] = 0xA7; // Validity period

We insert the usual starting frames to send an SMS, insert the SMS center number and the recipient number. The other things like message type, validity period,etc I didn’t bother to look into much because the Embedtronics website referred to the GSM spec so I took their word for it and assumed it’s all correct.

// Check if the Framesize is odd or even
if (FrameSize & 0x01) {
  frameIndex = FrameSize + 5;
  FBusFrame[frameIndex] = SeqNo;
  frameIndex++;\
  FBusFrame[frameIndex] = 0; // Insert to make the Frame even
  frameIndex++;
}
else {
  frameIndex = FrameSize + 5;
  FBusFrame[frameIndex] = SeqNo;
  frameIndex++;
}

// Calculate the checksum from the start of the frame to the end of the frame
for (unsigned char i = 0; i < frameIndex+2; i += 2) {
  oddCheckSum ^= FBusFrame[i];
  evenCheckSum ^= FBusFrame[i+1];
}
FBusFrame[frameIndex] = oddCheckSum;
FBusFrame[frameIndex+1] = evenCheckSum;

// Send the full frame to the phone
for (unsigned char j = 0; j < (frameIndex+2); j++) {
  // Debug to check in hex what we are sending
  //Serial.print(FBusFrame [j], HEX);
  //Serial.print(" ");

  Serial.write(FBusFrame [j]);
}

Now we just check if the frame is odd or even and insert a padding byte if needed, we also calculate the checksums and then send all the frames to the phone. If you want to see what it’s actually sending in hex you can uncomment the debug part. Download fbus_send_sms.

UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
1E C 0 7F 0 2 2 83 1C F2
1E C 0 2 0 9 1 8 0 2 64 35 0 1 40 0 3B 39
1E C 0 2 0 9 1 8 0 2 64 35 0 1 40 0 3B 39
1E C 0 2 0 9 1 8 0 2 64 35 0 1 40 0 3B 39
1E C 0 A 0 15 1 8 0 71 1 0 1 B 1 2 F2 D2 1A 3B 5 F5 20 0 0 1 41 0 FC 6A
1E C 0 A 0 15 1 8 0 71 1 0 1 B 1 2 F2 D2 1A 3B 5 F5 20 0 0 1 41 0 FC 6A
1E C 0 A 0 15 1 8 0 71 1 0 1 B 1 2 F2 D2 1A 3B 5 F5 20 0 0 1 41 0 FC 6A
1E C 0 A 0 15 1 8 0 71 1 0 1 B 1 2 F2 D2 1A 3B 5 F5 20 0 0 1 42 0 FF 6A
1E C 0 A 0 15 1 8 0 71 1 0 1 B 1 2 F2 D2 1A 3B 5 F5 20 0 0 1 42 0 FF 6A
1E C 0 A 0 15 1 8 0 71 1 0 1 B 1 2 F2 D2 1A 3B 5 F5 20 0 0 1 42 0 FF 6A 

We receive the reply from the phone. First it sends the acknowledgement packet and a few seconds later it sends the rest.

If you wanted to listen to make sure the SMS was successfully sent you would look at:
0×02: SMS handling
    r Message sent          { 0×0002 }
Which is found at in the text above at: 1E C 0 2 0 9 1 8 0 2

Interestingly it also sends us the network status 6 times after that:
0x0a: Network status
    r network registration  { 0×0071, ?,?,?,length,netstatus,netsel,cellIDH,cellIDL,lacH,lacL,netcode,netcode,netcode }

So that’s all there is to know and now we know to send an SMS! The next step is to move away from the Arduino, we’ll need dedicated USART which the ATtiny2313A and 4313 have so I might pick one of those up and see how it goes. If I can get that working then this can replace the Nokia Keypad SMS Sender that I have connected to my alarm system.

Edit 17/03/13: I found that you can only send 1 SMS with the code above. Trying to send a second SMS only gives back an acknowledgement of the packet we sent but not the SMS itself. After lots of testing, I found that you should firstly send 128 ‘U’, then send the request for the HW&SW command and then send the SMS.

70 Responses to “How to use Nokia F-bus to send an SMS message”

  1. [...] to get started, hit eBay for those old Nokias – then click here for Alex’s project. And for more, we’re [...]

  2. [...] his website, he provides a detailed tutorial on how to use an old Nokia 6110 (or any derivatives) to send SMS [...]

  3. [...] his website, he provides a detailed tutorial on how to use an old Nokia 6110 (or any derivatives) to send SMS [...]

    • Shyama says:

      Hi,
      Can i use a nokia 1100 handset instead of the 3310? I tried flashing your code but nothing seems to happen. I was able to speed dial from the phone, using another code via a uno board. But i can’t send sms or get proper reply for hw-sw request . Please help.
      Thank You.

  4. lipp says:

    Hello, very interesting work, congratulation.
    One question on the resistor that you use on Arduino_TX and Nokia_RX, why do you use the resistor? Can I connect directly Arduino TX/RX to Nokia RX/TX?

    • Alex says:

      Hi,

      You shouldn’t connect them together, if you do you are very likely to damage the Nokia phone. As the Arduino is running at 5V we need to reduce this to the voltage the Nokia phone is running at, which is around 3.6V. The two resistors are used as a resistor divider which reduces the voltage to 2.5V.

  5. [...] TYM adresem znajdziecie opis – jak wysyłać SMS-y z  telefonu komórkowego Nokia 6130 (6150, [...]

  6. [...] Pod TYM adresem znajdziecie opis – jak wysyłać SMS-y z  telefonu komórkowego Nokia 6130 (6150, 6190, 5110, 5130, 5150, 5190, 3210, 3310) poprzez protokół F-bus z wykorzystaniem Arduino. [...]

  7. [...] Now you can use one for your next Arduino project. Alex of insideGadgets has kindly posted a detailed tutorial showing how to hack and old Nokia 6110 (or any derivative) to send text messages from an Arduino. [...]

  8. [...] Vous pourrez retrouver tous les détails pour l’expérimenter sur insidegadgets.com [...]

  9. Mugabe Magezi says:

    Thanx Alot Allex. Iam working with the same phone in Uganda and i want to be able to send system status messages with the Nokia 3310. i have tried using your program but the phone can’t really send any messages. M thinking that the problem could with the phone numbers am using cuz for the smsc i’ve used 0×07, 0×91,0×52,0×6, 0×07, 0×4, 0×09, 0×21, 0×16, 0xF1, 0×00, 0×00, 0×00, 0×00 for the number +256-704901261
    and for the receipient i have used 0x0A, 0×81, 0×70, 0×00, 0×66, 0×46, 0×64 for 0700666440 pliz help me cuz am almost at the virgue of completing the project.

  10. Mugabe Magezi says:

    the smsc is +9232100006001 corrections

  11. Shini says:

    Hi there, thank you for all this awesome “tut”, I made great progress working with my 3310.
    Still playing to check if everything works before I go any further, but i have some trouble in your code.
    // Check if the Framesize is odd or even
    if [...]
    FBusFrame[frameIndex] = SeqNo;
    [...]
    What’s SeqNo for? How can i initialize it? i read again and again your post and embedelectronics’s post, but i can’t manage to make the entire thing work and send my first sms ^^

    Could someone give me a little hand please?

    • Alex says:

      Hi Shini,

      In the scheme of things the SeqNo isn’t that important, it just allows each side to identify if the data we are sending is new or is a continuation of the packet we have sent before or we are sending an ack back (you don’t have to send an ack back to send an SMS). You can leave SeqNo as is.

      Are you receiving any data back from the phone? Do you receive the HW & SW info?

      • Shini says:

        Hi Alex, thanks for your fast answer :)

        The problem with SeqNo is that it’s not initiate (i tried things like “unsigned char SeqNo”, but not shure if it’s the right thing or not.. but if I leave it as is, then the code won’t compile. (I’m working with an Arduino Uno rev3 & Leonardo)

        I’m receiving data back! since I used this : http://www.semageek.com/diy-comment-envoyer-des-sms-avec-un-arduino-sans-se-ruiner/ (just before I found your link ^^), with the first part of code.

        Then when i try to use sendSMS(); , i have weird chars coming out first, then some things… and as i said, i can’t execute the complete example code without a bug (coming from this SeqNo)

        • Alex says:

          Hi Shino,
          Yes it should be unsigned char for the SeqNo.
          Can you paste what you receive back?

          Also try uncommenting these serial.print lines to see what you are sending:
          // Debug to check in hex what we are sending
          //Serial.print(FBusFrame [j], HEX);
          //Serial.print(” “);

  12. Seveen says:

    Hi,
    Your tut is really helpful, but I really wanted to use my 3310 to receive SMS and I can’t figure how. Have you tried anything ? From what I understand from the Embedtronics link you mentioned (http://www.embedtronics.com/nokia/fbus.html#part4) , I only need to watch for any serial communication coming from the phone, as it’s supposed to send the received SMS on the FBus. I tried something like this, but without success :

    void setup() {
    Serial.begin(115200);
    delay(1000);
    }

    void loop() {
    // Initialise the F-bus
    for (int z = 0; z 0) {
    int incomingByte = Serial.read();
    Serial.print(incomingByte, HEX);
    Serial.print(” “);
    }
    }
    }

    Do you have any advice to give me ?
    Thanks

    • Seveen says:

      Sorry looks like I screwed the copy/paste :

      void setup() {
      Serial.begin(115200);
      delay(1000);
      }

      void loop() {
      // Initialise the F-bus
      for (int z = 0; z 0) {
      int incomingByte = Serial.read();
      Serial.print(incomingByte, HEX);
      Serial.print(” “);
      }
      }
      }

      • Seveen says:

        Ok so that’s not me, I can’t figure why but some of the code is lost when I post it x). Anyways, that’s only the //Initialise the F-Bus part you gave in your tutorial, so I’m pretty sure I had this part good. Also sorry for the spam ^^

        • Alex says:

          Hi Seveen,

          Could you post the code in pastie.org?

          Try this:
          // Initialise the Fbus
          for (int z = 0; z < 128; z++) {
          Serial.write(0x55);
          }

          while (Serial.available() > 0) {
          int incomingByte = Serial.read();
          Serial.print(incomingByte, HEX);
          Serial.print(” “);
          }

          • Seveen says:

            Yeah that’s exactly what I tried.
            But I cant manage to get an answer from the phone. Anyways thank you for your reply.

  13. Shyama says:

    Hi,
    Can i use a nokia 1100 handset instead of the 3310? I tried flashing your code but nothing seems to happen. I was able to speed dial from the phone, using another code via a uno board. But i can’t send sms or get proper reply for hw-sw request . Please help.
    Thank You.

    • Alex says:

      Hi Shyama,
      I’m not sure if it will work as only these models are known to work at the moment:
      GSM/PCN Nokia 6110 and derivatives (Nokia 6130, 6150, 6190, 5110, 5130, 5150,
      5190, 3210, 3310)
      GSM Nokia 2110
      NMT Nokia 640
      TDMA NOKIA 5120 / 5160 / 6120 / 6160
      CDMA Nokia 6185
      GSM Nokia 6510
      GSM Nokia 6210 and derivatives (7110)

  14. Steven says:

    Hi
    I’m using your send sms code with a 3310 but I can’t seem to get tit to send an SMS.
    How do I get it to set the sms centre number as +447802002606

    unsigned char SMSC[] = {0×08, 0xa1, 0×44, 0×87, 0×20, 0×00, 0×00, 0×62, 0×60}; yes?

    Btw am able to get it to show my hardware version number.

    • Alex says:

      Hi Steven,

      Try this one:
      unsigned char SMSC[] = {0×07, 0×91, 0×44, 0×87, 0×20, 0×00, 0×62, 0×60, 0×00, 0×00, 0×00, 0×00};

  15. Jean-Luc says:

    Good morning,

    I have developped a buglar alarm using NOKIA 3310 FBUS, controlled with PIC16F628.
    All is ok.
    To preserve the battery life of the alarm, i want to switch off the key led and the LCD.
    My question is if there is a FBUS command to do that.
    Thanks for your help.

    Best regards.
    Jean-Luc.

    • Alex says:

      Hi Jean-Luc,

      From what I can see there doesn’t seem to be any commands to switch off the key led or LCD. For the key LED – maybe there is an option in the profile setting? For the LCD as long as you don’t need to see anything, you should be able to remove it from the phone.

  16. Mehdi says:

    Hello, I learnt a lot of things reading your article and related links but I’m getting stuck:
    I can communicate with the 3310 thanks to FBUS command but the answer doesn’t match with what I expected. I use 2 serial ports : the native one to comunicate between arduino and computer, and a software one to comunicate between nokia and arduino.
    Here is the output of my program:
    I don’t understand why the response from the nokia doesn’t corresponds to what you explain in your blog.
    Do you have any advice for me?
    Thanks for your attention
    ===== Program output (I did 3 reset to get more trames)======
    Hello
    UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
    1E 0 C D1 0 7 0 1 0 3 0 1 60 0 72 D5
    wait for answer
    8E 43 D0 1 81 34 D0 97 39 86 20 1E 48 A 1 40 90 5 C1 5A 35 AA 19 49 A6 5 9A 55 48 26 C8 45 9B AD 25 10 29 D4 28 D4 2 59 40 A0 14 AE 8E 43 90 E 24 2 0 80 90 A C2 69 57 D3 2A 64 99 27 53 B6 60 91 41 84 6A 55 9B 42 D5 2A 82 99 A7 74 5 A 85 9C FB 8E 43 90 E 24 2 0 80 90 A C2 69 97 D3 2A 53 0 4 A 81 80 4 FF 2 0 80 90 A C2 69 97 D3 2A 64 99 27 53 B6 60 91 41 84 6A 55 9B 42 D5 2A 82 99 A7 74 5 A 85 9C FB 2A 64 99 27 8E 43 90 4 6A 5 84 A0 56 8 14 2E 80 90 3 87 5E 10 81 40 Hello
    UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
    1E 0 C D1 0 7 0 1 0 3 0 1 60 0 72 D5
    wait for answer
    8E 43 D0 1 81 34 D0 97 3C 8C 40 1D 68 2 0 80 90 5 C3 DA 35 55 8A 4D A7 4 DA 59 98 2C 91 5 95 AB 49 4 8A 53 50 D4 2 59 80 A0 4C A6 8E 43 90 E 24 2 0 80 90 A C2 69 97 52 C9 94 E5 96 AC 52 9 45 82 53 69 D4 55 8A 48 56 9 3A 1A A0 4B 20 68 A5 8A 8E 43 90 E 24 2 0 80 90 A C2 69 57 D3 2A AC Hello
    UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU
    1E 0 C D1 0 7 0 1 0 3 0 1 60 0 72 D5
    wait for answer
    8E 43 90 4 6A 5 84 A0 56 8 14 2D 40 90 13 3D BA 41 BF 10 4 A 81 80 22 F4 8E 43 D0 1 81 34 D0 97 8F 23 90 E 34 7 C0 A0 90 5 C2 69 8E 93 29 92 A6 5 9A 55 48 26 C8 45 9B 56 25 10 29 8E 43 90 E 24 2 0 80 90 A C2 69 57 D3 2A 64 99 27 53 B6 60 91 41 84 6A 55 9B 42 D5 2A 82 99 A7 74 5 A 85 43 8 24 2 0 80 FF
    =====================
    Mehdi

    • Alex says:

      Hi Mehdi,

      I haven’t seen that happen before but the output is sort of consistent. You mentioned that you use 2 serial ports, can you just try using 1 serial port instead of 2 – hook it up to the Arduino (pin 0 and 1)?

      • Mehdi says:

        Hi, thanks for your answer.
        I already tested that before but I get problem uploading firmware and with the arduino serial monitor. But, but… That was the problem, I finally get the software version!
        So many thanks!
        Next step, SMS :)
        Mehdi

        • Mehdi says:

          Hi once more,
          As I’m not able to comunicate with the nokia 3310, I’m trying to use your code to send SMS. For what I understand, I changed the SMSC number to
          SMSC[] = {0×07, 0×91, 0×33, 0×06, 0×09, 0×10, 0×93, 0×00, 0×00, 0×00, 0×00, 0×00}; for the french SFR operator (+33 60 90 01 39 0)
          and the destination number to +33 6 87 77 28 75
          RecipientNo[] = {0x0A, 0xA1, 0×60, 0×78, 0×77, 0×82, 0×57};
          But the phone doesn’t answer anything
          Here is the decoded frame sent by your script
          FrameType : cable
          computer ==> phone
          Command : 2 => sendSms
          data : header => 0, 1, 0
          ,
          sendSms => 1, 2, 0
          ,
          smsc => 91, 33, 6, 9, 10, 93, 0, 0
          ,
          tpduMessageType => 0×0,
          tpduMessageReference => 0×0,
          tpduProtocolId => 0×0,
          tpduDataCoding => 0×15,
          tpduMessageSize => 0×0,
          destPhone => 0
          ,
          validityPeriod => 0×33,
          serviceTimeStamp => a, a1, 60, 78, 77, 82, 57, 0
          ,

          raw : 0x1e, 0×0, 0xc, 0×2, 0×0, 0×59, 0×0, 0×1, 0×0, 0×1, 0×2, 0×0, 0×7, 0×91, 0×33, 0×6, 0×9, 0×10, 0×93, 0×0, 0×0, 0×0, 0×0, 0×0, 0×15, 0×0, 0×0, 0×0, 0×33, 0xa, 0xa1, 0×60, 0×78, 0×77, 0×82, 0×57, 0×0, 0×0, 0×0, 0×0, 0×0, 0xa7, 0×0, 0×0, 0×0, 0×0, 0×0, 0×0, 0xc8, 0×34, 0×28, 0xc8, 0×66, 0xbb, 0×40, 0×54, 0×74, 0x7a, 0xe, 0x6a, 0×97, 0xe7, 0xf3, 0xf0, 0xb9, 0xc, 0xba, 0×87, 0xe7, 0xa0, 0×79, 0xd9, 0x4d, 0×7, 0xd1, 0xd1, 0xf2, 0×77, 0xfd, 0x8c, 0×6, 0×19, 0x5b, 0xc2, 0xfa, 0xdc, 0×5, 0x1a, 0xbe, 0xdf, 0xec, 0×50, 0×8, 0×1, 0×43, 0×0, 0xfb,
          <<<<<<<<<<<<<<<<
          Do you have any suggestion for me?
          Thanks anyway once more,
          Mehdi

          • Alex says:

            Hi Mehdi,

            I thought you did end up receiving good data from your phone? Do you receive anything back from the phone?

            Try changing RecipientNo[] = {0x0A, 0xA1, 0×60, 0×78, 0×77, 0×82, 0×57} to
            RecipientNo[] = {0x0A, 0xA1, 0×06, 0×78, 0×77, 0×82, 0×57}

            And perhaps try using 0×81 instead of 0xA1.

  17. Nayanajith says:

    Nice work. Got lots of things from your tutorial………
    Thaks Alex.

  18. […] library. Sources can be found Nokia3310_sendSmsSerial The hardware schematic can be found on the embedtronics.com […]

  19. ric says:

    hi,
    i am interested with How to use Nokia F-bus to send an SMS message…
    and i wanted my nokia 105 to inteface with my arduino uno or to my arduino mega,
    from where on Nokia 105 circuit board can i hook up my arduino?

    the circuit board of nokia 105 can be found in this webpage…..

    http://b.q12w.net/file/NOKIA-105.jpg

    ric

  20. 8bar says:

    The Embedtronics links are broken. Do you have an updated link?

  21. 8bar says:

    I found a Nokia 6190 on ebay and a Nokia DAU-9P data cable that fits the bottom of the phone. I’m starting to suspect that the data cable has some circuitry in it that converts the phone signals to RS232. Do you know if that is the case, and if so, how would I modify the connection from the data cable to the Arduino? Would I still need the voltage divider between the Nokia Rx and and Arduino Tx?

    • Alex says:

      Hi 8bar,

      Yes I would suspect that’s the case, probably the MAX232 which a lot of others have.
      It depends what you’d like to do, you could just solder your own wires to the end connector like I did and use the resistor divider for the Arduino TX – pin out here http://pinouts.ru/CellularPhones-Nokia/nokia_5110_6110_pinout.shtml.
      If you wanted to keep the cable then you cut it and hope that the RS232 circuit is on the PC connector (because it looks larger than usual) and then use the wires that way.
      Lastly if you wanted to keep the wire as is, then you’d need to use a MAX232 from the Arduino to the cable.

      Easiest option is number 1 or 2.

  22. Kathir says:

    I have a Nokia 6030.which series of phones should I choose from gnokii.org (Nokia 6510 or 7110 or 6110 or 3810 or 2110 series).Even I want this because of my security system project that will alert me of any intrusions.

  23. 8bar says:

    Thanks for the feedback, Alex. I like option 2 (so I don’t have to solder directly to the phone, nor add the complexity of the MAX232). The phone connector end of the cable is easily opened with screws, and it appears that there is no RS232 circuit there. The spring loaded contacts emerge from a small rectangular housing about 1/4″ x 3/8″ x 3/8″ in size, and the cable wires attach to the other end. I suppose if tiny surface mount components are used, it could be hidden inside there. Maybe a continuity checker would answer that.

  24. ISZ says:

    hello , :)
    i have i nokia 2300 … can this model phone support with this project…???
    how about coding arduino?

    thank you,
    ISZ

  25. ric says:

    0×07, 0×91,0×52,0×6, 0×07, 0×4, 0×09, 0×21, 0×16, 0xF1, 0×00, 0×00, 0×00, 0×00 for the number +256-704901261
    and for the receipient i have used 0x0A, 0×81, 0×70, 0×00, 0×66, 0×46, 0×64 for 0700666440

    what about this number what is the equivalent?
    +63 Philippines
    +639170000017 Globe telecom
    +639220001501 Sun

    sender number is
    +0639339874731
    and for the receipient is
    +639204790857

    • Alex says:

      Hi Ric,

      It would be:
      +0639339874731
      {0×08, 0×91, 0×60, 0×93, 0×33, 0×89, 0×47, 0×37, 0×01, 0×00, 0×00, 0×00}
      0×08 – because the number is 8 bytes long
      or it could be {0×07, 0×91, 0×36, 0×39, 0×93, 0×78, 0×74, 0×13, 0×00, 0×00, 0×00, 0×00}

      +639204790857
      {0x0A, 0×81, 0×36, 0×29, 0×40, 0×97, 0×80, 0×75}

  26. ric says:

    hi
    the cellphone that attached to my arduino is nokia 3310 cellnumber is 9204790857 smart gold and i want to send messages from nokia 3310 with arduino board code to my samsung cellphone number 0933987473 sun…..so my sketchcode is
    unsigned char SMSC[] ={0×07,0×91,0×36,0×29,0×02,0×00,0×51,0×10,0×00,0×10,0x1B,0×00,0×04};
    ////// 09 33 98 74 73 1
    unsigned char RecipientNo[] = {0x0C,0×91,0×60, 0×93, 0×33, 0×89, 0×47, 0×37, 0×01};
    nothing happen…

    • Alex says:

      Try this:
      SMSC: {0×07,0×91,0×36,0×29,0×02,0×00,0×51,0×10,0×00, 0×00, 0×00, 0×00};
      or SMSC: {0×07,0×91,0×36,0×29,0×02,0×00,0×51,0×10,0x0F, 0×00, 0×00, 0×00};

      RecipientNo[] = {0x0A, 0×81, 0×93, 0×33, 0×89, 0×47, 0×37, 0×01};
      or RecipientNo[] = {0x0A, 0×81, 0×60, 0×93, 0×33, 0×89, 0×47, 0×37, 0×01};

  27. Rishi says:

    Can you show a picture of how you achieved the connections to the f bus pinout of the mobile phone ? Did you solder the wires to the f bus pinout of the mobile phone ? And how did you manage to insert the phone battery after making the f bus connections ?

    • Alex says:

      I soldered the wires to the end of the connectors – near where the power plug goes, by doing that it doesn’t block the battery.

  28. ric says:

    unsigned char SMSC[] = {0×07,0×91,0×36,0×29,0×02,0×00,0×51,0×10,0×00,0×10,0x1B,0×04};
    unsigned char RecipientNo[] = {0x0C,0×91,0×36,0×39,0×93,0×78,0×74,0×13};
    the above number is now working for my nokia 3310 and the arduino, it send messages to my sumsung phone but the problem is that it takes too long or sometimes it will not send messages can i have to adjust the
    // Insert the frame values to prepare to send an SMS
    FBusFrame[0] = 0x1E;
    FBusFrame[1] = 0×00;
    FBusFrame[2] = 0x0C;
    FBusFrame[3] = 0×02;
    FBusFrame[4] = 0×00;
    FBusFrame[5] = FrameSize;
    FBusFrame[6] = 0×00;
    FBusFrame[7] = 0×01;
    FBusFrame[8] = 0×00;
    FBusFrame[9] = 0×01;
    FBusFrame[10] = 0×02;
    FBusFrame[11] = 0×00;
    what will is this normal? too long to reach the messages…

    • Alex says:

      That part is all normal, what you have to do is listen back for the replies to see if the SMS was sent or not.

      After a short time the phone will reply with a ‘Message sent’ frame shown below.

      Byte: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17
      Data: 1E 0C 00 02 00 09 01 08 00 02 64 12 00 01 44 00 3F 1E

      Byte 03: Message Type = 0×02 – SMS Handing
      Byte 04 & 05: Message Length = 0×0009 – 9 Bytes long
      Byte 09: 0×02 = Message Sent
      Byte 10 to 14: Unsure of what this is?

  29. Koen says:

    Alex, very interesting, but I’m not sure I understand it all just yet.
    I’m trying out the fbus_hw_sw_version sketch.
    When using the hardware serial on the Arduino to the Nokia, should I be seeing readable return hex text in the serial monitor?
    I do get something, but all unreadable characters, not the HEX codes.
    I’m using a Nokia 6310i wit an Arduino Ethernet.

  30. […] Links Nokia AT-Commands FBUS-communications-with-arduino Arduino-power-failure-alarm Insidegadgets.com: how-to-use-nokia-f-bus-to-send-an-sms-message […]

  31. Vladimir Kozlov says:

    “Edit 17/03/13: I found that you can only send 1 SMS with the code above. Trying to send a second SMS only gives back an acknowledgement of the packet we sent but

    Firstly, I want to say thank you for your publication.
    I am currently also doing a small project on the use of Nokia 3310. The experiments found that to send more than one SMS you need to do the following.
    The first package to your phone must have SeqNo = 0×60. Subsequent 41,42, … 47, 40, ….., etc.
    In this case, you can not send a request to HW & SW.
    Thanks again.

Leave a Reply