IOT

Basics of Bluetooth Low Energy with HM-10 BLE 4.0 & Arduino

Most battery-powered devices employ Bluetooth, a simple wireless communication module that has been popular for several decades and is simple to use. There have been numerous modifications to the Bluetooth standard over the years to keep up with customer and technological demands as time and circumstance dictate. It all began with Bluetooth version 1.0 and is now available on the market as Bluetooth version 5.0. Many things have changed in the last few years, including data transfer rates, power consumption of wearable and IoT devices, and security systems.

The HC-05 and HC-06 are commonly available in the market if you want to discover how Bluetooth works. However, we will be learning about the HM-10 BLE 4.0 with Arduino Board in this article. The HM-10 Bluetooth 4.0 module is widely accessible. The purpose of this module is to establish wireless data transmission. The CC2540 or CC2541 Bluetooth low energy (BLE) System on Chip from Texas Instruments was used to create the module (SoC). Jinan Huamao Technology Company created the module design and firmware.

Components Required

  • Arduino UNO R3 Development Board
  • HM-10 BLE 4.0
  • Connecting Wires
  • Breadboard

Bluetooth Low Energy (BLE)

The Bluetooth Special Interest Group (Bluetooth SIG) invented and commercialized Bluetooth Low Energy (previously known as Bluetooth Smart), a wireless personal area network technology intended for novel applications in the healthcare, fitness, beacons, security, and home entertainment industries. When compared to traditional Bluetooth, Bluetooth Low Energy is designed to use significantly less power and cost while retaining a similar communication range. Bluetooth Low Energy is natively supported by mobile operating systems such as iOS, Android, Windows Phone, and BlackBerry, as well as macOS, Linux, and Windows.

Applications of Bluetooth Low Energy (BLE)

BLE focuses on low energy consumption, as the name implies. Low-energy focus comes with various trade-offs, particularly in terms of data transfer rates and operating range. With all of the buzz surrounding IoT (Internet of Things) and the plethora of technologies and devices available, BLE is aiming to establish itself as an IoT leader. The following are just a few of the many BLE-compatible applications:

1. Fitness trackers (such as Fitbit, and Misfit)

2. Smartwatches (such as the Apple Watch, Moto 360, and Pebble)

3. Beacons (Apple iBeacon, Google Eddystone)

4. Medical devices such as glucose meters, and insulin pumps

5. Home automation devices such as door locks, light bulbs, sensors, and others

Advantages

  • Low power consumption
  • Low bandwidth – perfect for collecting data from sensor devices
  • Proliferation in smartphones
  • Relatively simple development process
  • No fees to access the core spec
  • Low development and module costs
  • No outrageous licensing costs compared to other low-power wireless technologies

Disadvantages

  • Low bandwidth – not suitable for large data transfer applications
  • Limited range (typically 30 -100 m, but steadily increasing with each iteration of the spec)
  • Requires a gateway device to connect the end devices to the Internet (smartphones, dedicated gateway devices)
  • Interference and noise from other protocols in the 2.4 GHz spectrum (WiFi, Bluetooth classic, ZigBee, etc)
  • Can be difficult to debug issues with communications especially relating to longer ranges and interference

HM-10 BLE 4.0

Based on the TI CC2540 or CC2541 Bluetooth SOC, the HM-10 is a tiny 3.3v SMD Bluetooth 4.0 BLE module (System On Chip). The HM-10 is available in two versions: the HM-10C and the HM-10S.

BLE 4.0

The HM-10 Bluetooth 4.0 BLE module for Arduino has become extremely popular. Part of this is due to the standard UART serial connection, which makes connecting to an Arduino quite simple. The UART layer serves a dual purpose: it makes things easier to use while also hiding the BLE layer, allowing you to have no control over the actual BLE side of things. Only Bluetooth version 4.0 is supported by the HM-10. As a result, it won’t work with Bluetooth 2/2.1 modules like the HC-06 and HC-05. AT commands are sent over the serial UART connection to control the HM-10.

HM-10 Breakout Board

The HM-10 can also be purchased with a breakout board that exposes the power and UART connections to male pins that can be used on a breadboard. A 3.3v power regulator is included on the breakout board, making them 5V compatible. It’s worth noting that the RX pin on the HM-10 is still 3.3v, so if you’re using a 5v Arduino, you’ll need to convert the Arduino’s 5v TX to 3.3v for the HM-10 RX.

HM-10 BLE Arduino

1. STATE: state test pins, connected to an internal LED, generally keep it unconnected.

2. RXD: serial interface, receiving terminal.

3. TXD: serial interface, transmitting terminal.

4. GND: Ground.

5. VCC: positive pole of the power source.

6. EN/BRK: break connect, it means breaking the Bluetooth connection, generally, keep it unconnected.

Interfacing HM-10 BLE 4.0 with Arduino

The below circuit diagram gives a basic idea of how an HM-10 can be interfaced with Arduino UNO.

HM-10 Arduino Connection

VCC is connected to the Arduino’s 5V pins, and GND is connected to GND. The TXD Pin of the HM-10 is linked to D2 of the Arduino using the software Serial function, and the RXD Pin to D3.

Source Code Program for HM-10 Arduino LED blinking

The following programme demonstrates how to turn on and off the Arduino’s built-in LED at digital Pin 13. Copy and paste this code onto the Arduino board.

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2,3);
int ledpin=13;
void setup()
{
mySerial.begin(9600);
Serial.begin(9600);
pinMode(ledpin,OUTPUT);
}
void loop()
{
int i;
if (mySerial.available())
{
i=mySerial.read();
Serial.println(“DATA RECEIVED:”);
if(i==’1′)
{
digitalWrite(ledpin,1);
Serial.println(“led on”);
}
if(i==’0′)
{
digitalWrite(ledpin,0);
Serial.println(“led off”);
}
}
}

BLE Scanner Android App

  • Download an App called BLE Scanner from the play store.
    Download Link: BLE Scanner
BLE Scanner App
  • Open the App when it has been installed and enable the Location and Bluetooth permissions.
  • Look for BlueTooth devices to scan. MLT-BT05 is the name of the HM-10 BLE 4.0. MLT-default BT05’s pairing code is 123456789. So, once you’ve linked, you’re set to go.
BLE Scanner App
  • Once you’ve established a connection with the MLT-BT05, click on it to access a variety of choices, including Device Information, Generic Access, Generic Attribute, and Customs Service. Select Custom Services from the list of possibilities.
BLE Scanner App
  • When Custom Service is selected, a blue-colored circular option will appear with the letters R, W, and N, which stand for read, write and notify.
  • To control the Arduino Board’s integrated LED, click W and transmit 1 or 0.
  • The LED will turn on when you send a “1,” and it will turn off when you send a “0.”

Conclusion

I hope all of you understand the basics of  Bluetooth Low Energy with HM-10 BLE 4.0 & Arduino. We MATHA ELECTRONICS will be back soon with more informative blogs.

Leave a Reply

Your email address will not be published.