How to Use BT LAB App's AI Object Detector with Arduino Projects with Bluetooth

How to Use the BT LAB Object Detector with Arduino with Bluetooth

The BT LAB Object Detector allows you to identify environmental objects such as people, TVs, laptops, birds, and more using your smartphone's camera. This feature is designed to bridge the gap between high-level Artificial Intelligence and Arduino, giving your DIY projects the power of "vision."

What is Machine Learning?

The Object Detector uses Machine Learning (ML) to recognize its surroundings. Simply put, Machine Learning is a system trained to process data and "think" or recognize patterns much like a human does.

Creative Project Ideas

With the BT LAB Object Detector, you can build:

  • Intruder Alarms: A system that sounds a buzzer when a human is detected.
  • Animal Detection Alarms: A notification system for when a pet or bird enters the frame.
  • Smart Automation: Triggering lights or motors based on specific objects in sight.


Hardware Requirements

To connect the Object Detector to your Arduino, your project must support Bluetooth. You will need a Bluetooth module, such as:

  • HC-05
  • HC-06
  • ESP32 / ESP8266 (with built-in Bluetooth/WiFi)


How the Ecosystem Works

The Object Detector analyzes your live camera footage and identifies all objects within the frame. Once an object is detected, BT LAB sends that data via Bluetooth to your Arduino in a specific string format:

Data Format: <label, score>

  • Label: The name of the detected object (e.g., "person", "dog").
  • Score: The confidence level of the detection. The maximum value is 1.0. The closer the score is to 1.0, the more certain the AI is that the object is identified correctly.

Handling Multiple Objects

If the app detects multiple objects (e.g., four different items) in one frame, it sends all of them in a single message. You will need to extract (parse) this data in your Arduino code. We have provided a sample code below to help you get started.


Sample Arduino Code

The following code is a basic example for Arduino Uno or Nano. It listens for a "person" label and blinks the built-in LED when a human is detected.

Note: If you are using an ESP8266 or ESP32, simply modify the serial communication pins to match your board.

    /*
  BT Lab OBJ Detector - Sample Code
  Function: Detect humans and blink the built-in LED.
  
  Support the developers: Download 'BT Lab' on the Play Store!
  Your support motivates us to keep improving this app.
Date 2026-03-06
*/

void setup() {
 // We use the built-in LED on the Arduino Uno/Nano for this demo
  pinMode(LED_BUILTIN , OUTPUT);
// Initialize Serial communication (Ensure this matches your Bluetooth module baud rate)
  Serial.begin(9600);
}

// Global buffer to store the incoming Bluetooth message
// Size 500 ensures we can handle messages containing multiple detected objects
char input[500];
//this index variable use for track input array's next element
int index = 0;

void loop() {

  //Check for incoming massage
  if(Serial.available()){

  //store incoming charactor in val variable
  char val = Serial.read();

  //check current charator is \n 
    // The BT Lab app attaches a '\n' (Newline) to the end of every complete message
  if(val == '\n'){
      // Terminate the string with a null character (required for C strings)
    input[index] = '\0';
      // Process the full message to extract object data
    processInput();
    //clear this input char array for next incoming massage
    input[0] = '\0';
    // Reset the index for the next incoming message
    index = 0;
  } else {
    //add current val to input array
    input[index] = val;
    index++;
  }
  }

}

void processInput(){
  
  char *part = input;
 // Use strchr to find the first occurrence of the start delimiter '<'
  // If no '<' is found, the loop terminates
    //this strchr return memory address of first < in part
  //if not found any <  strchr return Null
  while((part = strchr(part , '<')) != NULL){
    //get memory address of first >
    char *end = strchr(part , '>');
    // Exit if the message format is incomplete
    if(!end) break;

    // Temporary buffer to store a single object's data: 
    char data[200];
    //calculate lenth of  

Performance and Accuracy

  • Offline Mode: This feature runs the ML model locally on your phone. This means the Object Detector works offline without requiring an internet connection.
  • Processing Power: Running AI locally uses a significant amount of your phone's battery and processing power.
  • Disclaimer: The Object Detector is not 100% accurate and can make mistakes. Please do not use this feature for high-precision tasks or safety-critical applications.

Object list can detect.

People & Vehicles
person
bicycle
car
motorcycle
airplane
bus
train
truck
boat

Road / Outdoor Objects
traffic light
fire hydrant
stop sign
parking meter
bench

Animals
bird
cat
dog
horse
sheep
cow
elephant
bear
zebra
giraffe

Personal Items
backpack
umbrella
handbag
tie
suitcase

Sports Objects
frisbee
skis
snowboard
sports ball
kite
baseball bat
baseball glove
skateboard
surfboard
tennis racket

Kitchen / Food Items
bottle
wine glass
cup
fork
knife
spoon
bowl

Food
banana
apple
sandwich
orange
broccoli
carrot
hot dog
pizza
donut
cake

Furniture
chair
couch
potted plant
bed
dining table
toilet

Electronics
tv
laptop
mouse
remote
keyboard
cell phone

Appliances
microwave
oven
toaster
sink
refrigerator

Misc
book
clock
vase
scissors
teddy bear
hair drier
toothbrush

Post a Comment

Previous Post Next Post

Slider Maximum 10 sliders