In this project , we will connect Arduino to HM-10 module and send/receive message to/from Android app through Bluetooth 4.0 protocol.
1 x Bluetooth 4.0 HM-10 Master Slave Module
1 x Arduino UNO R3 (or MEGA2560)
1 x Android cell phone which supports Bluetooth 4.0
Bluetooth 4.0 HM-10 Master Slave Module use TI CC2541, Master and slave roles in one, transmission version and remote control version and PIO state acquisition functions in one, Support the AT command modify module parameters, Convenient and flexible.Transmission version can be used to transmit data between two Bluetooth devices.Remote Control version can be used to Control PIO ports output high or low level without any other MCU.PIO state acquisition version can be used to acquisition PIO ports state without any other MUC. (Only support Bluetooth V2.1)
Bluetooth Protocol: Bluetooth Specification V4.0 BLE
USB Protocol: USB V2.0
Operating Frequency: 2.4GHz ISM band
Modulation Mode: GFSK (Gaussian Frequency Shift Keying)
Transmitting Power: ≤4dBm
Sensitivity: ≤-84dBm at 0.1% BER
Transmission Rate: Asynchronous: 6 kbps
Synchronous: 6 kbps
Security Feature: Authentication and encryption
Support Service: Central & Peripheral UUID FFE0, FFE1
Power Supply: +5VDC 50mA
Operating Temperature: -5 ~ +65 Centigrade
Physical Dimension: 27mm x 13mm x 2.2 mm.
Pin
|
Description
|
---|---|
STATE | state test pins, connected to internal LED, generally keep it unconnected. |
VCC | positive pole of the power source. |
GND | Ground. |
TXD | serial interface, transmitting terminal. |
RXD | serial interface, receiving terminal. |
BRK | break connect, it means breaking Bluetooth connection, generally keep it unconnected. |
Step 1: You should compile and upload the code before building the circuit
Download the loop.ino sketch file, then load it into Arduino UNO.
Step2: Connecting circuit
Bluetooth 4.0 | Arduino UNO R3 |
---|---|
VCC | 5V |
GND | GND |
TXD | Soft RX(pin10) |
RXD | Soft TX(pin11) |
Step 3: Go to your Android Phone Setting ->Bluetooth and Search the Bluetooth Module(device name should be sth like HC-05). Pair the device with pin number 1234.
Step 4: Install Sketch on Arduino
Since Arduino IDE needs TX/RX pin to load sketch code into flash, you have to disconnect D0,D1 from Bluetooth module first. Then
Download the loop.ino sketch file, then load it into Arduino UNO.
Step 5: Now you can use Arduino Serial Windows to talk with HM10 module with AT command
When you type “AT” in command window and click SEND, the serial window will show “OK”.
When you type “AT+NAME?” ,serial window will show “OK+NAME:xxxx”, xxxx is the name of the HM10 module.
When you type “AT+ADDR?”, serial window will show “OK+ADDR:xxxx”, xxxx is the address of the HM10 module
Step 6: Use Android/IOS APP to communicate between cell phone and Arduino with Bluetooth BLE module.
First, you need download BLE scanner from Google Play or Apple store. Then follow the instruction in this tutorial link and test the communication: https://osoyoo.com/wp-content/uploads/2016/10/ble-android.pdf
Then in the text sending field, input a letter “A” and click SEND ASCII button.
You will see the Arduino pin 13 LED will flash and your APP terminal will echo “REBECCA”. This means the Arduino bluetooth module communicate with your Android APP very successfully.
Reference: Using AT Commands to configure HM-10 Bluetooth module
Additional Parts and Devices: 1 x USB to TTL Module and a PC computer
Step 1: wire.
Connect TXD of Bluetooth 4.0 Module to RXD of PL2303, RXD to TXD, GND to GND, and VCC to VCC. PL2303 is a USB to Serial Bridge Controller. You can also use other components, such as FT232.
Bluetooth 4.0 | FT232 |
---|---|
VCC | VCC |
GND | GND |
TXD | RX |
RXD | TX |
Step 2:set parameters
After wiring, open the serial port debug tool sscom32. Set parameters at first.
1) Open the serial port, click Open Com. Select the correct port, as shown below.
2) Select the correct baud rate. Here select 9600 bps.Default: 9600, as shown below.
Step3: Now, you can start to send instructions. Enter”AT” in the text box. If Bluetooth 4.0 Module goes well, OK will be sent, as shown below:
Also you can send AT+NAME?. OK+NAME:HMSoft will be returned .
Send AT+BAUD?, OK+Get:0 will be returned. Default: 0(9600)
For more information about Bluetooth 4.0 AT Instructions. please refer to Bluetooth 4.0 BLE module datasheet.pdf
DownLoad Url osoyoo.com
You must be logged in to post a comment.
😀 im having a trouble. The HM-10 replied to my command in vertical form. When i type, AT+NAME? it replied
O
K
+
N
A
M
E
:
H
M
S
o
f
t
Is it just fine?
Pls confirm which APP you use and whether your APP can change the respond command form.
Hi, the DL link for your app BleSerialPort leads to a all chinese app. In your screenshots its English. Is there posibility to link to a English version?
/KG
We set the system Language and it shows English version but there is some Chinese advertise in this app.
Thank you for your reply! I have a tablet, its system language is English. But the app is all chinese. All the menues, buttons end text is chinese. I have figured out how to connect and so with tryal and error but if I could change the languege to English it would help alot. Can you change it in the app?
Pls try the APP link: osoyoo.com/driver/BleSerialPort.apk.
We test this APP in Android with English System Language.
According to HM-10 datasheet, VCC should be connected to +3.3VDC 50mA.
we test the item and it can work with 5V
could you please give me your android code? i want to understand how it work. Thank you very much
Do you mean the password for bluetooth?
You can try 1234, or 0000.
Hi, I am trying to have the HM-10 connected to an Arduino NANO communicate with an SH-08 connected to an Atmega2560. Both boards work with the DSD App on iPhone as expected.
The boards do pair successfully. The HM-10 is master and the SH-08 slave. When the master does serial writes the slave does not see the characters. The master initialization code is:
doCommand(F(“AT+INQ”));
doCommand(F(“AT+ROLE1”));
doCommand(F(“AT+IMME0”));
doCommand(F(“AT+MODE0”));
doCommand(F(“AT+NAME?”));
doCommand(F(“AT+ADDR?”));
doCommand(F(“AT+MODE?”));
doCommand(F(“AT+POWE?”));
doCommand(F(“AT+TYPE?”));
doCommand(F(“AT+ROLE?”));
Is this sequence incorrect? What sequence should I send? (doCommand writes the command to the bluetooth serial port)
Thanks
Doug