iBeacon using an HM10 or CC41A Bluetooth 4 Unit

Download the Sketch from my GitHub here.

One of the reasons I wanted an HM10 Bluetooth board was to try making an iBeacon. These have been in the news a lot recently since Apple announced the technology. Google produced their own version called Eddystone.

An iBeacon transmits a unique identification at a regular interval, they can be used to provide information about goods and services as you pass through the relevant department, or even track the route shoppers use as they pass through a Department Store. Using vey low power usage BLE devices can operate for months on a small battery.

An Arduino can be used to set up one of these devices, and once programmed the Arduino can be removed and the Bluetooth unit simply connected to a power source and left to transmit its message.

There is a big difference in the commands available on the HM10 and its clone the Cc41A, and the instructions here will work on both devices, but will not give the most power efficient settings. The transmitting power can be adjusted to give a range in open air of about 110metres, although that probably drops to about 30 metres or so in a building.

The list of commands for the CC41A is shown here. The device is missing a number of commands available on the HM10.

The CC41A is a 3 volt device, connect the Gnd to Arduino Gnd, the Vcc to Arduino 3 volts. The Tx and Rx need to be connected through 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 shown below and switch to the Serial Monitor. Make sure NL/CR is selected and the Baud rate is set to 9600. (If the HM10 is used the select No Line Ending). Enter AT and you should see OK displayed, now enter AT+RENEW followed by AT+RESET. The device is now reset to factory settings.

Now enter the following,

AT+MARJ0x1234,  Set iBeacon Major number to 0x1234 (hexadecimal).

AT+MINO0xFA01,  Set iBeacon Minor number to 0xFA01 (hexadecimal)

AT+ADVI5, Set advertising interval to 5 (546.25 milliseconds)

AT+NAMEYOURNAME, identifies this beacon

AT+IBEA1 Enable iBeacon mode


Install an iBeacon scanner on your phone or other device (I use iBeacon Scanner for my Android phone). Apply power to the Bluetooth device and start the scanner, information from the iBeacon, including the distance from the beacon, will be shown.

I have seen some information that suggests the latest firmware for the HM10 can be used as a scanner, but the CC41A does not seem to be able to to do this.

BLE CC41A Bluetooth
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
#include <SoftwareSerial.h>
SoftwareSerial bluetooth(2, 3); // RX, TX

void setup()
// Start the hardware serial port
pinMode(13, OUTPUT); // onboard LED
digitalWrite(13, LOW); // switch OFF LED

void loop()
// while there is data coming in, read it
// and send to the hardware serial port:
while (bluetooth.available() > 0) {
char inByte = bluetooth.read();

// Read user input if available.
if (Serial.available()){
delay(10); // The DELAY!


10 thoughts on “iBeacon using an HM10 or CC41A Bluetooth 4 Unit”

  1. Thanks for the interesting article, especially for pointing out the differences between HM-10 and CC-41A. I am owner of few of the latter modules CC-41A and I was able to communicate with them using a HM-10 Bluetooth serial communication app for iPhone. I was also able to send the iBeacon setup sequence with the following AT commands (as advised by Bolutek):
    1. AT+DEFAULT\r\n
    2. AT+RESET\r\n
    3. AT\r\n ( wait for ok, default baud rate is 9600 8N1 )
    4. AT+MARJ0x1234\r\n (Set iBeacon Major number to 0x1234 (hexadecimal) )
    5. AT+MINO0xFA01\r\n (Set iBeacon Minor number to 0xFA01 (hexadecimal))
    6. AT+ADVI5\r\n (Set advertising interval to 5 (546.25 milliseconds)).
    7. AT+NAMEDOPEY\r\n (Set HM-10 module name to DOPEY. Make this unique.)
    8. AT+PWRM0 (Enable auto-sleep. This reduces power from 8 to 0.18 mA)
    9. AT+IBEA1 (Enable iBeacon mode )
    10. AT+RESET (Reboot)

    However, I cannot detect these modules as iBeacon using different Beacon scanner and locate apps on my iPhone. I have double checked that the UUID is on the list over recognized UUIDs in the app, but nothing helps. Have anybody tried CC-41A as iBeacon and can you share what the correct AT command setup is?


    1. I purchased my CC 41A units in October 2015 and found that not all HM10 commands are supported by the CC41A. The easiest way to check if a command is supported is to send it and if no reply is received then the command is not supported. I found using the commands shown in the blog above set the CC41A into iBeacon mode every time.

      I could not find the iBeacon on my iPad, but was easily visible on a number of apps on my Android phone (my iPad is only version 2).

      Don’t forget, once set as an iBeacon it will not be visible if you try to search for Bluetooth devices. I have found the CC41A easier to use than HC05/06 and there is not much difference in price. I hope this helps.


      1. It is quite interesting that I can see the module as iBeacon on a Samsung Galaxy S4mini, running the Locate app from Radius networks. The same app from Radius networks for iOS running on iPhone 5s cannot discover the very same module. How can this be?

        The Android app can detect all iBeacons i.e. with arbitrary UUIDs, because all ID fields are left blank in the app. The iOS app comes with predefined UUIDs which can be detected, but I have checked that the UUID of the module corresponds to the UUID called Apple AirLocate. So there should be no difference in the behavior, but there is…


      2. I have spent most of the evening playing with this, but cannot get it to connect to my iPad. The UUID shown in every Android App is the same and is the default for an HM10 as well as being in the Apple approved list of UUIDs. A quick Google for iBeacon problems with iOS shows numerous results, most seem to blame iOS and the latest entry was dated August 2015.

        I am going to try to get hold of a genuine HM10 to see if that is any better.

        I have attached the list of CC 41A commands to my blog.


    2. Not sure if you sorted this already, but if you are using ios 8.x you need to allow the App to always have location access (also when not running) this made it work using the Radius Locate App on ios 8.3 (Ipad 4), could not see it before


  2. I am stuck trying to remove the CC41a from sleep mode. I tried the 80+ character trick, but it doesn’t work. Any suggestions?


    1. 1xxxxxxxxx2xxxxxxxxx3xxxxxxxxx4xxxxxxxxx5xxxxxxxxx6xxxxxxxxx7xxxxxxxxx8xxxxxxxxxAT+PWRM1\r\n

      this works for me – 80+ symbols(no at commands inside) followed by needed cmd
      just random line does not work, as it can go sleep before next cmd


  3. Hey. After using the paring code abc123 on my clone hm-10, it does not get a com port assigned. How can i get i have a com port. I’m on windows 7.


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 )

Connecting to %s

%d bloggers like this: