I am trying to pair a HC-05 module to a Raspberry pi 4B. Every time I do so the module disconnects 2 seconds later. I have tried multiple power setups within the 5v range with splitting the power to 3.3v for the rx pin. I have successfully paired two of these modules together. I have also used different brands of the HC-05 modules, both types pair to the ras pi but than disconnects from Ras Pi and on Windows 11 computer 2 sec later. The Arduino I am using to power the ble module has a blank sketch with the HC module in slave mode and cmode = 1. I am using this link as a tutorial https://www.youtube.com/watch?v=hBqmAM1tZR8&t=336s
HC-05 is not a BLE module.
You appear to be working a Bluetooth in configuration mode, which means that you cannot communicate with another Bluetooth until you revert to communication mode.
Forget the YouTube and check the Martyn Currey website.
After making the changes in AT mode, I remove power to the EN pin and restart the BT module (I said ble because I thought it was an abbreviation for Bluetooth) so that the built in led rapidly flashes before trying to pair to the ras pi, still it connects then disconnects 2 sec later. I have been successful in pairing two BT modules together earlier.
What are a requirements to pair the HC-05 module to a windows 11 computer/RaspberryPi 4B?
Found the problem. After pairing the HC-05 module to the computer it will disconnect 2 sec later, however, to actually communicate to the module you need to select the right com port on the Arduino ide until the built-in led in the BT module blinks twice every couple seconds. At that point a connection was made and the BT module is "paired" to the pc.
How do you know which comport the HC 05 is going to be appear in your computer? I thought you couldn't even connect your HC05 with your PC in the first place? I am facing the same problem, except it doesn't even last 2 seconds. It's less than that. It shows successful connection and soon disconnects.
You have to try all the available com ports. It is the same problem, once it “pairs” and disconnects, turn on the module/arduino without being pluged into the computer and switch through the com ports on the arduino ide serial monitor until you see your test message if you have one.

