Intro: Turn Your CC2541 Based HM-10 Bluetooth Smart Module Into an IBeacon
This tutorial walks through the steps for converting an HM-10 Bluetooth Smart (previously known as BLE) module as an iBeacon.
( Module image courtesy https://github.com/nickswalker/ble-dev-kit/wiki/HM-10-Pinout )
Step 1: Solder the Module Onto a General Purpose PCB
The first thing you need to do is to solder the module onto a general purpose PCB / matrix board / dot board. You could use wires as well ending in berg headers (male or female), if that works for you, but the PCB serves as a firm base for the arrangement. Breakout the following four signals from the CC2541 based HM-10 Bluetooth Smart Transceiver into pinouts.
Pin 1 -> Tx on HM-10
Pin 2 -> Rx on HM-10
Pin 12 -> 3.3V on HM-10
Pin 13 / Pin 14 -> GND on HM-10
(Pinout Image courtesy : https://urbanjack.wordpress.com/2014/04/27/how-to-build-you-own-bluetooth-low-energy-ibeacon-for-10-diy/ )
Step 2: Setup the Connection With the CP2102 USB to Serial Converter
The HM-10 works on 3.3V. The CP2102 USB to Serial converter is an ideal module for communicating with the
Make the following connections using jumper wires :
Pin 1 -> Tx on HM-10 ------------ Rx on CP2102
Pin 2 -> Rx on HM-10 ------------ Tx on CP2102
Pin 12 -> 3.3V on HM-10 ------------ 3.3V on CP2102
Pin 14 -> GND on HM-10 ------------ GND on CP2102
Step 3: Setup the Module As an IBeacon
You can use the serial terminal on the Arduino or any other serial terminal you are comfortable with to communicate with the HM-10. The CC2541 based HM-10 Bluetooth Smart Transceiver is programmed with the AT firmware, which means it can receive certain commands in a predefined format and act accordingly, without requiring any firmware programming.
You can communicate at a baud rate of 9600 with no newline characters set in your Serial Terminal.
You need to run the following set of commands in the serial monitor. After each command you should receive an "Ok" as a response.
AT+RENEW Restores factory defaults
AT+RESET Reboot HM-10 AT Wait for OK
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 Set HM-10 module name to YOURNAME. Make this unique.
AT+IBEA1 Enable iBeacon mode
Step 4: Optimisation
That's it, your CC2541 based HM-10 Bluetooth Smart Transceiver will now behave as an iBeacon.
To minimise power consumption, you can issue the following command :
This command will enable auto-sleep and reduce power consumption from 8 to 0.18 mA. The iBeacon will still keep on transmitting.
The HM-10 is a Bluetooth module and can be used as a transceiver. This command will make the HM-10 non-connectable to save power. This ensures that the communication features are disabled, and also that no client can connect to the module. This helps reduce power consumption further.
The HM-10 being a Bluetooth transceiver both broadcasts its presence and scans for other devices. The above command puts the iBeacon in broadcast-only mode to save power.
You can get the firmware to upgrade your iBeacon here :
The datasheet with a complete set of instructions is here : http://www.jnhuamao.cn/bluetooth40_en.zip
Step 5: Verification
You can check if your module is working by getting the iBeacon scanner app on Android here.
You can use that the app to check presence of the iBeacon, your distance from it, the UUID and other attributes of the beacon.
Have fun with your beacons !