The HM10 low energy Bluetooth module has the characteristics uuid and service uuid that you need to build in and communicates with your Arduino through the RX and TX pins. You need the softserial library to create an extra serial connection. 

HM-10 Services and Characteristics

 

BLE is all about services and characteristics and like all BLE devices, the HM-10 has a set of services and each service has a set of related characteristics. Characteristics are where the values are, some are READ, some are WRITE, and some are READ and WRITE.

 Select the service you need(for my HM10 it is 0000ffe0-0000-1000-8000-00805f9b34fb), get the characteristics of the selected services, select the characteristic (for my HM10 it is 0000ffe1-0000-1000-8000-00805f9b34fb)

When you tell the HM-10 to transmit “HELLO”, it first sets the value of the custom characteristic to “HELLO” and then it sends out a notification telling the remote device “Hey, I have new data, come and get it.” The remote device is scanning for the notifications and when it receives one it knows there is a new value, so it reads the data and then sends back a message saying “Thanks, I have it”.

The custom characteristic can hold up to 20 characters, this means to send a string longer than 20 characters the HM-10 splits the data into 20 character segments and sends each one in turn until none are left.

 

Get Started With the HM-10

You need an Android device to read the services and characteristics from the HM-10. Power on the HM-10, you can use an Arduino for this but all we need is 5V to HM-10 VCC and GND to HM-10 GND.

The LED on the HM-10 should be flashing if it gets the proper voltage. When a connection is established the LED will be become solid.

 

Reading the characteristics UUID of the HM-10 using BLE Scanner

Depending on your Android device and the version of Android you are running the HM-10 may or may not show up when searching for Bluetooth devices under the Android Settings.

If your device does not find the HM-10 under Bluetooth settings, try using the BLE Scanner app.

The modules can be paired using the default pin 000000

To connect to the HM-10 and to read the services and characteristics UUIDs we need to use a BLE Scanner app.

Here are two apps you can use anyone from this

BLE Scanner: Download from Google Play

B-BLE: Download from Google Play

Open the BLE Scanner app and find the HM-10. Tap the CONNECT button to get the app to connect to the HM-10 and start reading its properties.

  

Clicking the small down arrows will expand the services and display the characteristics.

Tapping one of the R labels will read the characteristic value. For example, under Device Name, tapping the R reads and then shows the device name value.

Under Custom Service you can see the HM-10s default service and characteristic values. You can also see that the HM-10s custom characteristic has Read, Write, and Notify attributes.

HM10 Interface with Arduino and MIT App Inventor

 

We are going to send a message (abcdefghijk) and get the bytes obtained in Arduino UNO

Here is the screenshot of MIT App Inventor

 

Here is the Arduino code for the same

#include <SoftwareSerial.h> // El TXD del módulo al pin 2 (RX) del Arduino. // El RXD del módulo al pin 3 (TX) del Arduino.

SoftwareSerial HM10(2, 3);

#define LED13 13 byte caracter = "";

// char caracter = "";

String mensaje = "";

void setup()

{

Serial.begin(9600);

HM10.begin(9600);

pinMode(LED13, OUTPUT);

}

void loop(){

if(HM10.available())

{

caracter = HM10.read();

Serial.println(caracter);

mensaje = mensaje + caracter;

if(caracter == NULL )

{

Serial.println(mensaje);

if (mensaje.indexOf("on13")>= 0)

{

digitalWrite(LED13, HIGH);

}

if (mensaje.indexOf("off13")>= 0)

{

digitalWrite(LED13, LOW);

}

mensaje = "";

delay(100);

}

}

}