SIM800 series Bluetooth AT commands

Watch this video if you want to see the live demo,

 

SIM800 GSM module provides a set of AT commands which can be used for Scanning devices, Pairing with them using different authentication methods, Sending and receiving data using Bluetooth SPP profile, Controlling the smartphone by using Bluetooth headset profile etc.

Once you have basic AT commands working you can start, 

First thing you need to do is check if your firmware supports Bluetooth. I am using SIM800C in the demo and i have uploaded the Bluetooth supported firmware on it. 

Text in RED is typed by me and text in GREEN is the response from SIM800 module.

You will need this document for referring commands in details. SIM800 series bluetooth application note v1.04

Link to Application used in demo.


Checking if firmware is Bluetooth compatible

Check current firmware version

AT+CGMR

Revision:1418B02SIM800C24_BT

OK


Initialize Bluetooth 

Turn power ON

AT+BTPOWER=1

OK

Check the Bluetooth peripheral state and see if its idle ,Status 5 is idle, For other states refer SIM800 BT App note

AT+BTSTATUS?

+BTSTATUS: 5

OK


Scanning for devices

Scan for other visible bluetooth devices, In 1,20 , 1 means start scanning and 20 means stop scanning after 20 seconds. It will return detected devices with ID, MAC address, signal strengh value

AT+BTSCAN=1,20

OK

+BTSCAN: 0,1,”Ravi”,00:00:00:64:88:02,-79

+BTSCAN: 0,2,”Ravi-PC”,34:e6:ad:2c:5d:02,-70

+BTSCAN: 1      // This means scanning completed with status 1. Refer app note for other status values.  


Pairing with a scanned device

Pair with first device 0,1,:”Ravi” (My Android smartphone) . It gives back a response with paired device, You also need to confirm pairing on Handset side.

AT+BTPAIR=0,1

+BTPAIR: 1,”Ravi”,00:00:00:64:88:02

OK


Checking the paired devices and status of bluetooth 

Check the Bluetooth peripheral state and see if recently paired device is shown there with status P  , which means paired

AT+BTSTATUS?

+BTSTATUS: 5

+P: 1,”Ravi”,00:00:00:64:88:02

OK


Getting profiles supported by paired device 

Now check the profiles supported by paired device no 1 

AT+BTGETPROF=1

+BTGETPROF: 4,”SPP”

+BTGETPROF10,”PBAP

+BTGETPROF2,”HFP(AG)

OK


Connecting to a selected profile of a device

Now connect with the Paired profile no 4 of device no 1, In above case SPP profile of my smartphone

AT+BTCONNECT=1,4

OK

+BTCONNECT: 1,”Ravi”,00:00:00:64:88:02,”SPP”


Sending and receiving data in SPP profile 

Now If you send anything from the smartphone or any device connected on SPP profile then it is shown as below on terminal with received character count and device number from which it is received from. For demo i am using a App i developed for demonstration, See the video below for more details about App

++BTSPPDATA: 1,29,VALETRON: hello#anything#how#

Send data back to connected SPP device as shown below along character count of data to be sent, Wait for  > prompt from device and then enter data.

AT+BTSPPSEND=10

Hello123# 

SEND OK

Check this link for the Android app i used for demo. 


Pairing configurations

SIM800 bluetooth supports 3 pairing configurations, Mode 0,1,2

 

 


Pairing configuration Mode 0 

SIM800 will be set to authenticate with Random PIN-code and when a pairing request comes in, we need to accept the pairing request using command shown below, once you accept it the module is automatically connected. 

Setting pairing configuration to mode 0 

AT+BTPAIRCFG=0

OK

Check if mode set properly

AT+BTPAIRCFG?

+BTPAIRCFG: 0

OK 

 We need to reboot the modules bluetooth after pairing configuration change

Turn power OFF

AT+BTPOWER=1

OK

Turn power ON

AT+BTPOWER=0 

OK

When you click on pair in Smartphone the below +BTPAIRING URC will be reported with random PIN, and you need to accept it using command AT+BTPAIR=1,1

+BTPAIRING:1,“Ravi”,00:00:00:64:88:02,298613

AT+BTPAIR=1,1 

OK 

The following URC will be reported which indicates that the device Ravi with given MAC address is paired and assigned device no 1

+BTPAIR:1,“Ravi”,00:00:00:64:88:02

The following URC will be reported which indicates that the device Ravi is connected to Headphone profile of SIM800 

+BTCONNECT:1,“Ravi”,00:00:00:64:88:02,”HFP”


Pairing configuration Mode 1

SIM800 will be set to authenticate with  predefined PIN-code and when a device wants to pair with SIM800 then it needs to enter this password

Make sure you unpair the device if its already paired using command,

AT+BTUNPAIR=1

OK

Setting pairing configuration to mode 1 with a password 5555 that needs to be entered by other device trying to pair, like the smartphone

AT+BTPAIRCFG=1,5555

OK

Check if mode set properly

AT+BTPAIRCFG?

+BTPAIRCFG: 1,5555

OK

We need to reboot the modules bluetooth after pairing configuration change

Turn power OFF

AT+BTPOWER=1

OK

Turn power ON

AT+BTPOWER=0

OK

When you click on pair in your Smartphone and enter the correct password, the below +BTPAIR and +BTCONNECT URC will be reported indicating that the module is connected to Smarphones headset profile. Here we need not enter any command to confirm pairing, its automatically done by module

The following URC will be reported which indicates that the device Ravi with given MAC address is paired and assigned device no 1

+BTPAIR:1,“Ravi”,00:00:00:64:88:02

The following URC will be reported which indicates that the device Ravi is connected to Headphone profile of SIM800 

+BTCONNECT:1,“Ravi”,00:00:00:64:88:02,”HFP”


Pairing configuration Mode 2

 SIM800 will be set to authenticate with Random PIN-code and when a pairing request comes in, it is automatically acknowledged by SIM800 and we need not do anything accept the pairing request

AT+BTPAIRCFG=2

OK

Check if mode set properly

AT+BTPAIRCFG?

+BTPAIRCFG: 2

OK

We need to reboot the modules bluetooth after pairing configuration change

Turn power OFF

AT+BTPOWER=1

OK

Turn power ON

AT+BTPOWER=0

OK

When you click on pair in Smartphone the below +BTPAIRING URC will be reported with random PIN, the below +BTPAIR and +BTCONNECT URC will be reported indicating that the module is connected to Smarphone’s headset profile. Here we need not enter any command to confirm pairing, its automatically done by module

The following URC will be reported which indicates that the device Ravi with given MAC address is paired and assigned device no 1

+BTPAIR:1,“Ravi”,00:00:00:64:88:02

The following URC will be reported which indicates that the device Ravi is connected to Headphone profile of SIM800 

+BTCONNECT:1,“Ravi”,00:00:00:64:88:02,”HFP”


Commands used to control calls when SIM800 is connected as bluetooth headset

Make a call 

AT+BTATD=9916247258;

OK

Hangup a call 

AT+BTATH

OK

Answer a incoming call 

AT+BTATH

OK


Disconnecting from a connected bluetooth device

Disconnect from device no 1

AT+BTDISCONN=1

OK

+BTDSICONN:1,“Ravi”,00:00:00:64:88:02,”HFP” 


Hope it helps someone. 

 

Also see:

2 thoughts on “SIM800 series Bluetooth AT commands”

  1. Hi Ravi, thanks for the movies you posted.
    I have a GSM mod. SIM800C and I need to communicate with it via Bluetooth. The BT firmware version is as follows: 1418B02SIM800C24_BT.
    I followed your instructions carefully but when I run the command “AT+BTGETPROF = 1”, the “SPP” profile does not appear in the list:

    answare) +BTPAIRING: “HUAWEI CUN L21″,da:a1:48:d5:f6:25,049669
    sendcmd) AT+BTPAIR=1,1
    answare) OK
    answare) +BTPAIR: 1,”HUAWEI CUN L21″,da:a1:48:d5:f6:25
    sendcmd) AT+BTGETPROF=1
    answare) +BTGETPROF: 10,”PBAP”
    answare) +BTGETPROF: 2,”HFP (AG)”
    answare) OK

    Please Ravi, can you tell me why SPP doesn’t appear?
    Thank you very much for your cooperation
    Antonio from Italy

Leave a Comment