Comparing the HM10 and BLE CC41a Bluetooth 


These units will not connect to an HC05/HC06 and although it was visible to my Samsung Galaxy 5 it would not connect.

The HM10 has a crystal fitted, shown as a silver rectangle in the picture above, alongside the bottom four solder connections on the picture right. The CC41A does not have this crystal.

Download the Sketch from my GitHub here.

I saw a pair of HM 10 Bluetooth boards on eBay for less than £6 and purchased them. I wanted to try using Bluetooth 4 and to also use them as iBeacons. They arrived from Hong Kong in less than two weeks and I set about trying to get them to work. I used a simple sketch (shown below) that I use to set up HC05 Bluetooth boards. However, I just could not get them to work, I could see them on my Android phone but the would not connect. The units would not respond to AT being sent, I had set up the Serial Monitor to 9600 Baud and no Carriage Return or Line Feed.

Eventually I turned on NL/CR and sending AT gave the response OK. As I worked my way through the instruction set I found that not all seemed to work. The answer was that I had a BLE CC41A Bluetooth board which is a clone of the HM10. This Bluetooth requires LF/CR to be sent after a command, the default baud rate is 9600, the same as the HM10.

Other differences are that the commands can be in either uppercase or lowercase and the ? is not used, so to report the Baud rate AT+BAUD is used instead of AT+BAUD? The BLE CC41A has a limited command set and not all the HM10 commands are available. Typing in AT+HELP will print out a list of commands.

By default the CC41A is set as a Slave (ROLE=0) and the Baud Rate is 9600. It can be returned to this state at anytime by sending AT+RENEW and once OK has been received send AT+RESET. 

To set the CC41A as a Master, first reset to factory settings as shown above, although this is not strictly necessary at least you know where you are starting from, then send AT+INQ and wait for a reply. The CC41A will report any Slave units it can find, giving each Slave a number. To connect to a Slave send AT+CONNn, where n is the number for the Slave. With just one other Bluetooth available this would be AT+CONN1. The units pair almost immediately with the LEDs on both units changing from flashing to solid. Unfortunately, unlike the HC05, the Cc41A has to be connected each time to the Slave, when power is removed.

The HM10 and CC41A are 3 volt devices, but because the power requirements are low it can be powered from the Arduino 3 volt pin. Use a Bi Directional Logic Level Converter, like this one here. I use Software Serial using pin 2 for Rx and pin 3 for Tx, remember the Arduino Rx is connected to the Bluetooth Tx and the Arduino Tx (pin 3) is connected to the Bluetooth Rx.

Upload the sketch below to both the Master and the Slave and leave the Slave running. Un Rem the lines on the Sketch on the Master Arduino and upload the modified Sketch, once it uploads switch the Serial Monitor on. After 20 seconds or so the Master should connect and the LEDs should remain lit.

/***********************************************************

BLE CC41A Bluetooth Master setup sketch
This is a clone of the HM10 BLE board
In the Serial Monitor ensure that 'Both NL and CR' is selected
Select a Baud Rate of 9600
enter the following commands into the MASTER unit
AT - should return OK
AT+RENEW - restores to factory settings
AT+RESET - software reset
AT+ROLE1 - sets to Master
AT+INQ - searches for nearby Slave units
AT+CONN1 - connects to Slave Unit 1
************************************************************/
#include <SoftwareSerial.h>
SoftwareSerial bluetooth(2, 3); // RX, TX
void setup()
{
// Start the hardware serial port
Serial.begin(9600);
pinMode(13, OUTPUT); // onboard LED
digitalWrite(13, LOW); // switch OFF LED
bluetooth.begin(9600);
// un REM this to set up a Master and connect to a Slave
/*
Serial.println("BLE CC41A Bluetooth");
Serial.println("----------------------------------");
Serial.println("");
Serial.println("Trying to connect to Slave Bluetooth");
delay(1000);
bluetooth.println("AT"); // just a check
delay(2000);
bluetooth.println("AT+ROLE1"); // st up as Master
delay(2000);
bluetooth.println("AT+INQ"); // look for nearby Slave
delay(5000);
bluetooth.println("AT+CONN1"); // connect to it
*/
}
void loop()
{
bluetooth.listen();
// while there is data coming in, read it
// and send to the hardware serial port:
while (bluetooth.available() > 0) {
char inByte = bluetooth.read();
Serial.write(inByte);
}
// Read user input if available.
if (Serial.available()){
delay(10); // The DELAY!
bluetooth.write(Serial.read());
}
}

Advertisements

15 thoughts on “Comparing the HM10 and BLE CC41a Bluetooth ”

  1. Hi,
    Thank you for this article. I have the same problem. I bought an HM-10 module but it seems, I bought a CC41A module because I don’t have a crystal fitted. None AT commands work. I am sending throught an Arduino Micro and I’ve nothing in return. I can detect my module with my pc by Bluetooth. I connected a LED to my module and it turns on when I’m trying to connect. So I tried your program with NL/CR turning on, I sent “AT” but still no answer. So I don’t know if there are another problems or if I am making something bad.
    Sorry if I did some english mistakes.
    Regards,

    Like

      1. I think I found what is going wrong. I am working with an Arduno micro and I found the serial port works differently with the Micro vs the Nano.

        Like

  2. Hi and thank you for your helpful post!
    I have order one of these CC41a sold on a 6pin breadboard and I have a few question if somebody can help me it would be great 🙂
    First, do you have any idea of the use of the EN pin on those breadboard? It doesn’t seem to change anything if I put it HIGH or not.
    Secondly, I’m trying to use the CC41a as a master to detect a BLE tag of this kind : http://www.ebayitem.com/272049114844
    but when I do AT+INQ it only returns :
    “+INQS
    +INQE
    Devices Found 0”
    In the same time the tag is well seen by my smartphone.
    Does anybody have already succeed using AT+INQ command on those CC41A? Do you think it is because those BLE TAG are not compatible? Will it work with a real HM-10?
    Thank you in advance for your answer 🙂

    Like

  3. Hey rydepier!
    I found myself with the same problem as you, and I could sort it out with your method. The only thing I don´t get is, why won’t this work using the UART on the arduino UNO? You know, instead of using the software serial port. What is the difference here?

    Thanks a lot!

    Like

    1. There is no reason why you cannot use the hardware serial port on pins 0 and 1. I always use software serial wherever possible otherwise you need to disconnect pins 0 and 1 before you can upload a sketch. So the choice is yours, but you would have to change bluetooth.println() to Serial.println() and make sure you use Serial.begin(9600).

      Like

  4. Hey man! Thanks for the prompt reply. I thought the same, but I wasn´t being able to make it work. Until I switched Rx and Tx. It seems that for some reason, when you want to use the arduino just as a UART (disabling the chip), you need to swap those. It’s probably something very easy to figure out from the datasheet, but I hadn´t got the time, yet.
    Cheers!

    Like

  5. Thanks for all the information. I have two of the modules passing data back and forth. I would like to cause the modules to disconnect using the sketch. Is their a way to switch back to AT command mode? I tried to set /reset the EN pin. So far nothing will let me escape data mode after the connection is established. Power off seems to be my only option.

    Thanks for any info or leads,
    Norm

    Like

  6. Like you I thought I’d bought a HM10 and turned out to be CC41. Whilst experimenting, before I discovered it was a CC41, I set BAUD to 0 going on HM10 datasheet. Since then I am not able to communicate with it, even though I changed baud rate to 1200 which is BAUD0 on CC41. With baud set at 9600 get the serial output from code, and reports that it is searching for slave but does not respond.
    How can I reset to factory default, when it does not appear to be communicating with it?
    Luckily I bought 2 and have set this to Master and wanted to set otherone to slave.
    Rocky48

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s