HM-10 As An iBeacon

What is a iBeacon

You can think of a iBeacon as an electronic light house. It simply sends out timed signal letting people know it is there. When an app on a mobile device constantly finds a signal it can react is a specific way. For example, in a shop a special discount may be offered as you approach a pair of shoes. Or, matching chairs may be offered when you approach a sofa. Or, the lights turn on when you enter a room. iBeacons themself are not smart, they rely on an external device to react when a signal is received. of course, this does mean the device has to be looking for the signal.

The iBeacon signal consists of “advertisements”. These are small packets of data sent out at regular intervals. The advertisement has a standard format and includes 4 parts; UUID, Major, Minor, and transmit power.

UUID:
This is a 16 byte value or string. The UUID is generally unique to a manufacturer or company. It can be used to group together related Beacons as well. For example, all Beacons in one store may all have the same UUID.

Major:
This is a 2 byte value or string that can be used to create a small group of more closely related Beacons. For example, the furniture department.

Minor:
Is another 2 byte value or string and is meant to identify individual beacons. This could be used to identify which sofa the shopper is standing in front of.

Transmit Power/Measured Power:
This is not the signal strength as read by the mobile device. It is instead what the strength of the signal should be at 1m from the Beacon. Using the transmit value with the actual signal strength allows the mobile device to calculate the distance from the Beacon. In reality the Transmit power varies from manufacture to manufacture and is sometimes not very accurate, especially on the cheaper modules like the HM-10. My mobile phone is about 6 inches from the HM-10 and the Beacon scanner is telling me the HM-10 about a metre away… Luckily you can change the TX value using the AT+MEAS command.

Turning the HM-10 in to an iBeacon

For the following, I am using a HM-10 with V702 firmware. This means the baud rate is 115200 and I can use line end characters at the end of the AT commands.

To turn the HM-10 in to an iBeacon all that is required is “AT+IBEA1”. This puts the HM-10 in to iBeacon mode using the default settings:

Scanning for iBeacons

To scan for iBeacons you need a mobile device and a beacon scanner app. I am using Android with iBeacon & Eddystone Scanner by flurp laboratories but there are many other apps.

HM-10_iBeacon_002_scanner

The first page lists all found iBeacons. The second page is a more detailed view for each iBeacon. Here we can see the HM-10 with the default settings.

UUID: 74278BDA-B644-4520-8F0C-720EAF059935.
Major: 65504 (0xFFE0)
Minor: 65505 (0xFFE1)
TX: -59 dBm

All these can be changed if required.

HM-10 iBeacon Commands

AT+IBEA1Turn on iBeacon mode 
AT+IBEA0Turn off iBeacon mode 
AT+IBEA?Query the iBeacon modeReturns OK+Get:1 if the HM-10 is in iBeacon mode and OK+Get:0 if it is not.
AT+MARJxxxxxxSet the iBeacon Marjor value/stringAT+MARJ0xFFE0 sets the Major value to 0xFFE0.
Valid values are 0x0001 to 0xFFFE
AT+MARJ?Query the iBeacon Major value/stringReturns OK+Get:0xFFE0 (or what ever the Major value is)
AT+MINOxxxxxxSet the module iBeacon Marjor versionAT+MINO0xFFE1 sets the Minor value to 0xFFE1.
Valid values are 0x0001 to 0xFFFE
AT+MINO?Query iBeacon Minor value/stringReturns OK+Get:0xFFE1 (or what ever the Minor value is)
AT+MEASxxxxSet the TX/transmit valueAT+MEAS allows you to calibrate the measured power value. The default is 0xC5.
Valid values are 0x01 to 0xFF

 
Setting a new UUID is done in segments. The UUID is divided in to 4 parts and each part is changed separately using; AT+IBE0, AT+IBE1, AT+IBE2, and AT+IBE3.

The default iBeacon UUID is: 74278BDA-B644-4520-8F0C-720EAF059935. This is split up as:
Part 1 = 74278BDA
Part 2 = B6444520 (no hyphen)
Part 3 = 8F0C720E (no hyphen)
Part 4 = AF059935

AT+IBE0xxxxxxxxSet UUIDAT+IBE012345678 sets the UUID first part to 12345678.
AT+IBE1xxxxxxxxSet UUIDAT+IBE122334455 sets the UUID second part to 22334455.
AT+IBE2xxxxxxxxSet UUIDAT+IBE2ABCDABCD sets the UUID third part to ABCDABCD.
AT+IBE3xxxxxxxxSet UUIDAT+IBE3EEFFEEFF sets the UUID forth part to EEFFEEFF.
AT+IBE0?Query the UUID first partReturns OK+Get:0x74278BDA (or what ever the UUID first part has been set to).
AT+IBE1?Query the UUID second partReturns OK+Get:0xB6444520 (or what ever the UUID second part has been set to).
AT+IBE2?Query the UUID third partReturns OK+Get:0x8F0C720E (or what ever the UUID third part has been set to).
AT+IBE3?Query the UUID forth partReturns OK+Get:0xAF059935 (or what ever the UUID forth part has been set to).

Other Commands

AT+ADVI?Query the advertising intervalReturns OK+Get:x where x is 0 to F.
AT+ADVIxSet the advertising intervalx is 0 to F

– 0: 100ms
– 1: 252.5ms
– 2: 211.25ms
– 3: 318.75ms
– 4: 417.50ms
– 5: 546.25ms
– 6: 760.00ms
– 7: 852,50ms
– 8: 1022.5ms
– 9: 1285ms
– A: 2000ms
– B: 3000ms
– C: 4000ms
– D: 5000ms
– E: 6000ms
– F: 7000ms

The default for the HM-10 is 0 (100ms). Using a slower interval reduces the amount of power used.

AT+ADTY?Query the advertising typeReturns OK+Get:x where x is 0 to 3.
AT+ADTYxSet the advertising typex is 0 to 3

– 0: Advertising ScanResponse, Connectable
– 1: Only allow last device connect in 1.28 seconds
– 2: Only allow Advertising and ScanResponse.
– 3: Only allow Advertising

The default is 0.

Option 3, only allow Advertising, disables connections and lowers the ampout of power used. This can be important when using battery operated iBeacons. When in iBeacon modes 0 and 1 the HM-10 is still connectable and data can be transmitted using FFE1 as usual.

AT+DELOxSet the iBeacon deploy modeReturns OK+DELOx where x is 1 or 2.
1: Broadcast and scan
2: Only allow broadcast only

Option 2 puts the HM-10 in broadcast mode only. This save quite a lot of power and this option should be used if you are creating a simply iBeacon. When using AT+DELO2 the HM-10 will remain boradcast only until the next power cycle (you need to remove power to reset it).

Low power iBeacon

To create a low power iBeacon:
– reduce the advertising invterval as much as possible using AT+ADVIx.
– make it non connectable using AT+ADTY3
– set it to broadcast only using AT+DELO2

When setting up a new iBeacon it is probably wise to reset the HM-10 after all the commands have been entered using AT+RESET.

6 thoughts on “HM-10 As An iBeacon”

    • Please be aware I haven’t used the HM-10 with this kind of beacon so the below are my thoughts only.

      The HM-10 is very limited in what it can do, and, in my opinion, does not represent true BLE. As a basic beacon scanner it should be OK but you may have issues if you want to connect to the beacon.

      In this case I would recommend another nRF module rather than the HM-10. One where you can create services and characteristics. Something like the one used in this video: https://www.youtube.com/watch?v=9NnIxLxbbnM

      Reply
  1. HELLO
    I USED THE AT COMMAND AT+ADTY1 ON HM-10 MODULE WITH ARDUINO AND NOW I CAN`T SEND AT COMMAND ANYMORE. THE HM-10 SEEM TO BE IN A BEACON MODE. IS THERE A WAY TO MAKE A RESET FACTORY OR COME BACK TO ADTY0.
    THANKS IN ADVANCE

    Reply
    • I finally found a solution but not easy. I have to use my iphone who was prg to auto connect. And i write a sketch on arduino to send a long string 80 car or more to wake up de slave and with chance my iphone connect to the module and i was able to AT+RENEW.
      using AT+ADTY1 WITH AT+PWRM0, NOT A GOOD CHOICE.

      Reply
  2. Hello at all:)

    I am using the HM10 module as a beacon (not Ibeacon but simply just advertising every 500ms as ADVT3) and run into a problem.

    I want to save power and have set the module up with auto sleep with PWRM0. When I start the module it draws around 0,2mA but after a few seconds (or minutes) it suddenly takes 8mA and stays at that level until the next reset.

    Does someone know that issue and/or has a solution?
    Thanks

    Reply
  3. Hi,
    I am working on the smart parking system. Can I use HM-10 BLE as ibeacon for indoor navigation system?
    Kindly help. if you can share any similar kind of application for reference that’s would be great.
    Thanks in advance,
    Sanjeev

    Reply

Leave a Comment