Episode 9: GUI-O and HM-10 BLE
-
The following example shows how to connect GUI-O app with HM-10 Bluetooth Low Energy (BLE) module. Arduino Uno is used as an intermediary between the HM-10 and PC serial terminal.
Software prerequisites:
-
Arduino IDE (https://www.arduino.cc/en/software)
-
GUI-O application (https://play.google.com/store/apps/details?id=com.guio.guioapp), updated to at least v1.0.25
-
For additional information about the GUI-O application, download the developer manual from https://www.gui-o.com/
Components needed:
- HM-10 BLE module
- Arduino Uno
The entire tutorial is split into various steps. All necessary information is given in each step.
1. CONNECT THE COMPONENTS
Connect the components as shown in the schematic below. Note that the Arduino Uno transmit pin (pin "D3") uses a voltage divider to reduce 5V to roughly 3.3V.
2. UPLOAD THE SOURCE CODE
The source code is really simple and has inline comments, describing the parts of the code. You can copy the source code from the snippet below, or download it here.
Upload the code to your Arduino Uno board (make sure that the correct board and upload port are selected).
/* * GUI-O BLE HM-10 example (using HM-10 and Arduino Uno) * * Copyright (C) 2022, GUI-O Team * * SPDX-License-Identifier: BSD-3-Clause */ #include <SoftwareSerial.h> // communicating with HM-10 using Arduino Uno // via software serial, so set it up (Rx - pin2, Tx - pin3) SoftwareSerial bt(2, 3); void setup() { // 1. Arduino Uno sends data to HM-10 (via PC teriminal) // 2. Arduino Uno receives data from HM-10 Serial.begin(115200); // 1. HM-10 sends data Arduino Uno // 2. HM-10 receives data from Arduino Uno bt.begin(9600); } void loop() { // listen for HM-10 data bt.listen(); // if HM-10 has data, send it to Arduino Uno to be displayed on PC terminal while(bt.available() > 0) { Serial.write(bt.read()); } // if Arduino Uno has data (via PC terminal), send it to HM-10 if(Serial.available()) { delay(10); bt.write(Serial.read()); } }
3. ESTABLISH CONNECTION
-
Open GUI-O app, navigate to settings and select "Connections -> Bluetooth LE"
-
Search for BLE devices (enable Bluetooth and Location services, if prompted)
-
Select HM-10 module (named HMSoft or similar)
-
Wait for successful connection
-
Open any serial terminal on PC (e.g., Arduino Serial Monitor)
-
Close the settings menu and press the Initialize button (see image below) from the GUI-O application home screen and observe the result on serial terminal on PC
- Send any valid command (see example below) via serial terminal on PC and observe the result in GUI-O app
EXAMPLE COMMAND: "|TG UID:toggle X:50 Y:50" (omitting the quotes). Make sure all commands are terminated by carriage return (\r) and line feed (\n). See the GUI-O manual for all supported commands.
If you have any questions or run into any problems, please let me know!
Best regards,
kl3m3n -