Problems with connecting BLE to AT-09/HM-10 board

I’m trying to send msg from my nano 33 BLE Sense board to an arduino mega through an AT-09 board (which is almost the same as HM-10, both are for bluetooth 4.0)

Here is my nano’s code (from: https://rootsaid.com/arduino-ble-example/):

#include <ArduinoBLE.h>
BLEService wandService("1101");
BLEUnsignedCharCharacteristic gestureMsg("2101", BLERead | BLENotify);

void setup() {
  Serial.begin(9600);
  //while (!Serial);

  //if (!BLE.begin()) 
  //{
    //Serial.println("starting BLE failed!");
    //while (1);
  //}
  BLE.begin();

  BLE.setLocalName("MagicWand");
  BLE.setAdvertisedService(wandService);
  wandService.addCharacteristic(gestureMsg);
  BLE.addService(wandService);
  //gestureMsg.writeValue(oldBatteryLevel);

  BLE.advertise();
  Serial.println("Bluetooth device active, waiting for connections...");
}

void loop() 
{

  BLEDevice central = BLE.central();

  if (central) 
  {
    Serial.print("Connected to central: ");
    Serial.println(central.address());
    
    while (central.connected()) {

      Serial.print("Msg: ");
      gestureMsg.writeValue('t');
      delay(200);
    }
  }
  Serial.print("Disconnected from central: ");
  Serial.println(central.address());  
  
}

I can find the device on my android app, and receive correct msgs.

But I can’t find any devices on my AT-09 board when I use the AT+INQ command (nano BLE Sense has disconnected with my phone).

the AT-09 is connected to the correct softwareserial port on an Arduino Mega R3 (or else the AT commands wouldn’t work)

does anyone no what the problem is? Or if this approach is totally wrong? thanks.

Hello jingweiHsu,

I have been meaning to test this myself. It looks like you need a genuine HM-10 with BLE, such as those discussed here. I think this is because the Central/Peripheral structure of this type of BLE is different from the typical Bluetooth of the AT-09 are used to. I just set up a HM-10 and on an old nano and uploaded the LED peripheral example to my Nano 33 IoT and using the HM-10 as a central device (AT+ROLE1 and AT+IMME1) I got this from a AT+DISC? command:

OK+DISCS
OK+DIS0:A4CF12233E4EOK+RSSI:-042
OK+NAME:LED
OK+DISCE

Beyond that, I haven't tried connecting or anything yet.

Hope that helps.

Best regards,
Matt