Arduino HM-10 read data

592 views
Skip to first unread message

Damian Klepacki

unread,
Apr 9, 2017, 4:35:43 PM4/9/17
to MIT App Inventor Forum
HI, I still working on my cool uni project. I decided to upgrade my current hc-05 to BLE module hm-10. 
I have been doing lots of research how to make HM-10 work with app inventor. I have found external library BluetoothLE1. 
I have been playing around with it for a few days now and I was able to Write data to my Arduino, but for some reason, I can't read data.
I tried to read all the data types there are on the list, doing it with on click and with timer, and can't ready any data. Could someone please tell me what I'm doing wrong? 



Damian Klepacki

unread,
Apr 10, 2017, 8:57:06 AM4/10/17
to MIT App Inventor Forum
Any help please ?

Neil Kenyon

unread,
Apr 10, 2017, 10:15:55 AM4/10/17
to MIT App Inventor Forum
Try using the valueChanged event, instead of valueRead.

BLE extension is still experimental and doesn't always work the way you expect it to.

Neil

Abraham Getzler

unread,
Apr 10, 2017, 10:17:53 AM4/10/17
to MIT App Inventor Forum
How do you know on the AI2 side if you have successfully connected?

Do you have a BlueTooth 4.0 Android terminal app you can try on your device
to see if it can connect to the HM-10?

ABG

Damian Klepacki

unread,
Apr 10, 2017, 10:42:31 AM4/10/17
to MIT App Inventor Forum
Neil, I tried to print 2 values and use value change event no success. Abraham I did try it to use with BLE scanners and it connects succefully. Also with app inventors, I successfully connect to the module with the address and I can WRITE data, but there are no success of reading data :( 

Abraham Getzler

unread,
Apr 10, 2017, 11:26:00 AM4/10/17
to MIT App Inventor Forum
I haven't used BLE yet, having no hardware,
but from what I've seen in this forum, people connect
to different data streams on the same connection by UUID.

But I don't see in your sketch any place where you 
set a UUID for subsequent communication.

ABG

Neil Kenyon

unread,
Apr 10, 2017, 11:44:53 AM4/10/17
to MIT App Inventor Forum
If it works for writing but not for reading, perhaps you need to use a different UUID? just a thought.

Neil

Damian Klepacki

unread,
Apr 10, 2017, 11:52:31 AM4/10/17
to MIT App Inventor Forum
Thanks guys for trying to help me, a deadline for this project is in 2 weeks need to sort this asap. Neil, I I tried getting a list of available services and characteristic with a method from BLE extension. But none of them works except the one I'm using now (tested them writing data). Abraham could u explain please, I don't quite understand what u mean 

Abraham Getzler

unread,
Apr 10, 2017, 11:58:23 AM4/10/17
to MIT App Inventor Forum
I have some links to BLE projects in the BlueTooth/BLE section of this FAQ:

I also suggest searching for HM10 AT commands
online to find ways to control the HM10 communication channels.

ABG

Damian Klepacki

unread,
Apr 10, 2017, 12:10:18 PM4/10/17
to MIT App Inventor Forum
I have looked at a lot of BLE project including heart monitor, analogue read lesson http://www.appinventor.tw/ble_analogread, temperature monitor http://www.appinventor.tw/ble_lesson5_dht11 : all of them use Arduino 101 that has BLE build in and use BLE library on their Arduino board to take care of UUID. Which in my case doesn't work because I got external BLE module. Regarding AT commands.


Funny enough the one from amazon respond well to AT commands, but I can't connect to it with its own address. I had to use connect at index (1) method, connecting that way makes it impossible to disconnect 
The cheaper one from eBay(I think it's a clone) connect well with its own address in app inventors, but none of AT commands works on it. 
So as u can see I'm in the very wired spot, got 2 modules from 2 different places, they spouse to be the same but work differently. I really don't know what to do. I need to increase a range of my RC project from 10m (hc-05) to around 60m HM-10. 

Abraham Getzler

unread,
Apr 10, 2017, 12:23:10 PM4/10/17
to MIT App Inventor Forum
Have you searched for "counterfeit HM10" yet?

Your deadline is approaching, and you don't have many shipping delays to waste.

I would look for a high quality chip from a high quality supplier.

Also, this may not be the most populated discussion board to find chip advice.

ABG

Damian Klepacki

unread,
Apr 10, 2017, 12:46:31 PM4/10/17
to mitappinv...@googlegroups.com
Yes, I understand that is more programming them chip forum. 

I did look at the data sheet and read about a counterfeit module.

The cheap one from eBay looks like it's counterfeit and it's not responded to AT commands. Amazon one looks like original and its responded to AT commands, but can't connect with the address( is not that big a problem, because I can still connect with connect by index method)   

 I don' t thing is a chip problem because both of them successfully connect to app inventors and  WRITE data, but they can't READ. There for I think its something to do with programming. 

Neil Kenyon

unread,
Apr 10, 2017, 1:04:33 PM4/10/17
to MIT App Inventor Forum
Download nRF Connect from the google playstore (it's free). I have used it to examine BLE  devices very successfully.

Can't guarantee it will work with HM10 - fake or genuine.

Neil

Ghica

unread,
Apr 10, 2017, 1:19:46 PM4/10/17
to MIT App Inventor Forum
Your sketch does not look at all like a BLE profile implementation. You have to Google a bit to find out what to do. Arduino 101 is a good source of examples, or maybe the HC-10?
Besides, the BLE extension is VERY experimental. We are all waiting anxiously for an update.
Cheers, Ghica

Damian Klepacki

unread,
Apr 10, 2017, 8:51:28 PM4/10/17
to MIT App Inventor Forum

I played around with BLE scanners and found out that on them also when I send data it comes up on my Arduino screen but when I want to read any date keep getting same weird ASCII code. Anyone could explain >? 

Ghica

unread,
Apr 11, 2017, 2:29:18 AM4/11/17
to MIT App Inventor Forum
As I said, you should set up your sketch as a proper BLE profile. I cannot help you with this. The App Inventor BLE extension assumes that you have set up your sketch properly.
Here are some links to get you started:
https://www.bluetooth.com/develop-with-bluetooth
https://evothings.com/control-an-led-using-hm-10-ble-module-an-arduino-and-a-mobile-app/
https://learn.adafruit.com/introduction-to-bluetooth-low-energy/gatt

There are also examples in the FAQ, BLE section. Some have sketches included:
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!category-topic/mitappinventortest/2cd6Uz__xA0
Cheers, Ghica.


Reply all
Reply to author
Forward
0 new messages