BLE connection failure esp32 Arduino 10

It's on the settings panel, along with things like Bluetooth on-off, Data on-off, Torch, Aircraft Mode, WiFi, Screenshot etc. However, it should be triggered by the location sensor component that is in the designer, and switched on if you give location permission. So sounds like that worked OK.

BLE error 133 is "too many connections". If you used nRF to connect before and it did not cleanly disconnect (no easy way of knowing), that would be the cause of the App failure. So would hitting the App connect button twice, which could happen inadvertently, so I have made a few modifications to the App. However, there could be a bug in the BLE extension code that records a connection even if connection failed, in which case we would also get a 133 error. So between tests, always clear the App from the phone's memory (tiny square button at bottom of phone's screen).

Question - how did you test the App? Only via Connect Companion or also by installing an APK? In my tests here, Companion shows greater success. Not sure if that's a blip, my environment, or a bug in the App's Manifest (which is produced automatically by App Inventor).

Patience required with this modified App as I have given it a whole minute to try to connect, though it takes less than that to fail:

BLE_connect_edit2.aia (228.1 KB)

OK. location is activated (was already at time of connection trial). The BLE connect app shows in the list off app ehich recently ask for acees to localisation.

I'm going to be away from my office for 10 days, so if you could perform the test with the Samsung now, that would be good :slight_smile:

By the way, you might get error code 257. I have read that it means "too many attempts to connect" or "connected too many times". Either way, switching off Bluetooth is the recommended fix.

Hi ChrisWard
I did the test on both (Samsung and Xiaomi), bpth get error 133. I added some "comments"in your modified app. Elapse time between seek connection and connection failure is about 6 seconds.
Gerard

Good idea about the "to many attempt to connect". At some point in time I had the impression that there was "some accumulation of data" or better wording "ageing of the app".

Unfortunately, stopping/starting BLE does not help.

I also stop BLE, power off android, start android, enable BLE. Still no success.

Gerard,

Ooops, I overlooked the "edit2" version. I tried it both with ai companion and directly from "apk", deleting the app in between trials.
Sorru, no sucess.

Gerard

An d no need for patience. The connection fails within a few seconds.

How do you power your esp32?

1 Like

esp32 powered from a PC usb port (tried from PC tower and portable). BLE connect sucessfully using nrf

What is nrf?

nrf connect is an app from Nordic Semiconductor for mobile. it allows to see devices advertissment, and allows to connect to these devices and to issue read/write/notify.
available from google app sore https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp&hl=en

To complement previous answer on powering ESP32, I am using an ESP32 development module that generates the ESP 3.3V with on-board voltage regulator.

Hi. I had the opportunity to access a Samsung with android 14. the app, installed with Ai companion , works as expected (connection successful). Anyhow I did not had a chance to repeat the connection request to check if it would fail after many connection requests.

Still have the problem with my Android 10,
Gerard

I discovered something interesting whilst on holiday in another country - BLE 'found' and listed my BLE Devices, even though none of them were with me except the Android 10 I ran the App on.....

Good cache!

2 Likes

The voltage is important of course, but at start-up (and when reading sensor values) the ESP32 requires at least 600 mA, which not all PC USB ports can deliver. A power pack to the VIN pin would probably be better.

I take note of your point about power supply. I do not think it can be the origin of my problem since connectiong always work using nRF and always fails with App inventor app.

If you get the chance to try the Android 14 device again (also Samsung?), install the App as an APK.

Hi Chris,

Good news.
The android app is now working and succesfully connect to my ESP/Arduino on Samsung.android 10 smartphone. I did not change anything on the ESP side. I reloaded AI2 companion (version 2.7.2, same as before), rebuilt and reloaded the AI app one more time on the phone, and that's all. I have no idea why it now works, wondering if some change was made on the App Inventor itself in the past few days (week).

I also made some test on the Android 14. Works fine when installed from apk or AI conpanion.

By the way also works on Xiaomi android 13 tablet loaded from apk.

Thanks a lot.

Gerard

No changes to App Inventor that I know of :thinking:

Still, sounds like good news. Let us know if anything fails again by opening a new Topic. Fingers and Toes crossed!