HC-05 bluetooth not working

Hello,
i created a simple app in MIT app inventor that should connect to my hc-05 (under name "LINE_AVOIDER", i change it) but it fails with error 507 and i dont know why.
Here are some pictures:



I tried connecting my bluetooth headphones to the app and it worked.
My hc-05 is just connected to power and blinks fast (not connected).
I do not have any other bluetooth apps running in the background or connected to my hc-05.
I also tested the connection with Bluetooth Serial app and it worked normally, I could send data and recieve it using stm32 (for testing).

Please i need help figureing it out because im loosing my mind.

1 Like

Try moving the three permission requests to screen1.initialize, to give them time to succeed.

There are permission success and failure events that you could add to insure permission success.

For other possible 507 reasons, see the last months' 507 posts:

https://community.appinventor.mit.edu/search?expanded=true&q=507%20after%3A2025-11-06

OK so i moved them to screen initialize and

  1. after permitting fine location it said permission denied:

  2. when i tried to do just bluetooth scan permission it granted it but crashed shortly after.

  3. when i try to fit all 3 permissions inside init is sends some stack overflow and crashes again.

Look for a Permission Granted event block too.

The order might be important.

You might need to ask for the next permissions only after the preceding permissions were granted.

That's a list or an if/then/elseif ladder in the permission events.

You can pull in the location sensor to get the location permissions automatically.

Make sure there isn't a Clock Timer banging on Bluetooth prematurely.

How to correctly ask for Bluetooth permissions see here

Taifun

Hello,
I tried both examples but still no connecting to hc-05.

Hi,
I made this monstrocity but it is still far from working :frowning:

Do you get rhe dialogs for scan and connect permission?
Use the permission helper blocks to ask for permissions, see again the example snippet

Please elaborate what is working and what not. Do you get a list of devices? If yes, what happens after selecting your device in the listpicker?

Is your device paired?

Taifun

Yes my hc-05 is paired and blinking (not connectedd).
Im am using MIT AI3 companion for testing with all needed permissions allowed (fine location bluetooth scan and connect).
When i launch Test2 it shows me list of device (HC-05 visible) when i click on it it still shows error 507.
I have no idea what is wrong.

Try the apk file
Still no luck? Try the recommendations in this thread
.

Taifun

Repairing the device did not do anything. I have the exact same module that is on the thread you linked. launching it as apk app does not fix.

Also point out that Bluetooth serial monitor app is working fine.

Maybe this will help: i use android 14.

OK GUYS I FOUND THE ISSUE!
I used BluetoothLE extention with some simple code and it connected succesfully. If anyone else has this problem link them this post.
Example block code (you need to remember MAC address but it works):


extension i used:
https://www.professorcad.co.uk/Bluetooth/BLE-device-sort.aix