I'm working on remote operated camera pan/tilt device that uses a HC-05 Bluetooth module to connect a GUI written in Processing and running on a Mac to the Arduino. Everything works great when I first pair the HC-05, but if either the HC-05 or the Mac Bluetooth gets power cycled, they won't reconnect automatically. If I choose the device in the Bluetooth menu or right-click and choose Connect in System Preferences, it spins for a moment and says "connected," but the LED on the HC-05 still blinks "disconnected" and no data is transmitted.
The problem appears to be a change in the way MacOS (or newer Apple hardware?) handles Bluetooth serial. On a Mac running Catalina, if the HC-05 is power cycled, as long as I also close and re-open the process connected to it (eg Serial Monitor in the Arduino app), the HC-05 reconnects. For some reason, the same device appears in /dev/ as "DeviceName-DevB," but on Monterey it just appears as "DeviceName" in Catalina, which suggests to me that there's some under the hood change, but I can't figure out how to get it to reconnect without removing and re-pairing it in System Preferences each time.
It's paired from the Bluetooth pane of System Preferences. After pairing, it shows up in /dev/tty.bescor (the HC-05's assigned name), although sometimes I have to additionally right-click and choose "connect" for it to appear there.
On Catalina, the HC-05 would automatically reconnect every time I sent data to /dev/tty.bescor-DevB (why it appended "DevB" I don't know). On Monterey, sending data to /dev/tty.bescor after the HC-05 has been power cycled is a black hole. The HC-05 just sits there and blinks "disconnected."
Interestingly, it does reconnect if I close the connection (close the Processing app, HC-05 blinks disconnected) and start a new connection without turning off the HC-05. This same exact unit also reconnects just fine after power cycling when used with a Mac running Catalina.
If you disconnect properly from the app and the HC-05 is still around, it makes sense that a new app can grab the device handle (/dev/whatever) since the pairing is still alive and managed by the OS.
If the HC-05 is gone, the handle is stale and it might be a security feature that the reconnect does not work without user action to confirm you are pairing and sending the password to the right device and not something else posing as your HC-05 with a stronger signal (prevent man in the middle attack).
This would seem legit but on the other hand the OS allows for reconnecting to known WiFi SSID automatically which could lead to a similar attack…. (But you have control on this in the WiFi preference pane)
So It might also just be a bug …
Developing at core Bluetooth level rather than higher up in Java / Processing might open up better features
How hard is it to learn to make a Mac native app from scratch? All I need it to do is draw a simple GUI for operating camera pan/tilt motors, and send commands via serial.
Spent a few hours yesterday, even with a logic analyzer, did not understand why, until saw your post. life saver.
And it's really annoying that I have to remove and pair it again every time.