I am attempting to use HM10 as central to read data from a sensor. The HM10 has been flashed with the latest firmware V710 to use the self learn functionality.
Here is the list of messages I am sending and receiving from the HM10
First I configure the HM10 as central and turn on some notifications. Then I connect to the MAC address of the sensor. I use the AT+FINDSERVICES? command to get the list of services, then find all the characteristics in the range of that uuid. The characteristics I am interested in is 0021.
But here is when the problems start. If I try to read that characteristic I get OK+DATA-ER, which the datasheet the characteristic does not have a read property. Same thing with notify.
But from the AT+CHAR command we can see handle 0021 has both read and notify. I have also tired reading from 001E handle and I get the same error. I am able to read data like the device name from another handle so I am able to get some data off the sensor.
I am wondering if the OK+DATA-ER response can mean something else? Or if the characteristic handle isn't correct somehow. If that were the case how would I find the correct handle?
I have tried connecting to the sensor on my iphone using the LightBlue app and I am able to both read and subscribe to the notification. I have also tried cloning the sensor as a virtual device on LightBlue and I am able to read and subscribe from the HM10 to the phone. So the issue seem to be between the HM10 and the sensor specifically and not with either device individually.
LightBlue UUID
LightBlue read data
I figured it out. Turned out to be a security issue. The sensor would allow connection but no data would be accessible unless the connection was encrypted.
The BLE sensor required pairing when it first connect to a phone and does not subsequently so I missed that fact when I was trying to connect to it via the HM-10.
I don't believe the HM-10 supports pairing connection. I tried setting AT+TYPE to other than 0 but it would no longer connect to the sensor. I would get OK+CO11A but it wouldn't finish connecting.
I switched to an ESP32 board and used
BLEDevice::setEncryptionLevel(ESP_BLE_SEC_ENCRYPT);
This allowed me to read and subscribe to the characteristic.
Related
I've done a lot of searching but have yet to find any examples of the data format for accessing a simple BLE characteristic. I have a CC41 (HM-10 clone) that I have set to master mode and successfully connected to a BLE server device using a PC terminal program and the AT commands. I now want to send the proper data to access a service such as Immediate Alert (0x1802) and it's Alert Level characteristic (0x2A06). I know the full service and characteristic UUIDs and the data value for turning the alert on/off. I can do so from the nRF phone app but it doesn't tell me the data protocol that is actually sent from the app. I assume that the UUID needs to be sent as hex data, not a string, but nothing I've tried so far works. If the phone app can do it, then I would think that I can do it manually as well. Any ideas?
I've been tinkering with the HM-10 board for a few weeks now, trying to push data from phone to module and vice-versa. The ultimate goal was to enable the BLE mode and tweak with the characteristics and GATT profiles. I'm pretty new to this domain so can anyone help me out ?
And is there any way we can interface the HM-10 with the hardware rx-tx channel instead of soft-serial ?
Your question is still not very clear, but i think you mean sending AT-commands over BLE-radio.
To make this possible you have to change the MODE using serial connection.
In standard mode the device can only be configured over the serial connection (pins RXD and TXD) using AT commands.
AT+MODE0: It only accepts AT-commands over the serial connection (RXD/TXD)
until a central device connects to the module.
AT+MODE1: Same as MODE0, once a connection is established,
AT-commands can be sent over BLE and manipulate some PIO pins on
the device.
AT+MODE2: Same as MODE0, once a connection is established,
AT-commands can be sent over BLE.
To test it just send a string to hm-10 as "AT\r\n" and it will respond with OK.
Update:
You cannot change the services and characteristics with AT-commands.
There are a lot of other things you can change,like advertising, setup a beacon and change a lot of settings.
For a full list of AT commands and more see the official data sheet:
http://www.jnhuamao.cn/bluetooth41_en.zip
I want to try to set up an ESP8266 (using the Arduino IDE) to occasionally connect to a wifi SSID to send telemetry back. I also would really like to be able to have it running a softAP for configuration/settings purposes. (i.e. so if you want to change internal settings in your code, you can connect directly to the device to access a web form to do so)
The problem is, I am not 100% sure how I know which is which when making an outgoing telemetry json query. I want it to go out on the STATION mode connection. Presumably in most cases the AP mode won't be connected, but there may be rare instances where both are connected at the same time. Thus how do I tell the device to specifically use the STA side of things when it needs to send data back over the internet?
I can't even seem to find any specific examples to ask if one or the other is connected. (you can poll WiFi.status() but - which one is it reporting?)
Any help is appreciated
I am using an HM-10 module and Arduino UNO.
My requirement is to read data from ibeacons near me using Arduino. Is it possible? I have not been able to find any articles on this. All articles talk about connecting your android phone with arduino. Any idea?
Yes, it is possible. I'm using an HM-10 as an iBeacon detector (linksprite.com BLE 4.0 shield), and it is successfully detecting a RadBeacon running in iBeacon mode. Firmware on my HM-10 is version 540.
Before it would detect the RadBeacon, I had to send the HM-10 the following commands:
AT+ROLE1
AT+IMME1
AT+RESET
Then I used the AT-DISI? command, and the serial monitor is showing the broadcast received from the RadBeacon (and one other beacon) as follows (for example):
OK+DISISOK+DISC:4C000215:2G234454CF6D5A0FADF2F4911BA9FFA7:00000001AC:0CF3EE041CCE:-052OK+DISC:00000000:00000000000000000000000000000000:0000000000:B9782E08068C:-071OK+DISCE
In this example, the HM-10 is detecting my RadBeacon which has UUID of 2G234454...with signal strength of -052. It is also detecting another BLE beacon (my AppleTV downstairs) with UUID of B9782E08068C with signal strength of -071.
I'm definitely not very knowledgable about any of this stuff, but it seems to be working for me so far. Next challenge for me will be to figure out how to parse the text data being received. I'm mostly interested in the distance/signal strength data in order to trigger an action when the RadBeacon gets very close to the HM-10.
[Full disclosure: I jumbled some of the UUID numbers above since I'm not sure if any of this information is private or hackable or whatever]
[By the way, the nRF8001 BLE Shield will not do this since it only runs in peripheral mode.]
Yes, you can get the Min and Max number of the nearby iBeacons.
You need to Attach hm-10 to Arduino Uno.
Try using this Library : https://github.com/dinosd/BLE_PROXIMITY
You can configure suitable AT commands if you want to configure it. But it should work with default settings as well.
Use SoftwareSerial to access HM-10.
In firmware version V539 of the HM-10, it adds an AT command to list nearby iBeacons. The command is AT+DISI?. You would simply need to set up the Arduion to send that command over a serial port and parse the data it returns.
Can anyone help me with the AT command to write characteristic value, Or how to send data from arduino to another ble device using Hm10 module.
The HM10 after sending the AT+START, does advertise packets, and can detect the service and characteristic, But the characteristic value is the default 0x00, How can I change that?
Have checked the data sheet multiple times but can not find an AT command that is capable of doing the same.
UPDATE: Similar problem with setting the HM10 in Central Mode:
Central Mode Setup!
1) AT+ROLE1 - Set up to Central Mode
2) AT+IMME1 - Start from RESET
3) AT+SHOW1 - Show discovered devices
4) AT+DISC? - Discover Devices
Get Device MAC ID,
5) AT+CON[MAC ID]
RESULT: Always gives OK+CONNA and after 10seconds OK+CONNF
I am confused, Use of "AT+START" before "AT+DISC?" causes AT+START to not work and viceversa.
Using AT+START results into a loop of OK+CONN followed by OK+LOST continuously and no more AT commands are accepted. I believe it does result in a
Can you advice on the right order?
Using LightBlue iOS app as the peripheral. How am I to select a service and subscribe to a characteristic to receive data from the application?
Thank You.
There is no AT command to set a characteristic value.
The HM10 is a serial-port emulation device - whatever serial data you send to the HM10 module (aside from the AT commands) is made available on it's BLE characteristic. Unfortunately the data sheet doesn't document the service and characteristics, but this code suggests that the serial RX/TX characteristic is 0000ffe1-0000-1000-8000-00805f9b34fb
So, data written to the serial port should appear as the value of that characteristic. Data written to that characteristic should be delivered out of the TX serial port pin on the HM10 module.
This thread is a bit dated. But the HM-1X firmware now supports changing the characteristics of a module.
"AT+CHAR?" Will get the current characteristic setting for RX/TX
"AT+CHAR0xFFFF" will set the TX/RX characteristics to 0xFFFF
Send: AT+CHAR0xAAA0
Recv: OK+Set:0xAAA0
These features were added v518.
If you need to update your firmware,
Link to Huamao's download site.
I don't have enough reputation to comment on Ladvien's answer, but...
Just a word of warning regarding updating the firmware with a new version from Huamao's download site. http://www.jnhuamao.cn/download_rom_en.asp?id=83
In my experience there were issues with V539, which prevented the firmware operating as an iBeacon - and there may be other problems.
I was fortunately enough to find someone emailed me a copy of the V538 firmware and was able to downgrade again.
Huamao doesn't have old versions of the firmware available for download and AFIK there is no way to backup your current firmware version.
But it was possible to downgrade from V539 back to V538 if you have the bin file for V538 etc. i.e At least up as far as V539 the firmware does allow downgrades and was not checking version numbers to only allow upgrades.
No need to use any AT-commands to send data as it works like transparent serial. Currently it works good to upload sketches from iOS devices to Arduino. Check out http://www.apploader.info