Arduino - Sending A String Over Bluetooth Using The HM-10

Maker Portal Sign In My Account Main Portal Raspberry Pi Arduino Engineering Python BLExAR Blog Shop Contact About Consulting Search Back - All Products - New and Popular Microcontrollers Raspberry Pi Engineering Kits Internet of Things Sensors Motors + Actuators Data Acquisition Maker Tools BLExAR Resources WaWiCo Arduino - Sending A String Over Bluetooth Using The HM-10

Wireless technology is undeniably taking over as a primary method of communication between computers, smartphones, and tablets. Wires are a thing of the past, where Bluetooth and Wifi are the burgeoning present and future internet of things. Bluetooth in particular is omnipresent due to its low-energy innovations and universal compatibility. For makers, Bluetooth low energy (BLE) is a crucial component of the network of devices that communicate to create the connected world in which we live.

As an introduction to Bluetooth with Arduino or Raspberry Pi, I recommend using a component called the HM-10 [datasheet here]. The HM-10 is a Bluetooth low energy module that employ Bluetooth 4.0, which is currently the most widely used protocol for wireless devices (along with Wifi, but I will discuss this later). All of the current iPhones, Androids, and Google phones use Bluetooth 4.0, and it will likely be around for quite a while. The module is powered at 3.3V and consumes around 50mA (peak), 8.5mA (nominal), and can sleep with a current between 400uA - 1.5mA. It claims to have an open-space transmission range of 100m, and boasts transfer rates at 2 kilobytes per second. The underlying chip is a Texas Instruments CC-2540/2541 [see here]. The HM-10 is particularly germane because it cooperates nicely with the Arduino software with a mere four lines of code in the IDE.

hm_10_1.jpg

HM-10 Bluetooth low energy Module

Ideal for bluetooth interfacing with a smartphone and an arduino

BLExAR Kit (Uno Board and CC2541 BLE Module) BLExAR Kit (Uno Board and CC2541 BLE Module) Sold out Quick View BLExAR Kit (Uno Board and CC2541 BLE Module) $20.00 Purchase . Purchase An Arduino and CC2541 Bluetooth Module from Our Shop .

Wiring The HM-10 to Interface With Arduino

Wiring the HM-10 to the Arduino Uno board should go as follows:

Arduino | HM-10D2 | TXD3 | RXGND | GND3.3V | VCC

#include <SoftwareSerial.h> SoftwareSerial ble(2, 3); // RX, TX void setup() { // Open serial port Serial.begin(9600); // begin bluetooth serial port communication ble.begin(9600); } // Now for the loop void loop() { Serial.println("Sending Bluetooth Message..."); ble.write("Testing..."); delay(500); }
arduino_hm_10_wiring_smaller.png

After uploading the sketch to the board, the Arduino is fully setup to send a message to a Bluetooth low energy receiving device in a central role. This could be an iPhone, tablet, Android, or even another HM-10, provided that the module is set to the central role. The HM-10 is by default set to a peripheral role, wherein it sends data, however, programming it to act as a central device is not very difficult [see datasheet].

iOS App for Receiving the String

In order to receive the string (and send them as well), I use the BLExAR app from the iOS app store (here is a link). While scanning for the HM-10, you will notice several devices showing up. The HM-10 should be called 'HMSoft' or 'CC2541' - sometimes it’s ‘ It is possible that another name will show up, if you programmed the HM-10 via AT commands and changed its name via 'AT+NAMExxxx.' Once you have selected the HM-10 module, you will be able to communicate via Bluetooth and receive the string you programmed above!

BLExAR iOS Arduino App

BLExAR iOS Arduino App

- Blog title image courtesy of Arduino AG under Creative Commons AttributionShareAlike 3.0.

Related Items from our Shop:

Maker Portal Arduino-Compatible Uno Rev3 Board Maker Portal Arduino-Compatible Uno Rev3 Board Sold out Quick View Maker Portal Arduino-Compatible Uno Rev3 Board $13.00 Purchase Bluetooth Low Energy Module (CC2541) Sold out Quick View Bluetooth Low Energy Module (CC2541) $9.00 Purchase

See more in Arduino and IoT:

Arduino Sensor Data Logging and Visualization on iPhone Nov 28, 2022 Arduino Sensor Data Logging and Visualization on iPhone Nov 28, 2022 Nov 28, 2022 MakerBLE — A Tiny nRF52840 Bluetooth Arduino Board Nov 15, 2022 MakerBLE — A Tiny nRF52840 Bluetooth Arduino Board Nov 15, 2022 Nov 15, 2022 Haptic Feedback Joystick with Arduino Aug 9, 2021 Haptic Feedback Joystick with Arduino Aug 9, 2021 Aug 9, 2021 Portable GPS Tracker with Arduino Jul 15, 2021 Portable GPS Tracker with Arduino Jul 15, 2021 Jul 15, 2021 Bluetooth-Enabled e-Paper Display with Arduino Jul 8, 2021 Bluetooth-Enabled e-Paper Display with Arduino Jul 8, 2021 Jul 8, 2021 An Introduction to RFID with Arduino Jun 27, 2021 An Introduction to RFID with Arduino Jun 27, 2021 Jun 27, 2021 Solar Panel Characterization and Experiments with Arduino Jun 18, 2021 Solar Panel Characterization and Experiments with Arduino Jun 18, 2021 Jun 18, 2021 TinyBlueX - A Low Power Bluetooth Arduino Board Apr 24, 2021 TinyBlueX - A Low Power Bluetooth Arduino Board Apr 24, 2021 Apr 24, 2021 3 Intermediate-Level Arduino Projects to Try at Home Feb 4, 2021 3 Intermediate-Level Arduino Projects to Try at Home Feb 4, 2021 Feb 4, 2021 Arduino Venturi Flow Meter Jul 25, 2020 Arduino Venturi Flow Meter Jul 25, 2020 Jul 25, 2020 Bluetooth, Programming, ArduinoJoshua HriskoOctober 15, 2017Bluetooth, Bluetooth Low Energy, BLE, BLExAR, Arduino BLE, Arduino BLExAR, Arduino IoT, Arduino Bluetooth, iOS Bluetooth, HM-10 Bluetooth, HM-10 Bluetooth Module, CC2541 Bluetooth, iPhone X Bluetooth, Arduino iOS Bluetooth, 2018 #37 Comments Facebook0 Twitter LinkedIn0 Reddit Tumblr Pinterest0 0 Likes Previous

Introduction To Capacitive MEMS Accelerometers and A Case Study On An Elevator

Bluetooth, Most Popular, Engineering, Data Analysis, Python, Raspberry Pi, ArduinoJoshua HriskoOctober 19, 2017MEMS, Aero-Thermal, MEMS Accelerometer, Arduino Accelerometer, Arduino MEMS, Arduino Calibration, MEMS Accel, Mass-Spring Analogue, Mass-Spring System, Capacitive MEMS Accelerometer, Accelerometer on an Elevator, Accelerometer Elevator, Elevator Acceleration, Trapz, 2018 #217 Comments Next

Acoustic Signature of a Tea Kettle

Engineering, Data Analysis, Raspberry PiJoshua HriskoOctober 9, 2017Aero-Thermal, Acoustics, Waves, Tea Kettle, Vibration, Acoustics and Vibration, Standing Wave, Helmholtz Resonators, Resonator, Mass-Spring System, Spectrogram, Engineer, Engineering, Wave, Signal Processing, Digital Signal Processing, Acoustic Analysis, Audio, Raspberry Pi Audio

Tag » Arduino Ble Hm-10 Example