ESP32-WROOM-32 Does not Work with MIT App Inventor in BLE Mode (BluetoothLE)?

I have been having difficulties in connecting my ESP32 to my phone using MIT App Inventor in BLE mode (with BluetoothLE extension). It works fine when I am with Classic Bluetooth (BluetoothClient). Then I found this on GitHub - mo-thunderz/BleMobileAppMitAppInventor: MIT App Inventor Mobile BLE controller app :

Does anybody have the same experience?

Let's not forget that the ESP32-WROOM-32 has a status of 'NRND', meaning it has not been as successful as Espressif Systems expected and so production will be halted.

It isn't so long ago that ESP32 did not support BLE, I don't know if any of this model only supported BT Classic originally? That would explain why you have had success with BT but not BLE. On the other hand, it could be an error in your Script or in your App Inventor Blocks.

1 Like

Perhaps other libraries must be used for this module. Also, choosing the right board in an arduino environment can affect performance.
The question is do other ble communication apps read anything from your esp?

I checked with nRF Connect and it shows my ESP32 device using the same Arduino code.

I use ESP32 Dev Module board from ESP32 by Espressif Systems, Additional Board Manager URL: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json, IDE Serial Monitor at a baud rate of 115200.

Since the nRf Connect can connect to my ESP32, I assume my Arduino code is good.

Since nRF works, you should assume your Code is wrong?

Have you seen Juan's ESP32 guides?

Are you simply having issues with BLE permissions/location on Android? What is your Android version?

Hey Chris, thanks for the guide link. It looks extensive, I should be able to get a lot of information about the ESP32.

The issue I am having is that my phone does not want to connect with the ESP32. It can recognize and scan the device and shows it on the ListPicker but it just would not connect.

I am using Samsung Galaxy 20 Ultra with Android version 13.

I followed Juan's guides unfortunately without luck. He used Neil Kolban's ESP32 library but it gives a conflict with the built-in Arduino IDE's ESP32 library. I am using the latest version of Arduino IDE (version 2.1.1) . I have tried disabling the Arduino IDE's built-in ESP32 library but it did not work either. Perhaps I should move back to the earlier Arduino IDE version.

Make sure it is not a permissions issue - do you request the connect permission? Have you set the location permission? - drag and drop a location sensor into the project.

Are you using the very latest version of the BLE Extension?

Version: 20230728 Released: 28-07-2023 Package Name: edu.mit.appinventor.ble-20230728.aix

These are my permission blocks that I have also tried.

Scrap that look-up, it is not reliable. Use one of the little extensions for that task instead.

Add the Location 'trick' too.

On my website:

https://www.professorcad.co.uk/appinventortips#TipsBluetooth
https://www.professorcad.co.uk/appinventortips#TipsESP32

1 Like

Sorry, which little extensions? And what is the Location 'trick'?

Yes I am using the latest BLE Extension 20230728.

I have already told you how to trigger Location permission.

How to use GetApiLevel Extension (substitute BT with BLE Blocks)

Yes, I think I understand. Please let me know if this looks ok.

Thank you!

Hi, well there are a few errors/typos. Study your code carefully.

Hello Chris!

I deleted the top BluetoothLE1.StartScanning in the "when ButtonScan.Click" block.

It may not be part of the errors but also I changed the ListPicker to ListView.

Please let me know if there are still mistakes.

Thank you!

Before committing to the ESP32-WROOM series, I suggest you ask Expressif if they are going to continue making them for the foreseeable future.

1 Like

That's not necessary - there can be several different libraries essentially offering the same functions, you just pick the one that suits your project best. What is the conflict? Are you trying to use two libraries?

This was my code:

#include <BLEDevice.h>
#include <BLEServer.h>

// Define the UUIDs for the service and the characteristic
#define SERVICE_UUID "6effc9e5-62e7-40e2-81bd-255ec98872a3"
#define CHARACTERISTIC_UUID "e2f82484-c28e-4cc9-acd4-9aef7cd3cf15"

And I received these error messages:

d:\Documents\Arduino\libraries\ESP32_BLE_Arduino\src/BLEAdvertising.h:15,
from d:\Documents\Arduino\libraries\ESP32_BLE_Arduino\src/BLEServer.h:19,
from d:\Documents\Arduino\libraries\ESP32_BLE_Arduino\src/BLEDevice.h:18,
from C:\Users\wigun\AppData\Local\Temp.arduinoIDE-unsaved2023717-3456-deuswp.n19rd\sketch_aug17a\sketch_aug17a.ino:1:
d:\Documents\Arduino\libraries\ESP32_BLE_Arduino\src/FreeRTOS.h:61:28: error: 'ringbuf_type_t' has not been declared
Ringbuffer(size_t length, ringbuf_type_t type = RINGBUF_TYPE_NOSPLIT);
^~~~~~~~~~~~~~
Multiple libraries were found for "BLEDevice.h"
Used: D:\Documents\Arduino\libraries\ESP32_BLE_Arduino
Not used: C:\Users\wigun\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\BLE
exit status 1

Compilation error: exit status 1

But it has been resolved, now I use only the espressif's library and deleted the Neil Kolban's.