BLE DBM01 communication with Android phone

DBM01 is a type of low energy data transmission Bluetooth module based on CC2540 from Texas Instruments. Combining the advantages of compact size, extra low power consumption, strong anti-interference and long communication distance, it is very suitable for short range wireless communication. The module integrates PCB antenna on board.

This tutorial explains how to communicate with Bluetooth 4.0 Module-DBM01 using an android phone. Here the BLE module is interfaced to PC

Module pinout

Pin Description


A Quick Look into UUIDs

Once you start working with BLE devices, you’ll quickly realize that UUIDs are critical. Services, Characteristics and other items use UUID to uniquely identify them. UUIDs are nothing more than unique 128-bit (16 byte) numbers : 0000FFF1-0000-1000-8000-00805F9B34FB.

It’s typical to arrange the UUID in the format above  4-2-2-2-6. Each pair of characters actually indicate hexadecimal number. To avoid constantly transmitting 16 bytes which can be wasteful (Bluetooth is very limited in the amount of data and 16 bytes are significant), the Bluetooth SIG has adopted a standard UUID base. This base forms the first 96 bits (12 bytes)  of the 128-bit UUID. The rest of the bits are defined by the Bluetooth SIG :

XXXXXXXX-0000-1000-8000-00805F9B34FB

The top 32-bits are up to you. For 16-bit UUIDs, the bottom 16-bits remain 0. For example the short form 16-bit UUID for the Heart Rate Service is : 0x180D. In reality this represents a 128-bit UUID : 0000180D-0000-1000-8000-00805F9B34FB. If you’re using existing services or profiles that were specified by the Bluetooth SIG, you can avoid using the full 128-bit UUID. But, custom services need a fully defined 128-bit UUID.

Power up the module. To communicate with PC, you can use a TTL-USB converter communicating in 3.3V level. Also tie  P0.6 to GND (for command mode) or to 3.3V (for transparent data mode).

If you are using a microcontroller communicating in 3.3V, you can directly interface the module to MCU, but for those MCUs with 5V levels, don’t forget to use a level converter to interface the module.

The module should be configured as peripheral and make all other necessary settings as shown below. You can read the current configurations using AT+CFG. The configurations can be changed using AT commands. All the required AT commands are available in the datasheet

Some commands of DBM01 module come into effect after executing AT+SAVE command but for other commands they need to execute another command AT+RESET after using command AT+SAVE in order to reset the module and let it work in new parameters.

To communicate with the module, you can use any Terminal software. The following illustration is done with RealTerm.

Initially select Display modes

Set Port parameters. Use the correct COM port by checking the device manager and use baud rate of 38400 (The default data rate of the module).

After making all the settings, click change (marked in red). Now the module gets connected to PC via the selected COMport and it will be indicated as shown in blue marking.

To communicate with BLE module from phone, we have used an application called BLE Scanner. You can get variety of other BLE applications from here

Opening window looks as shown below. You can use the scan icon in the top right corner to scan for the BLE devices in the vicinity. The BLE devices get listed as shown below

Click the Connect button to establish connection with the device.

When connection is established, you can see the connection status on RealTerm (+CONN: 1) as shown below. When it is disconnected, the status changes to +CONN: 0.

And the smartphone screen displays the various BLE services discovered

If you want to send data to DBM01 module, click  the DBM BLE, “0xFFF0” (Custom service) and choose the WRITE command “0xFFF1”.

Click W in the top right corner.

Click the space provided to type data

You can input the ASCII data directly in the pop-up window and click OK on the screen.

If you still keep the RealTerm running, the DBM01 module will receive the data sent by the phone and display it in the window as shown below. The received characters will be shown in hex format. The ASCII values of h, a & i in hexadecimal are 68, 61 & 69 respectively.

Now try sending some data from PC. Use AT+SEND=data. Type the characters in hex format. Here, the word “hello” is sent from PC. The ASCII values in hexadecimal are h – 68,  e – 65, l – 6C and o – 6F.

To check the data received, click DBM BLE “0xFFF0” and choose the READ command “0xFFF4”.  Click R in the top right corner. You can see the data sent from PC

Resources

Shop with us

Leave a Reply