Bluetooth that automatically connects/reconnects?

Hi guys:

I have an application that communicates with Bluetooth between two Nano 33 BLE’s. The BLE will only connect if the two circuits are reset in the right order, then the Bluetooth works just fine…as long as the radio connection remains intact. If I disconnect power from either one or take it out of range, the other one just keeps looping like nothing happened. If it is brought back into range or powered up, the Bluetooth does not reconnect and you have to reset them in a certain order again.

What I want is something more robust. I want to be able to turn on the two units, in any order, and for them to automatically connect. I also want for them to automatically reconnect if the signal or power is restored.

I thought that’s what

BLEDevice peripheral = BLE.available();
if(peripheral) {…}


BLEDevice central = BLE.available();
if(central) {…}

were for. But they seem to just ignore when communication is disconnected. If I just had an indicator to tell me when the connection is lost, I could write the code to do everything I want.

I’m not always passing data, so I can’t just use data to tell if they’re connected. Isn’t there a simple way to know when radio communication has failed?


This is a know issue for the Arduino Nano 33 BLE with the ArduinoBLE library. When the connection is lost due to long distance or disruptions there is no real way of restarting the BLE connection. This works better on the Arduino Nano 33 IoT even though it uses the same library but not under mbedOS (which is used on the BLE).

There are a few post regarding these issues in the BLE/BLE Sense sub forum. Scroll down a bit or follow the link.