Sms via bluetooth

From Electriki
Jump to navigationJump to search


Well, what you need to do ? First you need to pair your phone with out pc using serial port emulation. Then you have to connect to the phone via hyperterminal or mimicom and by using AT Commands to send a message ;) IT's simple at that ;D


It's pretty simple in Windows OS. When you turn your bluetooth on pc on, pair your pc with your phone so you can browse phone's services. Then use serial port service what will connect to your phone. You should also get a message which com port is used as serial port emulation. Then simply start hyperterminal, set 9600bps, 8 bits, none parity, 1 stop bit and hardware flow control. Now enjoy using AT commands ( link at the bottom )

To see actual AT Commands, scroll down for section "Sending AT Commands"


Bluetooth pairing

What would be probably a good idea would be to find out, which channel do your phone uses for serial port emulation. To do that, you need to start bluetooth subsystem/daemons. I do i by running "/etc/rc.d/bluetooth" but what does it do is that it runs these daemons: pand dund rfcomm hidd bluetoothd Of course, don't forget to switch it on :D

To find out the channel we need, use
sdptool browse <bdaddr>

Configuring serial port connection

This is really simple step, all you need to do is to edit /etc/bluetooth/rfcomm.conf: ( now you will use the channel you were looking for at the beginning )

<enscript> rfcomm0 {

  1. # Automatically bind the device at startup
       bind yes;
  1. # Bluetooth address of the device
       device 00:22:FD:D6:29:77;
  1. # RFCOMM channel for the connection
       channel 3;
  1. # Description of the connection
       comment "Serial port emulation";

} </enscript>

Making serial port connection

Now is a good time to start/restart blutooth subsystems/daemons so new rfcommo configuration will take effect. First you need to find out bluetooth address of your phone, use "hcitool scan" to do that. You may want to start bluez-simple-agent (passkey-agent) which will help you to pair your devices To create serial link connection use:
rfcomm -i hciX connect <btaddr>

This should create a device /dev/rfcomm0. Also when you run rfcomm -a you should get an information that devices are connected.

Connecting to the phone

To connecto to the phone i used minicom. Just start the program and set 9600bps , 8 bits, no parity and 1 stop bit.and of course device /dev/rfcomm0. When connected you can begin using AT Commands.

Sending At Commands

There are basically two modes to work with SMS, i.e.:

   * PDU (Protocol Data Unit)
   * Text mode. 

A mobile phone internally uses PDU format. Developers normally uses text mode because it is easier to use. AT+CMGF is the command to set the mode.


sets the format to PDU mode.


sets the format to text mode.


queries the current format.

Although you can send SMS in PDU or text mode, it is easier to use text mode to type the message.

The following commands change the message format to text mode and send a text message.

> Hello World <Ctrl>+<Z>
+CMGS: 44


Note that <Ctrl>+<Z> has to be entered at the end of message to send the message. In minicom use <CTRL>+.

queries the current format.

Useful Links