ESP32 not pairing with a handheld bluetooth barcode scanner

I want to pair a bluetooth barcode scanner(like the one's used in retail stores) with an esp32. The scanner easily pairs with my smartphone or laptop.I am using the 'BluetoothSerial' library. When i use SerialBT.discover(), the scanner gets listed in the list of available devices. But when I use SerialBT.connect(), it doesnt pair. I have tried hardcoding the address too as follows,

  uint8_t address[6]  = {0xAA, 0xFE, 0x45, 0x2E, 0x0E, 0x39};
  if (SerialBT.connect(address)) {
    Serial.println("Connected to the barcode scanner!");
  } else {
    Serial.println("Failed to connect to the barcode scanner.");
  }

I have tried using the name of the scanner in SerialBT.connect(), but that too doesn't work. What could be the problem? The scanner is set in HID mode, is BluetoothSerial library the best suited for this task?

the BluetoothSerial library is using the Bluetooth Serial Port Profile (SPP)
if your scanner is set in HID mode, you would need the Human Interface Device Profile

Take a look at this ESP32 BLE HID explorer demo.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.