
FM0 FC000010000:zzzzzz0 6112 078043874441663838014c0 bac 3c 0 603 617 0 c7812c9 9 d781524 12 f3f178c 1b ade eb5 0 80d a2b
Wireless communication is an increasingly used option in electronic projects, and Bluetooth modules play a key role in this area. One of the most popular to work with Arduino is the Bluetooth module. HM-10. This device enables wireless communication with smartphones, tablets and other devices that support Bluetooth Low Energy (BLE), thanks to its chip CC2541.
In this article, we will explain in depth what the module is. HM-10, how to connect it to an Arduino board and configure it using AT commandsIn addition, we will see how to interact with it from a mobile application, opening up a world of possibilities in automation and remote control projects.
What is the HM-10 Bluetooth module?
The HM-10 It is a wireless communication device based on the CC2541 chip, which belongs to the Texas Instruments family of microcontrollers. This chip is widely used for its energy efficiency, since it implements the technology Bluetooth 4.0 Low Energy (BLE), designed to minimize battery consumption.
It is especially useful in projects where constant connectivity is required without excessive energy expenditure, such as in systems of domótica, portable devices y remote monitoring.
Necessary materials
- Un Arduino UNO (or any other compatible version).
- Un HM-10 Bluetooth module.
- Connection cables to ensure communication between devices.
- Un voltage divider if you use an Arduino that operates at 5V, since the HM-10 operates at 3.3V on its RX pin.
Connecting the HM-10 to Arduino
The HM-10 It has several pins, but the most important ones for communication with Arduino are:
- VCC: It connects to 5V on the Arduino board.
- GND: It connects to the Arduino GND.
- TXD: Connect it to the Arduino RX pin.
- RXD: Connect it to the Arduino TX pin (via a voltage divider if necessary).
If the module is receiving power correctly, its status LED will start flashing, indicating that it is in standby mode.
HM-10 Module Configuration
To configure the module, the so-called AT commands, which allow you to modify parameters such as the name of the device, the transmission speed or the operating mode.
Code Example for Configuring the Module
Below is a basic code to establish communication with the module HM-10:
#include SoftwareSerialBT(10, 11); // RX, TX void setup() { Serial.begin(9600); BT.begin(9600); Serial.println("Ready to communicate with HM-10"); } void loop() { if (BT.available()) { Serial.write(BT.read()); } if (Serial.available()) { BT.write(Serial.read()); } }
This code allows data to be sent and received between the computer and the Bluetooth module through the Arduino serial monitor.
Main AT Commands
- AT: Check if the module is responding (it should respond “OK”).
- AT+VERSION: Check the firmware version of the module.
- AT+NAME=XX: Rename the Bluetooth device to “XX”.
- AT+PIN=1234: Set a pairing PIN code.
- AT+ROLE=0: Sets the module as a slave.
Testing the Connection with a Mobile App
One of the easiest ways to test the connection of the HM-10 It is through a mobile app that supports communication CORN. A recommended option is BLE Terminal Free, available on Google Play Store.
Steps to Connect from Mobile
- Download and install BLE Terminal Free on your Android phone.
- Make sure Bluetooth is turned on on your smartphone.
- Open the app and tap “Search” to find available devices.
- Select your module HM-10 (if you changed the name, it will appear as you configured it).
- Press “Connect” and once paired, you can send and receive data.
Arduino Communication Example
With the code previously loaded in Arduino and the connected mobile app, try sending messages from the app terminal and see how they arrive at the Arduino serial monitor. You can also write something in the Arduino serial monitor and see it reflected in the app.
The LED on the module will change its flashing pattern when the connection is established, indicating that it has been successfully paired with the mobile device.
The Bluetooth module HM-10 It is, without a doubt, an excellent option to add wireless connectivity to projects based on Arduino. Thanks to its compatibility with CORN, enables low-energy communication ideal for mobile and IoT applications. Knowing the AT commands appropriate and how to establish a connection with a mobile app, it is possible to develop a wide variety of interactive and automated projects.