Categories: Programming

To Control your mobile phone by AT Commands via Bluetooth (C#.NET)

Bluetooth is an easy way of transferring data and this wireless interface fully supports serial connection. This capability gives us the usage of bluetooth communcation for serial connection to a modem device. Modem devices can be controller via serial connection and they use AT Commands to be configured.
Mobile phones have their own modem chips on their motherboards. Also most of them is controllable via serial connection. This serial connection may be possible via usb cable emulating a serial connection or a bluetooth connection. Again it is controllable via AT Commands.

Most of smartphones’ modems are controllable via bluetooth. The easiest to control is Nokia Mobile Phones. They are perfectly capable of controllable via bluetooth.

First of all the first thing you need to do is, connect your mobile phone to your computer via bluetooth. See bluetooth serial connection service is active. After that, note that port number in device manager, then connect to that port via HyperTerminal or Putty Client. Send to your modem “AT” command, and see that “OK” response is came. If you see the OK it is OK and you can go on reading.

The screenshot above is my application that I’ve written to control my Nokia N97 Mobile Phone. But after I sold and buy an iPhone 4, it became a dream to control it via AT Commands.

Alghorithm is very easy at all.

There is a textbox at right and top. It contains the tel number to call. When you click the num pad buttons, its text property is being changed by numpad values and appends new numbers. (like textBox1.text+=”1″;)

When you click the “YES” button, begin call process command is sent to modem. (call the number written in textbox1)

serialPort1.Write(“ATD” + textBox1.Text + “;”  + Convert.ToChar(013));

When you click the “NO” button, hangup command is sent to modem. (AT+CHUP)

this.serialPort1.Write(“AT+CHUP” + Convert.ToChar(013));

“Clear” button just clear the text in written in textbox. (textBox1.text=””;)

To Answer a call is just a bit complicated. Because before you sent a answer command to modem, you have to check id there is an incoming call to answer or not. The way to do that is listen the modem periodically and wait for “RING +CLIP:TelNum”. This is the information that there is an incoming call and its caller id is TelNum. So When we see that information we can display that there is an incoming call on screen, and when “YES” button is clicked, we should send answer command to modem.

You can use standard microsoft’s bluetooth driver. You need to enable bluetooth serial port service.

3 commands that used in my code are;

  • ATD0telNum; It starts a voice call to a number “telNum”.
  • ATH+CHUP It ends the active call, all ignore the incoming call when it used.
  • ATA if you apply it when there is an incoming call, it answers the call.

There are lots of commands but most of them is not used at the moments. You can see the full command range for Nokia models. You can check it with the link below.

http://www.developer.nokia.com/Community/Wiki/AT_Commands

burakalakus

View Comments

  • I have to Generate Voice Call on iPhone(Non-Jailbroken) by AT Commands Via Bluetooth to read RSSI value of voice call networks. Please let me if any idea's for same.

    • It is not possible with non-jail broken iPhone for sure. In very early Ios releases it was possible with just jail broken phones. But now, as I know also it is not possible with jail broken iPhones also.

  • would you please share some of the code of recieving an incoming call and the notification leading up to the RING identification of the incoming call. Please

      • I hadn't shared full source code within my post. My objective was the the way of communicating with mobile device. But I will look at my code archive so .. I can update the post with it. Thanks for reading..

  • hey,
    I have connected my nokia 7210 to atmega128 using AUBTM 20. after the connection has been established, i try to send AT but the cellphone does nt accept any ascii characters and disconnects immediately. what shld i send so that the cellphone responds to AT commands?

      • i have found the problem..nokia offers two serial port services-1) nokia pc suite and 2) normal serial port using which u can control the modem.. both hv different channel numbers

        my module is connecting to ta channel corresponding to nokia pc suite..

        this is being done automatically by the module..there is no way to specify the channel to which i want to connect..

        In general..the module is connecting to the first 'Serial' service it finds..which may nt necessarily be the normal serial port over which we can control the modem..

        This is the reason why AT commands are nt being accepted by the cell phone..

        Is there any solution to it?

        • in your code, try each port, each time it fails you are going to realize it by receiving and exception or response from port. when you find the correct one write this to windows registery. so when you open your app again, it will connect the last success port.

      • how to make my phone open to AT commands so that it can be accessed as a modem via serial port over bluetooth?

Recent Posts

Avaya SAL Gateway

Avaya SAL Gateway (Secure Access Link) is a remote connectivity solution used by Avaya to provide remote support for its… Read More

5 years ago

Change Linux Timezone (RHEL / CentOS)

You can change Linux Timezone via bash command line easily. All Timezone information are stored in /usr/share/zoneinfo/./etc/localtime is symlink to… Read More

5 years ago

DALI Protocol (Digital Addressable Lighting Interface)

DALI is a communication protocol that is used for the automation of lighting, which is not new at all. It… Read More

5 years ago

Manchester Code Explained

Communication requires being in sync just like an orchestra. What happens when the bass guitar in band is not sync… Read More

5 years ago

Secure Server Access with SSH Key without Password

You have access to many different Linux / Unix servers during the day, you are in the IT department, remembering… Read More

8 years ago

iPad Mini in CAR explained

CAR PC in car is now old school and I decided to mount an iPad mini into the dashboard. (more…) Read More

11 years ago