0

members

Easy Basics: Project 028d Bluetooth 4.0 HM-10 BLE module

of Acoptex.com in UNO

Basics: Project 028d

Project name: Bluetooth 4.0 HM-10 BLE module

Tags: Arduino, Arduino Uno, Bluetooth module, Bluetooth 4.0, Bluetooth Low Energy, Bluetooth Classic, Bluetooth 4.0 Low Energy, Wibree, BLE.  BR/EDR, basic rate/enhanced data rate, HM-10 BLE module, AT-09 BLE module, AT commands, TI  CC2540, CC2541, iBeacon, CC41-A, BLE-CC41-A, how to update frimware HM-10 BLE module

Attachments: HM10BLEATcommssketch, BLEmoduleIdentificationsketch

In this project, you needed these parts :

1.Aruduino Uno R3 (you can also use the other version of Arduino)

2.Arduino IDE ( you can download it from here  )

3.Jumper cables

4. Breadboard

5. Bluetooth 4.0 HM-10 BLE module  1 pc

6. Resistor 2 pcs (1pc 1 KOhm and 1 pc 2 KOhm)

7. USB to TTL serial converter 1 pc

8. USB mini cable 1 pc (optional)

General

We will learn about Bluetooth 4.0 HM-10 BLE module, how to connect it to Arduino board, how to communicate with it using AT commands, how to update the firmware.

Understanding the USB to TTL converter

You can read more about them here.

Understanding the bluetooth module BLE

Bluetooth [WikiPedia] is a wireless technology standard for exchanging data over short distances (using short-wavelength UHF radio waves in the ISM band from 2.4 to 2.485 GHz) from fixed and mobile devices, and building personal area networks (PANs). Range is approximately 10 Meters (30 feet).

Bluetooth Low Energy (Bluetooth LE, BLE, formerly marketed as Bluetooth Smart) is a wireless personal area network technology designed and marketed by the Bluetooth Special Interest Group (Bluetooth SIG) aimed at novel applications in the healthcare, fitness, beacons, security, and home entertainment industries. Compared to Classic Bluetooth, Bluetooth Low Energy is intended to provide considerably reduced power consumption and cost while maintaining a similar communication range.

Mobile operating systems including iOS, Android, Windows Phone and BlackBerry, as well as macOS, Linux, Windows 8 and Windows 10, natively support Bluetooth Low Energy. The Bluetooth SIG predicts that by 2018 more than 90 percent of Bluetooth-enabled smartphones will support Bluetooth Low Energy.

Bluetooth Low Energy is not backward-compatible with the previous (often called "Classic") Bluetooth protocol. The Bluetooth 4.0 specification permits devices to implement either or both of the LE and Classic systems.

Bluetooth Low Energy uses the same 2.4 GHz radio frequencies as Classic Bluetooth, which allows dual-mode devices to share a single radio antenna. LE does, however, use a simpler modulation system.

Current mobile devices are commonly released with hardware and software support for both Classic Bluetooth and the Bluetooth Low Energy.

Operating systems:

  • iOS 5 and later - Apple iOS has supported BLE since the iPhone 4S exists.
  • Windows Phone 8.1
  • Windows 8 and later - supports Bluetooth 4.0 as a dual mode device (classic Bluetooth and Bluetooth Low Energy)
  • Android 4.3 and higher could support BLE. Not all Android devices on 4.3 are able to support BLE, just support classic Bluetooth only.
  • BlackBerry 10
  • Linux 3.4 and later through BlueZ 5.0. On Linux, the protocol stack BlueZ got an update to support BLE as well. The update does not mean that all Linux devices will support BLE now.
  • Unison OS 5.2

Bluetooth Low Energy technology operates in the same spectrum range (the 2.400–2.4835 GHz ISM band) as Classic Bluetooth technology, but uses a different set of channels. Instead of the Classic Bluetooth 79 1-MHz channels, Bluetooth Low Energy has 40 2-MHz channels. Within a channel, data is transmitted using Gaussian frequency shift modulation, similar to Classic Bluetooth's Basic Rate scheme. The bit rate is 1 Mbit/s, and the maximum transmit power is 10 mW.

BLE has a very fast time for pairing and reconnecting. It needs 6 ms and classic Bluetooth up to 6 seconds! Older BT chips will be too slow, thus unable to support the 6 ms BLE.

Bluetooth Low Energy was previously called Bluetooth Ultra Low Power, and in early 2001, was WiBree. “Wi” for wireless, and “Bree” for Bree in the Lord of the Rings. Bree was the town where the two major roads, the Great East Road and Greenway, crossed. Bluetooth Low Energy is an "always off" technology. It transmits short packages of data and is not able to support audio streaming. It is perfect for devices like a heart rate belt, mouse or keypad.

Bluetooth Low Energy is a part of Bluetooth 4.0. A dual mode device like a smartphone is able to support classic Bluetooth (BT) and Bluetooth Low Energy at the same time. Your smartphone could be connected to a Bluetooth 2.1 headset and stream audio, and at the same time be connected to a heart rate belt or other sensors on your bicycle.

Single mode devices like the heart rate belt will run in the Bluetooth Low Energy (BLE) peripheral mode and the smartphone will run in the central mode. In the classic Bluetooth this is still called master and slave.

In the new specification, BT 4.1 we have the hub. You will find such a hub in a smart watch for sports. The watch will work in the central mode in direction to the heart rate belt and other senors on the bike and in peripheral mode in direction to the smartphone. Professionals will not carry the heavy smartphone while riding the bike and will collect the data in smart watch. The watch will work in the peripheral mode during the transfer of the collected data to the smartphone. Often the data will be forwarded to a tablet or laptop. 

BLE 4.1 vs. BLE 4.2 - New Features and Advantages

Bluetooth 4.2 is an important update to the Bluetooth Core Specification with many new features and benefits designed specifically for Bluetooth Smart technology, and advantages when comparing Bluetooth 4.2 vs. Bluetooth 4.1 (also known as Bluetooth Low Energy or Bluetooth Smart).

Bluetooth 4.2 introduces several new features that improve speed and privacy over Bluetooth 4.1 but the main advantage is allowing chips to use Bluetooth over Internet Protocol version 6 (IPv6) for direct Internet access. With this, the possibilities expand beyond thoseof current designs and markets to include any type of Bluetooth device requiring speed and security in the IoT.

Why use BLE 4.2 instead of BLE 4.1? The Bluetooth SIG recommends implementing Bluetooth 4.2 in all new designs and requires the same qualification process as all other Bluetooth designs. Devices using Bluetooth Smart will be backward compatible with Bluetooth 4.0 or 4.1 devices that also implement the low energy features. Devices implementing the (BR/EDR) Core Configuration will be backward compatible to all adopted Bluetooth Core versions beginning with 1.1 that also implement Bluetooth BR/EDR.

Key Bluetooth 4.2 Features Not Available with Bluetooth 4.1:

IoT Capabilities:

  • Low-power IP (IPv6/6LoWPAN)
  • Bluetooth Smart Internet Gateways (GATT)

With BLE 4.2 Bluetooth Smart sensors can transmit data over the internet.

 Security:

  • LE Privacy 1.2
  • LE Secure Connections

With new, more power efficient and highly secure features, BLE 4.2 provides additional benefits allowing only trusted owners to track device location and confidently pair devices.  

Speed:

  • 250% Faster
  • 10x More Capacity

Compared to previous versions, BLE 4.2 enables 250% faster and more reliable over-the-air data transmission and 10x more packet capacity.

Designing with BLE 4.2 requires no mandatory features but, similar to previous versions, manufacturers are required to implement all errata applied in order to comply with the BLE 4.2 specifications.

BLE Modules

There are 2 ways BLE devices can talk to each other:

  • Broadcaster + Observer
  • Central + Peripheral

The HM-10 can use both methods.

With Broadcaster + Observer there isn’t a standard connection, the Broadcaster, usually some kind of sensor, sends out periodic signals (advertising packets) which the Observer listens for. The Broadcaster does not normally know if anything is listening or not.

The Central + Peripheral scenario is more like (but not exactly the same) as the classic connection. When the Central (master) device finds a Peripheral (slave) device it wants to connect to it initiates a connection and takes on the master role managing the connection and timings.

There are several types of BLE modules: HM-10, AT-09, BT05-A mini, HT-11 and so on.

Quite a lot BLE modules use the Texas Instruments (TI) CC2541 chip. This is the large black square in the middle of the module as can be seen in the photo above. This is the same as the CC2540 except it is lower power and has a shorter range. The CC254x is based on the 8051 and runs at 32MHz. This chip is programmed with matching firmware and it then implements the logical layers needed for the BLE protocol. The chip operates at voltages between 2V and 3.6V.

The CC2541 chip needs some passive components to work, such as oscillators, capacitors, resistors and an antenna. Those are provided by daughter board. The daughter board is soldered to the main board around the perimeter, via arc-like soldering pins.

The daughter board  - HM-10 module, made by Chinese “JNHuaMao Technology Company”, hence the HM initials. JNHuaMao makes different kinds of Bluetooth modules. In this case they designed the board and wrote a firmware for the TI chip to implement the needed functionality. The firmware determines the interface that will be used to control the module over serial connection.

Another Chinese company, “Bolutek Technology Co., Ltd“, decided to make a similar board. Their model is called CC41-A (CC41 from now on). It uses the same TI chip and similar board design (both are based on TI’s reference design for the chip). One difference that is easy to spot is that CC41 only has one oscillator where HM-10 has two. This is ok as one of the oscillators is optional per CC2541 specifications. 

As can be seen, the daughter boards are very similar. The pins are also compatible. Regardless of whether Bolutek copied the board design or made one of their own, many sellers were selling the CC41 module by using the HM-10 module name. This led to confusion and caused JNHuaMao to launch a campaign against clones posting various accusations. The bottom line is that these two daughter boards have the same TI chip, very similar board layout but different firmware.

Voltage-wise, the daughter boards have no voltage regulators and expect to be powered by 3.3V per chip specifications. Similarly, the serial logic expects 3.3V TTL levels.

You can find specification of HM-10 BLE module here.

You can also identify your BLE module by uploading to Arduino Uno this sketch. The wiring is the same as for using Arduino Uno board (see below). See more information here.

HM-10 Services and Characteristics

You can read more about them here.

Signals and connections of the bluetooth 4.0 HM-10 BLE module 

The HM-10 is a module that contains a BLE chip (a CC2540/CC2541). This module allows to perform serial communication with the BLE chip thanks to an Rx and a Tx pin. This module is also very similar to the AT-09 BLE module and is also compatible with it. 

There are 2 versions of the HM-10; the S version and the C version. There are slight component differences and the HM-10C does not have the pads along the bottom (26 pads instead of 34) but operationally they are the same. 

Pins:

When compared to other Bluetooth modules the pins are reversed and there is a BRK pin rather then a EN or KEY pin.

  • VCC: +3.3V Power
  • GND: Ground pin
  • TXD: Transmit Serial Data 
  • RXD: Receive Serial Data
  • STATE: Allows you to know current module connection state. The STATE pin is connected to the on board LED. Blinking when waiting for pairing or a connection. Solid on when connected and just after pairing.
  • BRK: Allows you to initiate a disconnect of the current connection.The BRK pin allows you to reset a connection. When there is an active connection, bring the BRK pin momentarily LOW breaks the connection. When there is no connection making the BRK HIGH or LOW has no effect. It's not strictly required but pulling the BRK pin HIGH for normal use will stop the pin floating.

BLE chip: CC2540 or CC2541 (we had CC2541)

The HM-10 is a Bluetooth 4.0 BLE module and not compatible with Bluetooth 2.0 or 2.1. 

Bluetooth name: We had HMSoft.

Specifications:

  • BT Version: Bluetooth Specification V4.0 BLE
  • Working frequency: 2.4GHz ISM band
  • Modulation method: GFSK(Gaussian Frequency Shift Keying)
  • RF Power: -23dbm, -6dbm, 0dbm, 6dbm
  • Speed: Asynchronous: 2-6K Bytes, Synchronous: 2-6K Bytes
  • Security: Authentication and encryption
  • Service: 0xFFE0 (Modifiable use AT+UUID command)
  • Characteristic: 0xFFE1 (Modifiable use AT+UUID command)
  • Characteristic: Notify and Write (Modifiable use AT+UUID command)
  • Power: +2.5V~3.3VDC 50mA
  • Power: Active state 8.5mA; Sleep state 50~200uA
  • Working temperature:–20 ~ +95 Centigrade
  • Size: HM-10 27mm x 13mm x 2.2 mm
  • Based on the CC2540 or the CC2541 chip

The HM-10 mounted to a breakout board that exposes the power and UART connections to breadboard friendly male pins. The breakout board includes a 3.3v power regulator that makes them 5V compatible. Please note that the RX pin is is still 3.3v and when using a 5v Arduino you should covert the Arduino’s 5v TX to 3.3v for the HM-10 RX.

The on board LED blinks when waiting for connection. It blinks half a second on, half a second off.The LED becomes solid on when a connection is made and returns to blinking when the connection is broken.The LED changes to solid on when pairing. After pairing it returns to flashing. It basically makes a connection to pair and so turns on the LED to show the connection status. After pairing is completed the connection is closed and the LED is turned off.

The behavior of the LED can be changed using the PIO1 command.“AT+PIO10″ – Default setting. When not connected the LED blinks 500ms on, 500ms off. When connected the LED is solid on.“AT+PIO11″ – When not connected the LED is off. When connected the LED is solid on.

AT command mode

AT command mode allows you to interrogate the Bluetooth module and to change some of the settings; things like the name, the baud rate, whether or not it operates in slave mode or master mode.

AT commands need to be uppercase. The HM-10 does not like line end characters (\r\n).

We had firmware HMSoft V540.

For a full list of AT commands see the official data sheets:

Default settings: 9600 baud rate, PIN - 000000.

Connecting to your Bluetooth 4.0 HM-10 BLE module via a phone

If you whipped out your phone to test which BLE module you have earlier, maybe you tried to pair it to see what would happen, and were suprised when it rejected your connection. Maybe you thought it didn't work and were very sad. Guess what, though? Your Bluetooth 4.0 HM-10 BLE module is working!

You just need an application to connect to it.

When in Master/Central mode it does not broadcast its name.

You can download Android based applications from Google play:

  • B-BLE (BLE4.0 Scan)
  • BLE Scanner
  • HM BLE Terminal
  • Bluetooth spp tools pro

You can download IOS based applications from Apple store:

  • BlueCap
  • BLE scanner
  • BLE Nearby
  • BLE Finder

Build the circuit

There are a couple of common ways to connect the Bluetooth 4.0 AT-09 BLE module to a PC/laptop:

1. Using USB to TTL converter with or without DTR Pin


2. Using Arduino Uno board


Step by Step instruction

1. Using USB to TTL converter with or without DTR Pin

For using this USB to UART Converter you need a software tool. Most of the development tools like MikroC Pro, Arduino has a UART Tool along with it. You can use different software tools: TerminalUSR-TCP232-Test V1.4AiThinker_Serial_Tool_V1.2.3cooltermsscom3.2 , KiTTYputty,tera termHMComAssistant and so on. We recommend you to use AiThinker_Serial_Tool_V1.2.3 or sscom3.2, as you can save your AT commands and it's very easy to use.

  1. Do wiring.
  2. Connect USB to TTL converter (UART converter) to your PC/Laptop USB port.
  3. Download and install the driver for USB to TTL converter (UART converter). See more information about it here.
  4. Download and open software tool. 
  5. Change the COM port (Serial port). Check in your Device manager -> Ports (COM & LPT) which USB port your UART converter/Arduino Uno board connected to. 
  6. Set the baud rate 9600, data bits 8, parity bits none,stop bits one. Tick off Send new Lin box.
  7. Press Open serial button (We use AiThinker_Serial_Tool_V1.2.3 here)
  8. First you need to check if AT commands are working - enter “AT” and press  Send button.This would print "OK" which signifies of working connection and operation of the module.
  9. Check the firmware version - enter “AT+VERR?” or "AT+VERR?" and press button Send. Returns the current version of the firmvare: “HMSoft V540”.
  10. Enter “AT+NAME?” and press button Send. Returns "OK+NAME:HMSoft". To change the name enter “AT+NAMEnewname” and press Send button. Returns “OK+Set:newname” (or something similar depending what your module is called).The default name is HMsoft.
  11. Enter “AT+ADDR?” and press button Send. You will get local bluetooth MAC address. Returns the address as a 12 digit hexidecimal number. For example: "OK+ADDR:E0E5CF56D857".
  12. Enter “AT+RESET” and press button Send. Restarts the module.Will close an active connection while restarting. Returns "OK+RESET".
  13. Enter “AT+RENEW” and press button Send. Returns "OK+RENEW". Restores the default factory settings. A quick and easy way to reset all settings.
  14. You can get or set baud rate.Enter “AT+BAUD?” and press button Send.  Returns: "OK+Get:0". To change baud rate use "AT+BAUDnn
    0 – 9600
    1 – 19200
     
    2 – 38400
    3 – 57600
    4 – 115200
    5 – 4800
    6 – 2400
    7 – 1200
    8 – 230400
    The default setting is 0 – 9600.
    Remember that both devices, the Arduino and the HM-10 need to use the same baud rate. Garbage characters are usually a sign of mismatched baud rates.
    0 – 9600, 1 – 19200, 2 – 38400, 3 – 57600, 4 – 115200, 5 – 4800, 6 – 2400, 7 – 1200, 8 – 230400. The default setting is 0 – 9600.Remember that both devices, the Arduino and the HM-10 need to use the same baud rate. Garbage characters are usually a sign of mismatched baud rates. Reset the module with "AT+RESET" when done. The maximum baud rate the Arduino serial monitor allows is 115200. If you set the baud rate to 230400 with AT+BAUD8 you wont be able to talk to the module.
  15. Enter “AT+HELP?” and press button Send. Returns the web address of manufacturer: www.jnhuamao.cn
  16. You can get or set pin code for pairing. Enter “AT+PIN?” and press button Send. Returns your PIN: "OK+Get:000000". To change PIN enter "AT+PIN123456" and press button Send. PIN changed to 123456 now, reset the module with "AT+RESET".
  17. Enter “AT+ROLE?” and press button Send. Query the current Role: Master or Slave. Returns 0 or 1 - “OK+Get:0”. 0 = Slave or Peripheral, 1 = Master or Central. The default setting is 0 (Slave). To change to Central Mode, enter “AT+ROLE1” and press button Send. Will return “OK+Set:1” , reset the module with "AT+RESET".
  18. Enter “AT+NOTI?” and press button Send. Query the notification status. Returns 0 or 1: “OK+Get:0”. 0 – notifications are off, 1 – notifications are on. To set the notification status, enter “AT+NOTI1” and press button Send. Will return “OK+Set:1” , reset the module with "AT+RESET". If notifications are turned on, the HM-10 will reply to commands with a confirmation message or send out a message when certain events take place, like “OK” for the AT command and “OK+LOST” when a connection is broken.
  19. Enter “AT+IMME?” and press button Send. Query the start mode. Returns 0 or 1: “OK+Get:0”. 0 = Connect immediately (assuming a previous connection has been applied), 1 = Wait for a connection command before connecting (AT+START, AT+CONN, AT+CONL. The default setting is 0 (connect on start).To set the start up mode, enter “AT+IMME1” and press button Send. Will return “OK+Set:1” , reset the module with "AT+RESET".If there are no previous connections, HM-10s will auto-connect to any other HM-10 available (normally the one with the strongest signal). The HM-10 (by default) remembers the address of the last module it was connected to and if there is stored a previous connection this will take priority when the HM-10 is retrying to auto-connect.

2. Using Arduino Uno board

  1. Do wiring.
  2. Open Arduino IDE.
  3. Plug your Adruino Uno board into your PC and select the correct board and com port. 
  4. Open up serial monitor and set your baud to 9600 baud. Note that the AT commands do not require Line Feed or Carriage Return codes (LF, CR). If you use the Arduino IDE console to send them , make sure that you select "No line ending". If you will use our sketch select "Both NL&CR"
  5. Power off the bluetooth module before verifying and uploading the sketch (attached on the begining of the project description).
  6. Verify and upload the sketch to your Adruino Uno board.
  7. We used the software serial on Arduino board pins 2 and 3 to talk to the HM-10 BLE module. This means that we can still use the hardware serial to talk to the serial monitor on a host computer.
  8. First you need to check if AT commands are working - enter “AT” and press  Send button.This would print "OK" which signifies of working connection and operation of the module.
  9. Check the firmware version - enter “AT+VERR?” or "AT+VERR?" and press button Send. Returns the current version of the firmvare: “HMSoft V540”.
  10. Enter “AT+NAME?” and press button Send. Returns "OK+NAME:HMSoft". To change the name enter “AT+NAMEnewname” and press Send button. Returns “OK+Set:newname” (or something similar depending what your module is called).The default name is HMsoft.
  11. Enter “AT+ADDR?” and press button Send. You will get local bluetooth MAC address. Returns the address as a 12 digit hexidecimal number. For example: "OK+ADDR:E0E5CF56D857".
  12. Enter “AT+RESET” and press button Send. Restarts the module.Will close an active connection while restarting. Returns "OK+RESET".
  13. Enter “AT+RENEW” and press button Send. Returns "OK+RENEW". Restores the default factory settings. A quick and easy way to reset all settings.
  14. You can get or set baud rate.Enter “AT+BAUD?” and press button Send.  Returns: "OK+Get:0". To change baud rate use "AT+BAUDnn 
    0 – 9600
    :  
    1 – 19200
      
    2 – 38400
    3 – 57600
    4 – 115200
    5 – 4800
    6 – 2400
    7 – 1200
    8 – 230400
    The default setting is 0 – 9600.
    Remember that both devices, the Arduino and the HM-10 need to use the same baud rate. Garbage characters are usually a sign of mismatched baud rates.
    0 – 9600, 1 – 19200, 2 – 38400, 3 – 57600, 4 – 115200, 5 – 4800, 6 – 2400, 7 – 1200, 8 – 230400. The default setting is 0 – 9600.Remember that both devices, the Arduino and the HM-10 need to use the same baud rate. Garbage characters are usually a sign of mismatched baud rates. Reset the module with "AT+RESET" when done. The maximum baud rate the Arduino serial monitor allows is 115200. If you set the baud rate to 230400 with AT+BAUD8 you wont be able to talk to the module.
  15. Enter “AT+HELP?” and press button Send. Returns the web address of manufacturer: www.jnhuamao.cn
  16. You can get or set pin code for pairing. Enter “AT+PIN?” and press button Send. Returns your PIN: "OK+Get:000000". To change PIN enter "AT+PIN123456" and press button Send. PIN changed to 123456 now, reset the module with "AT+RESET".
  17. Enter “AT+ROLE?” and press button Send. Query the current Role: Master or Slave. Returns 0 or 1 - “OK+Get:0”. 0 = Slave or Peripheral, 1 = Master or Central. The default setting is 0 (Slave). To change to Central Mode, enter “AT+ROLE1” and press button Send. Will return “OK+Set:1” , reset the module with "AT+RESET".
  18. Enter “AT+NOTI?” and press button Send. Query the notification status. Returns 0 or 1: “OK+Get:0”. 0 – notifications are off, 1 – notifications are on. To set the notification status, enter “AT+NOTI1” and press button Send. Will return “OK+Set:1” , reset the module with "AT+RESET". If notifications are turned on, the HM-10 will reply to commands with a confirmation message or send out a message when certain events take place, like “OK” for the AT command and “OK+LOST” when a connection is broken.
  19. Enter “AT+IMME?” and press button Send. Query the start mode. Returns 0 or 1: “OK+Get:0”. 0 = Connect immediately (assuming a previous connection has been applied), 1 = Wait for a connection command before connecting (AT+START, AT+CONN, AT+CONL. The default setting is 0 (connect on start).To set the start up mode, enter “AT+IMME1” and press button Send. Will return “OK+Set:1” , reset the module with "AT+RESET".If there are no previous connections, HM-10s will auto-connect to any other HM-10 available (normally the one with the strongest signal). The HM-10 (by default) remembers the address of the last module it was connected to and if there is stored a previous connection this will take priority when the HM-10 is retrying to auto-connect.

3. Updating the firmware

VERY IMPORTANT NOTE:

Before doing firmware update:

  • When you buy the HS-10 BLE module, it normally comes with a pre-installed AT firmware. Updating the firmware is non-reversable. Once you issue the "AT+SBLUP" command there is no way going back.
  • First of all you need to establish communication with HM-10 BLE module - check that it's responding to AT  commands, it's firmware revision and manufacturer of HM-10 BLE module.
  • Read all information about firmware update available here. The firmwares listed are for upgrade only and do not contain the whole file (no boot loader). You can also read the guide how to update firmware from manufacturer here.
  • Just think if you realy need to do it as it is a risk to damage the module!!!
  • If you decided to do it make sure that the next firmware version which you are planing to upload is not older than existing. 

Firmware download link. More details about changes in firmwares you can find here.

 

  1. Like the Arduino, the HM-10 has a boot loader that makes uploading new firmwares fairly straight forward. You will need a Windows PC and USB to TTL serial converter.
  2. Get the latest firmware upgrade file. You can download them from Download Centre or on this page (see links above). Place it in folder and and unzip it. There are 4 files in zip archive. we need are HMSoft.exe, and HMSoft.bin. HMSoft.exe is a Windows app that does the uploading and HMSoft.bin is the actual firmware update file. HMSoft.exe does not need installing, just double click to run it.
  3. The firmware update file for the CC2540 and the CC2541 chips are not the same. You cannot load the CC2540 firmware on the CC251 chip. 
  4. Do wiring. See 1. Using USB to TTL converter with or without DTR Pin above.
  5. We need to check that we can talk to the HM-10 BLE module. For using this USB to UART Converter you need a software tool. Most of the development tools like MikroC Pro, Arduino has a UART Tool along with it. You can use different software tools: TerminalUSR-TCP232-Test V1.4AiThinker_Serial_Tool_V1.2.3cooltermsscom3.2 , KiTTYputty,tera termHMComAssistant and so on. We recommend you to use AiThinker_Serial_Tool_V1.2.3 or sscom3.2, as you can save your AT commands and it's very easy to use.
  6. Connect USB to TTL converter (UART converter) to your PC/Laptop USB port.
  7. Download and install the driver for USB to TTL converter (UART converter). See more information about it here.
  8. Download and open software tool. 
  9. Change the COM port (Serial port). Check in your Device manager -> Ports (COM & LPT) which USB port your UART converter/Arduino Uno board connected to.
  10.  
  11. Set the baud rate 9600, data bits 8, parity bits none,stop bits one. Tick off Send new Lin box.
  12. Press Open serial button (We use AiThinker_Serial_Tool_V1.2.3 here)
  13. First you need to check if AT commands are working - enter “AT” and press  Send button.This would print "OK" which signifies of working connection and operation of the module.
  14. Check the firmware version - enter “AT+VERR?” or "AT+VERR?" and press button Send. Returns the current version of the firmware: “HMSoft V540”. As you can see we will update firmware from version 540 to version 604.
  15. From this step NO WAY TO GO BACK. THINK TWICE IF YOU WANT TO RISK!!! To put the HM-10 BLE module into update mode enter “AT+SBLUP” and press button send. Returns "OK+SBLUP" and the LED on the HM-10 will stop flashing (will be steady). You are in firmware uploading mode now.
  16. Press Close serial button to stop serial communication and close the program (software tool).
  17. Open the folder containing the firmware update files and run the HMSoft.exe file. If you are using Win7 or later you may need to run the app in admin mode.
  18. Select HMsoft.bin file from the folder containing the firmware update files as Image file and enter COM port number - we had 8.
  19. Press Load Image button. The upload will start.The firmware file is first written and then verified.
  20. When finished the Download completed successfully dialogue box will pop up and the LED on the HM-10 BLE module will start to flash again.
  21. We can now close the HMsoft app and open the AiThinker_Serial_Tool_V1.2.3  to check the new firmware version.
  22. Set the baud rate 9600, data bits 8, parity bits none,stop bits one. Tick off Send new Lin box.
  23. Press Open serial button. 
  24. First you need to check if AT commands are working - enter “AT” and press  Send button.This would print "OK" which signifies of working connection and operation of the module.
  25. Check the firmware version - enter “AT+VERR?” or "AT+VERR?" and press button Send. Returns the current version of the firmware: “HMSoft V604”.
  26. Congrats!!You done it!!
  27. Trouble shooting the firmware update. If you start the update and nothing happens you have probably left the serial port open. You need to close the serial and software tool to free up the COM port. The update app does not give an error message if the COM port is not available. It just sits there.
  28. If you get a timeout error when updating try again. If you keep getting the error your UART adapter is likely to blame. 
  29. If you crash out and the LED on the HM-10 remains solid on. It means it is still in upload mode. It will remain in upload mode even after cycling the power. Just start the update again using the update app.

Summary

We have learnt about Bluetooth 4.0 HM-10 BLE module, how to connect it to Arduino board, how to communicate with it using AT commands, how to update firmware.

Library:

  • SoftwareSerial library included in Arduino IDE. The version of SoftwareSerial included in Arduino IDE 1.0 and later is based on the NewSoftSerial library by Mikal Hart. You can also read about it here.  

Sketch:

  • See attachments on the begining of this project description. 


Other projects of Acoptex.com
Easy CBASIC Lesson 9 Compiling and debugging in Visual Studio of Acoptex.com in Csharp 10-04-2019
Easy Basics: Project 081d ESP8266 ESP-12E module and Nextion HMI display of Acoptex.com in ESP8266 ESP-12 24-03-2019

« Go back to category
Is this project fake? Report it!   
Recommend to a friend
Published at 05-04-2018
Viewed: 3114 times