HC-05 Bluetooth module connection to iMac using MacOS fails, constantly

I have an Arduino UNO device I am using to create a serial adapter for my car ALDL to it’s ECU, and which is linked to an HC-05 Bluetooth module.

I am trying to get a stable Bluetooth connection to my iMac (using MacOS Ventura 13.6.4) but I’m having little luck.


The HC-05 is a standard Bluetooth module (i.e. v2 .0), not a BLE module (i.e. v 4.0)


I can get a connection but --

  1. When the iMac sees the HC-05 module it mostly sees it as "Generic", not the name given to the module "BTHC-05".
  2. It takes numerous attempts (with each attempt taking approximately 25 seconds to complete) pressing "Connect" to pair the iMac with the module. Mostly the spinning rosette shows but the PIN code window does not after pressing connect. When the PIN code window does show and a PIN is entered the spinning rosette shows again and when it stops the "Connect" button is just redisplayed.
  3. When it finally does pair and connect the Bluetooth settings pane does see the device as "BTHC-05", and shows "Connected"
  4. If I am not quick enough to get an App (in my ‘testing’ case I use 'screen /dev/tty.BTHC-05' in a Terminal window) up and running the module shows as disconnected after 15 seconds or so
  5. If disconnected I cannot subsequently get 'screen /dev/tty.BTHC-05' in Terminal to run
  6. If I am quick enough to get 'screen /dev/tty.BTHC-05' entered there is a response in the terminal window showing that a connection can be made and data received. Sometimes the Bluetooth settings pane shows "BTHC-05" as “disconnected" but the response continues and this flips back to ”Connected"
  7. If I then deliberately disconnect (Bluetooth settings pane shows disconnected but the module device line remains, indicating there is still a pairing between the module and the iMac), and connect again, even if the Bluetooth settings pane shows connected, I am unable to get 'screen /dev/tty.BTHC-05' in Terminal to run.


I get the following two lines of error message

Cannot open line ‘/dev/tty.BTHC-05’ for R/W: Resource busy

Sorry, could not find a PTY.


The usable connection only seems to be there after the initial pairing with the HC-05 module and the first usage of an App with the connection.

This being the case the next move was to right-click on the device in the Bluetooth settings pane window to “Forget device”.

Each time it takes 2 attempts to “Forget device”. Pressing the “Forget device” button a first time appears to be accepted but the module device line remains showing disconnected. It is only after the second time pressing “Forget device” that the module device line is removed from the Bluetooth settings pane window.

If attempts are made to "Connect" the device after the first attempt to “Forget device” it does sometimes work but the actual connection fails giving the same error messages as above when ‘screen /dev/tty.BTHC-05' in Terminal is run.


If, after a successful “Forget device, the HC-05 module remains powered the Bluetooth “Search nearby devices” more often than not shows "BTHC-05" as available rather than just a "Generic" Bluetooth device being available.

Fewer attempts are required to pair to this, now available, "BTHC-05" device than the noted "Generic" device as above but when paired and connected the above two lines of error message are, again, all that is seen when trying to get 'screen /dev/tty.BTHC-05' in Terminal to run.


When the HC-05 module is effectively powered down by removing the Arduino USB cable from the iMac and the HC-05 module powered back up by re-inserting the cable into the iMac the pairing and connection can be re-established. However, this only enables all of the above to repeat with data transfer only happening after the initial pairing and first use of 'screen /dev/tty.BTHC-05' in Terminal.


A long problem description but hopefully sufficiently detailed. If there are any questions please reply to this posting.


Any assistance, advice and/or examples that can help to resolve this connection problem will be much appreciated.

Even if the suggested solution is to obtain a BLE Bluetooth module, in which case suggestions as to possible alternatives would be helpful.




Posted on Feb 20, 2024 11:20 AM

Reply

Similar questions

There are no replies.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

HC-05 Bluetooth module connection to iMac using MacOS fails, constantly

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.