Ai powered robot with bt control

Published Jun 08, 2026
 48 hours to build
 Beginner

It has functions like obstacle avoiding, Bluetooth control, Ai asistant, battery level indicator, and automatic led headlights.

display image

Components Used

Ultrasonic Module HC-SR04
Ultrasonic module HC-SR04 is generally used for finding distance value and obstacle detection. It can operate in the range 2cm-400cm.
1
Speaker
Speakers & Transducers 28 mm, Round Frame, 0.25 W, 32 Ohm, Neodymium Magnet, PET Cone, Speaker
2
LDR -Photocell Photoresistor
LDR -Photocell, Photoresistor
2
LED 5mm
LED 5mm
2
N20 DC Motor - 6V with 1:100 Gear Ratio
Adafruit Accessories N20 DC Motor with Magnetic Encoder - 6V with 1:100 Gear Ratio
2
Caster Bearing Wheel
Adafruit Accessories 20mm Height Metal Caster Bearing Wheel
1
Lithium Ion Battery 3.7V 2500mAh 18650
Consumer Battery & Photo Battery 3.7V 2500mAh
3
128x64 (0.96") OLED Display
Adafruit Accessories Monochrome 0.96" OLED Graphic Display
1
Arduino UNO
Arduino UNO
1
Breadboard
Breadboard
1
Resistor 220 Ohms
Metal Film Resistors - Through Hole 220 OHM 1/4W 1%
5
Resistor 10 Ohms
Metal Film Resistors - Through Hole 10 OHM 1/4W 1%
5
Hc 05 Bluetooth Module
The HC-04 Bluetooth module is a commonly used Bluetooth serial communication module. It is based on the ubiquitous CSR BC417 Bluetooth chip and allows for wireless serial communication between devices. The HC-04 module operates in the 2.4GHz ISM (Industrial, Scientific, and Medical) band and supports Bluetooth version 2.0.
1
Battery level indicator
1
N20 gear motor wheel
2
L293D DRIVER Shield
This is the motor driver used in my project to control the two-stepper motor and one servo motor.
1
IR Sensor
Detects object presence and outputs pulse.
1
Battery Holder – 18650 cell
Securely holds the Li-Ion cell for dependable physical mounting and electrical connection. Ensures safe integration with wiring.
3
Switch
1
INMP441 Microphone
INMP441 is a microphone to get input in form of voice
1
ESP32 S3
mcu
1
Adafruit I2S 3W Class D Amplifier Breakout - MAX98357A
1
Voltage down module
1
1K Ohm Resistor
¼ watt ±5%
5
Description

 

If you need to add functions like my robot

  1. Ai asistant 

You need Xiaozhi.me

2. Bt control

3. Obstacle avoiding

4. Automatic leds

5. For battery level indicator no code is needed you only have to connect it from battery and for other functions like 2.,3., and 4. You need code which is this

#include <AFMotor.h>
#include <SoftwareSerial.h>
SoftwareSerial BT(2, 3);
AF_DCMotor leftMotor(1);
AF_DCMotor rightMotor(2);
#define TRIG_PIN A2
#define ECHO_PIN A3
#define LDR_PIN  A0
#define LED_PIN  12
String command = "";
// ---------- ULTRASONIC ----------
long getDistance() {
  digitalWrite(TRIG_PIN, LOW);
    delayMicroseconds(2);
      digitalWrite(TRIG_PIN, HIGH);
        delayMicroseconds(10);
          digitalWrite(TRIG_PIN, LOW);
            long duration = pulseIn(ECHO_PIN, HIGH, 30000);
              if (duration == 0) return 999;
                return duration * 0.034 / 2;
                }
                // ---------- MOTOR CONTROL ----------
                void stopRobot() {
                  leftMotor.run(RELEASE);
                    rightMotor.run(RELEASE);
                    }
                    void forwardRobot() {
                      leftMotor.setSpeed(180);
                        rightMotor.setSpeed(180);
                          leftMotor.run(FORWARD);
                            rightMotor.run(FORWARD);
                            }
                            void backwardRobot() {
                              leftMotor.setSpeed(180);
                                rightMotor.setSpeed(180);
                                  leftMotor.run(BACKWARD);
                                    rightMotor.run(BACKWARD);
                                    }
                                    void turnLeft() {
                                      leftMotor.setSpeed(180);
                                        rightMotor.setSpeed(180);
                                          leftMotor.run(BACKWARD);
                                            rightMotor.run(FORWARD);
                                            }
                                            void turnRight() {
                                              leftMotor.setSpeed(180);
                                                rightMotor.setSpeed(180);
                                                  leftMotor.run(FORWARD);
                                                    rightMotor.run(BACKWARD);
                                                    }
                                                    // ---------- SAFETY STOP ONLY ----------
                                                    void safetyStop() {
                                                      if (getDistance() <= 20) {
                                                          stopRobot();
                                                            }
                                                            }
                                                            // ---------- LIGHT CONTROL ----------
                                                            void lightControl() {
                                                              int ldrValue = analogRead(LDR_PIN);
                                                                if (ldrValue < 200)
                                                                    digitalWrite(LED_PIN, HIGH);
                                                                      else
                                                                          digitalWrite(LED_PIN, LOW);
                                                                          }
                                                                          // ---------- SETUP ----------
                                                                          void setup() {
                                                                            Serial.begin(9600);
                                                                              BT.begin(9600);
                                                                                pinMode(TRIG_PIN, OUTPUT);
                                                                                  pinMode(ECHO_PIN, INPUT);
                                                                                    pinMode(LED_PIN, OUTPUT);
                                                                                      stopRobot();
                                                                                      }
                                                                                      // ---------- LOOP ----------
                                                                                      void loop() {
                                                                                        // ---------- BLUETOOTH CONTROL ----------
                                                                                          while (BT.available()) {
                                                                                              char c = BT.read();
                                                                                                  if (c == '\n' || c == '\r') {
                                                                                                        command.trim();
                                                                                                              if (command == "forward") {
                                                                                                                      forwardRobot();
                                                                                                                            }
                                                                                                                                  else if (command == "backward") {
                                                                                                                                          backwardRobot();
                                                                                                                                                }
                                                                                                                                                      else if (command == "left") {
                                                                                                                                                              turnLeft();
                                                                                                                                                                    }
                                                                                                                                                                          else if (command == "right") {
                                                                                                                                                                                  turnRight();
                                                                                                                                                                                        }
                                                                                                                                                                                              else if (command == "stop") {
                                                                                                                                                                                                      stopRobot();
                                                                                                                                                                                                            }
                                                                                                                                                                                                                  command = "";
                                                                                                                                                                                                                      }
                                                                                                                                                                                                                          else {
                                                                                                                                                                                                                                command += c;
                                                                                                                                                                                                                                    }
                                                                                                                                                                                                                                      }
                                                                                                                                                                                                                                        // ---------- SAFETY SYSTEM ----------
                                                                                                                                                                                                                                          safetyStop();
                                                                                                                                                                                                                                            // ---------- LIGHT ----------
                                                                                                                                                                                                                                              lightControl();
                                                                                                                                                                                                                                              }

Here its function video of robot

 

Here is the wiring image of ai asistant

Sorry but when i click this image some components is not connected and speaker is another sorry for that

Here is the ai asistant wiring diagram

Sorry but another functions images is not available so sorry for that .

I used many jumper wires m-m, m-f, f-f 

I used many sticks of hot glue gun 

And i used soldering iron and its wire.

Codes

Downloads

XiaoZhi_ESP32S3_Wiring Download
Comments
Ad