Bluetooth BLE Adventures

 

HM-10 Bluetooth 4 BLE Modules

The HM-10 is Bluetooth 4.0 BLE module based on the TI CC2540 (the first incarnation of HM-10) or CC2541 Bluetooth SoC (System On Chip). There is also a smaller version of it, called HM-11. Both modules are made by Jinan Huamao and they are even FCC certified. The others, like HM-16 or HM-18 are not. I found an excellent web page for HM-10 done by Martyn Currey. There is certain level of criticism regarding the fact that Texas Instruments was using 35+ years old outdated MCS-51 8-bit core for the chip. And yes, they are not using it anymore for the newer chips. There is another issue with this chip, the MTU size is set to 20 bytes, L2CAP_MTU_SIZE is 23, 20 + 3 bytes of overhead. This can not be changed, as it is defined in TI BLE-STACK libraries distributed in binary format. And one more thing, the apps mentioned by Martyn working with HM-10 on Android platform. There are some for iPhone as well. Here is HM10 Bluetooth Serial Lite.

 

 

Fake HM-10

There are also so-called "fake" HM-10 modules available on eBay or AliExpress made by other companies. As Martin has pointed out the modules are not fakes, they have similar design and outline but running they own firmware. I think the right term here would be a clone, even though the module PCB layout is identical. Do we have copyrights for that? The second 32KHz crystal hasn't installed, see the picture below. Most likely it is done for the cost-cutting reasons, there is a place for it on module's PCB anyway. The crystal is required for maintaining CC2541 timing during sleep mode. Huamao claims that even if the 32KHz crystal is not installed the firmware is handling it during the start-up and switching to internal oscillator to operate the module properly. The clone's firmware is not good as the original one from Huamao, but it could be updated, see below. The modules are selling on AliExpress for $1.5 including S/H, which is even lower that the price of chip itself in large quantities from component distributors like Mouser or directly from TI! It looks like TI is selling it to them on "special" undisclosed prices.

 

Flashing a genuine HM-10 firmware on fake HM-10

Note that an update firmware posted on Huamao web site is not going to work. The full firmware includes 1K boot sector/loader which is not part of Ad Hoc update. And yet, the original firmware HM-10 V5.40 is available. Once you program the module with it you can apply updates later on. There are two ways of flashing it on CC2541 module. The first one requires SmartRF Flash Programmer from Texas Instruments. The programmer is available for $49 from the major component distributors but you can buy a clone from AliExpress for just $12. And yes, you have to convert bin file to hex to let the SmartRF programmer to recognize it. I found Srecord is very useful in the case. Here is the command:

srec_cat CC2541hm10v540.bin -Binary -o HMSoftHex.hex -Intel

The resistors and capacitor are optional...

CC Debugger

 

 

The second way is to use Arduino for programming HM-10 firmware. The procedure is describing here. The issue is that according to data sheet CC2541 pins are not 5V tolerant and Arduino UNO operates at 5V. Event though many folks successfully done this with UNO, it is definitely not recommended and you would need a voltage converter. You can easily build it yourself or use one of many available on the market. Here is SparkFun Logic Level Converter.

The other option would use Arduino ZERO, DUE or M0 with operating voltage 3.3V. Note that the original CCLoader sketch would not work on Arduino SAMD based boards. The boards have only Native USB port available. In this case you have to use SerialUSB instead of Serial in CCLoader sketch. And also provide Leonardo option 1 on command line.

 

The connection schematic for 3.3V based Arduino...

 

The procedure is simple and straightforward, see the output. Once you have programmed the module you can do the future firmware updates following the procedure on Huamao web site.

 

 

JDY-08 Bluetooth BLE Module

JDY-08 is another CC2541 based module made by Shenzhen City Hong Teng Yu Da Electronic Technology. What a name! No wonder they even do not have a web site. The second 32KHz crystal is populated! The module is FCC certified and sells on AliExpress for $1.58. The User Manual in English is available on FCC site and the original one is here. I haven't even tried to use it with the original firmware, got no faith in it. Just reprogrammed it with original HM-10. Here the schematic for this.

Note, after firmware update the module pin functions are different from the original JDY-08.

 

 

JDY-10 Bluetooth BLE Module

JDY-10 modules are not CC2541 based as you may see it sometimes advertised on AliExpress. The module using TLSR8266F512 Bluetooth 4.0 SoC with 32-bit core made by Telink. Xtensa® core? The module is not FCC certified even though the manufacturer claims it is. The original User Manual is here.

The service and display the characteristics. JDY-10 V2.4 shows two custom services, starting with 0000FFE0 and 0000FEE7.

 

 

DX-BT16 Bluetooth BLE 4.2 Module

DX-BT16 is based on Airoha AB1602 chip. The module has AB1602 Bluetooth chip and 24C32C 4K EPROM.

The chip is compliant with Bluetooth BLE 4.2 specification and based on MCS-80251 core. The 80251 core? It goes back to 1996! The module is a new product on the market and it got FCC approval as well. The original document in Chinese is here. Device is using only custom service with two custom characteristics to send and receive the data over the serial UART interface. That's it. Just pass-through mode!

Note, that HM-10 module is always using the MTU (maximum transmission unit) size of 20 bytes. Using packet length extension introduced only in Bluetooth 4.2.

 

DX-BT16 AT commands

 

AT+VERSION Get the firmware version number Returns: +VERSION=1.0
AT+NAME Query the name Returns the name the module broadcasts such as +NAME=BT16
AT+NAMEnewname Change the name of the module Changes the name broadcast by the module. For example AT+NAMEAlexBT changes the name to AlexBT. The maximum length for a new name is 18 characters. Returns OK
AT+RESET Restarts the module. Returns OK
Will close an active connection while restarting.
AT+BAUD Query the baud rate used for UART serial communication. Returns the value 0-4, for example, +BAUD:0
0 – 9600
1 – 19200
2 – 38400
3 – 57600
4 – 115200
The default setting is 0 – 9600.
AT+BAUDx Set the baud rate used for UART serial communication.

x is a value from 0 to 4, see the above.
Returns OK

AT+UUIDxxxxyyxxzzzz Set three UUIDs prefixes for custom service and characteristics Setting Custom Service to 0000xxxx-0000-1000-8000-00805-F9B34FB
Custom Read characteristic: 0000yyyy-0000-1000-8000-00805-F9B34FB
Custom Write characteristic: 0000zzzz-0000-1000-8000-00805-F9B34FB

Default is FFE0FFE1FFE2 and it stays for:
Custom Service: 0000FFE0-0000-1000-8000-00805-F9B34FB
Custom Read characteristic: 0000FFE1-0000-1000-8000-00805-F9B34FB
Custom Write characteristic: 0000FFE2-0000-1000-8000-00805-F9B34FB

 

WT51822-S4AT BLE 4.1 Module

The module developed by Wireless-Tag Technology and based on nRF51822 chip. Here is FCC certification page. There is AT command sequence with limited functionality. The device is small with 18.5 by 9.1mm size.