Bluetooth bLE not connect

Hello,
I try to connect to a BLE with appinventor with your last extension 20200828.
I can see the name of the ble on Android in the liste on the Ble avalaible.
My systeme works very well with nfrconnect on android, but when I use my program who try to connect to the target, in doesn't works. Here is the status of the no connexion:
connection status was set to OS code 133
Could you help me please. I don't understand why I don't connect. I use the command connect with Mac address.
And when I use the function which allows to list the available BLE targets, this list is not at all stable, nothing to do with the stability of the NRFconnect qur Android application which works perfectly. There must be some issues with the version of your latest BLE extension. Could you try again. Thank you.
I am using android 10 and a oneplus6.
But what I do not unserstand, that it is working with nrfconnect, and not with appiventor.
Thanks. Julien

Hello, I try many methods to try to connect, trought MAC, Name+UUID, index in list, but nothing works. But it works perfect with NRFconnect. SO there is an issue with the last BLE extension? Thanks to help.

Hello,
I made another application with an ESP32 in C language, and it works.
But when you use the ESP32 to program it in Micropython with the official bluetooth module, there are concerns, while it works perfectly with NRFconnect. This means that your ble extension is not compatible with a standard. Could you look with the bluetooth micropython to check where this is coming from. Obviously there must be settings that your extension does not respect and that NRFconnect respects. This means that the bluetooth module is correct, but your BLE extension for appinventor does not meet a standard. To do this, simply upload the micropython firmware to the ESP32 and then test the program which works in micropython with NRFconnect. Thank you for your help.
The program in micropython BLE is here
http://icnisnlycee.free.fr/images/SNT/objets_connectes/ble_esp32_micropython/ble_esp32.py
Le firmware micropython pour ESP32 est dispo ici:


Il fact, I can pair BLE on Android parameters with my target BLE. But I can't under micropython. But I can connect with NRFconnect without paring BLE?

My project run perfectly here:
http://icnisnlycee.free.fr/index.php/57-nsi/projets/75-balise-de-signalement-pour-aeronefs-sans-personne-a-bord

Thanks to test.

Hello Julien

  1. We need to see your App Inventor Project
  2. What is the device you are trying to connect to, and what Bluetooth version is it?

I'm not familiar with this code - do you have a reference you can point to?

Based on my research it seems like this can happen when the device supports both LE and BDR/EDR transports. I've created a test version of the BLE extension that forces LE connections starting with Android 6.0 Marshmallow and up (the API to do this was introduced in 6.0).

I've also added a DeviceSortMode property, which you can use to specify how the devices are sorted in the list. The default option is RSSI, which matches the old behavior. You may want to consider switching it to "Discovery" or "MAC" if you're finding that the devices are moving around too much for your taste. The version number is 20201223.

P.S. The sort is perfectly stable (Java uses mergesort as its sorting algorithm), it's just that the devices are sorted by signal strength which will change as the devices and objects move in space.

1 Like

(added to FAQ)

Ok, I found the solution. I use bad Python program. Now I found the good one, all works! Thanks :slight_smile:

esp32_ble_micropython.aia (190.3 KB)

Hi @ewpatton,

I am also having the same issue that Julian had. My objective is to connect to a Lego Spike Prime Hub running the same UART Bluetooth Peripheral Micropython program that Julian is using in his post in this thread https://community.appinventor.mit.edu/t/bluetooth-ble-not-connect/22771/9.

When this Micropython code is running on the Spike Prime hub I am able to connect with both the nRF Connect and BLE Scanner apps but I am not able to connect with the basic IoT Bluetooth Connection example App Inventor App (http://iot.appinventor.mit.edu/#/teachers/tutorials).

Reading your response in this thread I installed the 'BLE-device-sort.aix' version of the BluetoothLE extension. Using this I was able to connect on one occasion but was unable to get the test transmission to show in the Lego Micropython console unless I implemented the 'IRQ_PERIPHERAL_CONNECT' event. This suggests that the App Inventor app seems to be connecting in peripheral mode. Following this one successful connection, I have not been able to connect successfully since, despite having reset all devices etc.

Any help much appreciated.

Regards,

Paul.

I am facing the same issue as this person. Tried your updated '.aix' but even that didn't seem to work. I am using an Arduino BLE 33. It's appearing on the NRF connect but not on the app I created using the MIT Inventor. I have attached the pictures. The 'Scanning' property returns false (upon pressing the SCAN button). I have assigned this as the text for the label. I even tried to install the apk on my phone and even that didn't work.

Please help me out! Thanks in advance!

Good day All,
I'm facing the same issue getting OS 113 error while trying to connect ESP32 (DOIT generic board) to App inventor using BLE.
Used same code posted by Jullien (thanks!) for micropython and esp32_ble.aia
Micropython code works fine for nRNF Connect and Serial BT Terminal apps.

Any suggestion?
Thanks!
Tincho

Thank you! This works for me to solve code 133 problem.