BLE Sense fails to discover attributes

I’m new to the Arduino BLE world, but am trying to interface with a BLE OBDII scanner (specifically, the VEEPEAK scanner). Currently, I’ve been using the example code ‘Peripheral Explorer’ with the ‘localName’ changed (the local name of the peripheral device is ‘VEEPEAK’). It scans through all the available BLE peripherals, always finds the right device, always successfully connects to it, but fails when trying to discover the attributes. I’ve been using the LightBlue app to get information about the device from my iPhone, and the app says theres 1 Service. I’m hoping there’s something simple I’m missing, but I can’t seem to figure out why the code can’t discover attributes. I really appreciate any help or guidance!

 Peripheral Explorer

 This example scans for BLE peripherals until one with a particular name ("LED")
 is found. Then connects, and discovers + prints all the peripheral's attributes.

 The circuit:
 - Arduino MKR WiFi 1010, Arduino Uno WiFi Rev2 board, Arduino Nano 33 IoT,
   Arduino Nano 33 BLE, or Arduino Nano 33 BLE Sense board.

 You can use it with another board that is compatible with this library and the
 Peripherals -> LED example.

 This example code is in the public domain.

#include <ArduinoBLE.h>

void setup() {
 while (!Serial);

 // begin initialization
 if (!BLE.begin()) {
   Serial.println("starting BLE failed!");

   while (1);

 Serial.println("BLE Central - Peripheral Explorer");

 // start scanning for peripherals

void loop() {
 // check if a peripheral has been discovered
 BLEDevice peripheral = BLE.available();

 if (peripheral) {
   // discovered a peripheral, print out address, local name, and advertised service
   Serial.print("Found ");
   Serial.print(" '");
   Serial.print("' ");

   // see if peripheral is a LED
   if (peripheral.localName() == "VEEPEAK") {
     // stop scanning


     // peripheral disconnected, we are done
     while (1) {
       // do nothing

void explorerPeripheral(BLEDevice peripheral) {
 // connect to the peripheral
 Serial.println("Connecting ...");

 if (peripheral.connect()) {
 } else {
   Serial.println("Failed to connect!");

 // discover peripheral attributes
 Serial.println("Discovering attributes ...");
 if (peripheral.discoverAttributes()) {
   Serial.println("Attributes discovered");
 } else {
   Serial.println("Attribute discovery failed!");

 // read and print device name of peripheral
 Serial.print("Device name: ");
 Serial.print("Appearance: 0x");
 Serial.println(peripheral.appearance(), HEX);

 // loop the services of the peripheral and explore each
 for (int i = 0; i < peripheral.serviceCount(); i++) {
   BLEService service = peripheral.service(i);



 // we are done exploring, disconnect
 Serial.println("Disconnecting ...");

void exploreService(BLEService service) {
 // print the UUID of the service
 Serial.print("Service ");

 // loop the characteristics of the service and explore each
 for (int i = 0; i < service.characteristicCount(); i++) {
   BLECharacteristic characteristic = service.characteristic(i);


void exploreCharacteristic(BLECharacteristic characteristic) {
 // print the UUID and properties of the characteristic
 Serial.print("\tCharacteristic ");
 Serial.print(", properties 0x");
 Serial.print(, HEX);

 // check if the characteristic is readable
 if (characteristic.canRead()) {
   // read the characteristic value;

   if (characteristic.valueLength() > 0) {
     // print out the value of the characteristic
     Serial.print(", value 0x");
     printData(characteristic.value(), characteristic.valueLength());

 // loop the descriptors of the characteristic and explore each
 for (int i = 0; i < characteristic.descriptorCount(); i++) {
   BLEDescriptor descriptor = characteristic.descriptor(i);


void exploreDescriptor(BLEDescriptor descriptor) {
 // print the UUID of the descriptor
 Serial.print("\t\tDescriptor ");

 // read the descriptor value;

 // print out the value of the descriptor
 Serial.print(", value 0x");
 printData(descriptor.value(), descriptor.valueLength());


void printData(const unsigned char data[], int length) {
 for (int i = 0; i < length; i++) {
   unsigned char b = data[i];

   if (b < 16) {

   Serial.print(b, HEX);

PeripheralExplorer_VEEPEAK.ino (4.4 KB)

Welcome to the forum

Please read the How to use this forum to learn how to use code tags and other useful tips. Your example should look like this.

Example code

Try to modify your original post.

charliewumbo: I've been using the LightBlue app to get information about the device from my iPhone, and the app says theres 1 Service.

Can you see the characteristics as well and read/write to them with your smartphone app? BLE peripherals can disconnect clients if they want. Some expect some secret information to be written to them for access control. You typically see them disconnect quickly after you connected and the first discover is finished. A good peripheral device should stay connected.

It is best to confirm with a generic smartphone app that the BLE peripherals works without issues before connecting with your Arduino. You can also try BLE Scanner from bluepixel technologies. It is free on iOS.