Android Question BLE - Communication with HM11 or HM10

Dear All

I will appreciate a basic example describing data exchange between Android application and HM11

Preferable A to Z example even though I managed to connect to the specific HM11 but cannot transfer data either direction.

Thank you in advance
Danny
 

f0raster0

Well-Known Member
Licensed User
Longtime User
Try this:
 
Upvote 0
Thank you

I tried it and data indeed reached the HM11. However:
1. Pairing took place without any authentication, name or password.
2. The example dose not include data transfer from the HM11 to the handset, I think I will manage with this.

BLE has got quite a few new terms. Mastering them is not trivial and probably not required for most users.

It would have been so nice to have a simple, all inclusive example showing the full loop, Paring. Sending and receiving data.

Should I manage, I will post it.

Kind regards
Danny
 
Upvote 0

rabbitBUSH

Well-Known Member
Licensed User
Thank you

I tried it and data indeed reached the HM11. However:
1. Pairing took place without any authentication, name or password.
2. The example dose not include data transfer from the HM11 to the handset, I think I will manage with this.

BLE has got quite a few new terms. Mastering them is not trivial and probably not required for most users.

It would have been so nice to have a simple, all inclusive example showing the full loop, Paring. Sending and receiving data.

Should I manage, I will post it.

Kind regards
Danny
Danny - if this project looks something like what you are trying - hit the like - and I'll dig something out in due course - see if it will help. I can't remember if this is using H10 or what, though. I think it maybe with a arduino beetle......principles should similar.
 
Upvote 0
Hi

We are trying to establish communication between an App and our board.

In the past we used the HC06 which was straight forward:
1. We set the name and password on our board.
2. We paired with the board using the Bluetooth management of the handset.
3. We could connect, using the unique given name, and communicate with our board.

We need to move to BLE as IOS dose not see the HC06.

To date, modifying this example:


I am communicating with our board with ASCII strings, see attached project.

The next issue I need to resolve is how to make sure the paring is controlled with a name and password.

Any advice will be appreciated

Danny
 

Attachments

  • BLE.zip
    211.8 KB · Views: 118
Upvote 0

klaus

Expert
Licensed User
Longtime User
Last edited:
Upvote 0
You may have a look at this chapter HC-05 Bluetooth in the B4R Example projects booklet.
The examples are with a HC-05 module and not a HM-10.
But the principles seem to be the same after having read THIS.
Thanks Klaus
However, HC05 and HM10 are completely different.
The HC05 is straight forward to use, it took 10 minutes before we communicated with our board.
The BLE is a different cattle of fish.

At this stage I am communicating but trying to make pairing controlled using name and password just like with the HC05.

Regards
Danny
 
Upvote 0

f0raster0

Well-Known Member
Licensed User
Longtime User
We need to move to BLE as IOS dose not see the HC06.
I have the HC-06, and it detects the module, but I might be missing something.
The HC-06 is a bit slow to connect; pairing and all those processes take time. It's easier to connect using BLE.

to connect to your module you can add the name or ID like this:
B4X:
Sub Manager_DeviceFound (Name As String, Id As String, AdvertisingData As Map, RSSI As Double)
    Log("Found: " & Name & ", " & Id & ", RSSI = " & RSSI & ", " & AdvertisingData) 'ignore
    If Name= "H10" Then
'    If Id = "6D:D4:F2:0C:A4:74" Then
    ConnectedName = Name
    manager.StopScan
    Log("connecting")
        #if B4A
    manager.Connect2(Id, False) 'disabling auto connect can make the connection quicker
    #else if B4I
    manager.Connect(Id)
    #end if
    End If
End Sub
check this BLE example this example also include the new permitions, etc..

If you want to add "security," you might need to include a service/characteristics to activate communication with your module..itcould be the next step after you make working the conection and comunication with your HC-10
 
Upvote 0
Thanks guys

In the meanwhile I did some progress. I will post the project once finished.

When all else fails try the instructions:

The password issue was too simple !! The HM11 must be set to AT+TYPE2, It than asks for the password before it pairs

Now that I managed to connect and communicate with our board, I fined out that the data received is in 20 byte chunks.

Any idea? can it be modified to 100-200 bytes?

This is not critical as I can puzzle the full packet from the chunks but still.

Thank you kindly
Danny
 
Upvote 0

Danny Marom

Member
Licensed User
Longtime User
Hi All

Back to the password issue, setting the HM11 to TYPE 2 indeed forces the application to pair with password

But there is a major drawback, you must enter the password every time you open the application.

This is not exactable, with the good old HC06, we pair once, with password, from the cellphone connection management,

We could than open the App and connect with "connect" button.

Is there a way to do the same with BLE? Pairing once with the cellphone utilities and connect from the application as needed?

Attached is a small project I am using with the Rx and Tx HM11 connected together so that I am getting back whatever I send.
 

Attachments

  • BLE.zip
    41.1 KB · Views: 87
Upvote 0
Top