Bluetooth Low-Power Learning

So…I have a project I’m developing that requires Bluetooth. Basically, it’s an app to control some hardware I built.

I had an old HC-06 Bluetooth module lying around and it worked great. Was easy to get setup and connected to my Teensy microcontroller…but it only worked with Android. My iOS devices could not even see it. I later found out is was working on Bluetooth 2.0 and NOT the required 4.0 (BLE – Bluetooth Low Energy) required by iOS.

First of all, why do you need a BLE with iOS? Because they want a cut of the Bluetooth market and have specific requirements that are NOT part of the standard Bluetooth spec (what? Apple is doing their own thing? Say it ain’t so!!!!) However, BLE seems to get around this requirement. Ok, no big deal.

I found a device advertised as an HM-10 BLE module for Arduino that would connect to Android and iOS. Great! And it was inexpensive. Even better! It arrived after a few days and I was excited to hook it up and start testing my app on iOS.

However…

My iPad Mini could not see it. What?

My Android could see it, but could not connect to it. Double what??

I decided to hook up the module to the Arduino and wrote a quick little sketch to let me put it in AT mode (programming mode) and see if I needed to change any settings. That worked fine. Could communicate with it, but for some reason some of the AT commands would not work. So I typed in

AT+HELP
********************************************************************
* Command             Description			           *
* ---------------------------------------------------------------- *
* AT                  Check if the command terminal work normally  *
* AT+RESET            Software reboot				   *
* AT+VERSION          Get firmware, bluetooth, HCI and LMP version *
* AT+HELP             List all the commands		           *
* AT+NAME             Get/Set local device name                    *
* AT+PIN              Get/Set pin code for pairing                 *
* AT+PASS             Get/Set pin code for pairing                 *
* AT+BAUD             Get/Set baud rate		                   *
* AT+LADDR            Get local bluetooth address		   *
* AT+ADDR             Get local bluetooth address		   *
* AT+DEFAULT          Restore factory default			   *
* AT+RENEW            Restore factory default			   *
* AT+STATE            Get current state				   *
* AT+PWRM             Get/Set power on mode(low power) 		   *
* AT+POWE             Get/Set RF transmit power 		   *
* AT+SLEEP            Sleep mode 		                   *
* AT+ROLE             Get/Set current role.	                   *
* AT+PARI             Get/Set UART parity bit.                     *
* AT+STOP             Get/Set UART stop bit.                       *
* AT+START            System start working.			   *
* AT+IMME             System wait for command when power on.	   *
* AT+IBEA             Switch iBeacon mode.	                   *
* AT+IBE0             Set iBeacon UUID 0.            	           *
* AT+IBE1             Set iBeacon UUID 1.            	           *
* AT+IBE2             Set iBeacon UUID 2.            	           *
* AT+IBE3             Set iBeacon UUID 3.            	           *
* AT+MARJ             Set iBeacon MARJ .            	           *
* AT+MINO             Set iBeacon MINO .            	           *
* AT+MEA              Set iBeacon MEA .            	           *
* AT+NOTI             Notify connection event .                    *
* AT+UUID             Get/Set system SERVER_UUID .            	   *
* AT+CHAR             Get/Set system CHAR_UUID .            	   *
* -----------------------------------------------------------------*
* Note: (M) = The command support slave mode only. 		   *
* For more information, please visit http://www.bolutek.com        *
* Copyright@2013 www.bolutek.com. All rights reserved.		   *
********************************************************************

A help screen came back…and a lot of AT commands were not listed. At the bottom was “bolutek.com.” Crap.

After some more research, I found out I have a CC41A, NOT an HM-10. Then I read all about the “Clone Wars” regarding the HM-10 and all the manufacturers ripping it off. That research also yielded ways to tell if you have the original HM-10 (based on the TI CC2540 or CC2541 chipset.) The CC41A is also missing a crystal oscillator (the HM-10 has 2.)

In the meantime, I found an original HM-10 (at 3X the price of the clone, of course…but…worth it!)

However, when I hooked it up…SAME THING! Android could see but not connect, iOS could not even see it! WTH?!

After some digging around, I learned that BLE works differently from Bluetooth 2.0. First of all, no contracts. That means I don’t have to pair it to a device ahead of time. It’s all done “on-the-fly” so to speak.

I fired up my app and had it scan for BLE devices. Voila! It was there! On both iOS and Android. Lesson learned.

Here are two major ways to tell the clones from the righteous HM-10:

1. Second oscillator missing. This is a dead give away.  The image below shows two metallic rectangles above the black chip.  Those are the oscillators.  You’ll notice in the other two boards, the second one is missing.

2. Large chip on the board should say CC2541 or CC2540 (I know, this can be faked as well, but so far have not had that experience.)  Even if the chip DOES say CC2541 or CC2540, if the other oscillator is missing…it’s a clone.

HM-10-comparison

So, if you ever find yourself in need of something like this…beware. ALL of them are advertised as HM-10 with the CC2541/CC2540 chipsets. So far both have worked fine for me. If I ever have a more complicated project, I may stick with the HM10 as it has more capabilities.

Leave a Reply

Your email address will not be published. Required fields are marked *