NepaTronix Logo

© 2024 NepaTronix.
All rights reserved

Quick Links


Home

Services

About

Contact

Contact


+977 9803661701

support@nepatronix.com

Location


Lokanthali, Bhaktapur



BLUETOOTH VOICE CONTROLLED ROBOT MOBILE BASED(Robotics Project)

  Back To Blogs

This project involves building a Bluetooth voice-controlled robot using an ESP32 microcontroller. The robot can be directed to move forward, backward, left, right, and stop using voice commands transmitted via Bluetooth from a mobile device. The project integrates an LCD for displaying the current action being performed by the robot. This project is a practical demonstration of how Bluetooth technology can be used to control a robot, showcasing the capabilities of the ESP32 microcontroller.

Project : 46


Introduction

This project involves building a Bluetooth voice-controlled robot using an ESP32 microcontroller. The robot can be directed to move forward, backward, left, right, and stop using voice commands transmitted via Bluetooth from a mobile device. The project integrates an LCD for displaying the current action being performed by the robot. This project is a practical demonstration of how Bluetooth technology can be used to control a robot, showcasing the capabilities of the ESP32 microcontroller.

Components Required

1.      ESP32 Microcontroller: The brain of the robot, enabling Bluetooth communication and controlling the motor drivers.

2.      Motor Driver Module: To control the motors based on signals received from the ESP32.

3.      DC Motors: To provide movement to the robot.

4.      Bluetooth-Enabled Mobile Device: For sending voice commands to the ESP32.

5.      LiquidCrystal_I2C Display: For displaying the current action of the robot.

6.      Power Supply: Batteries or another suitable power source for the motors and ESP32.

7.      Chassis: The frame to house all the components and provide a base for the robot.

8.      Connecting Wires: For establishing electrical connections between the components.

Pin Configuration

•        Motor Driver Pins:

o    in1: GPIO 27 o    in2: GPIO 26 o    in3: GPIO 25 o    in4: GPIO 33

•        LCD Pins: Connected via I2C (default I2C pins on ESP32)

Libraries Used

1.      LiquidCrystal_I2C: For interfacing with the LCD display.

2.      Wire: For I2C communication.

3.      BluetoothSerial: For Bluetooth communication.

 

 

Circuit Diagram: 

Code:

#include <LiquidCrystal_I2C.h>

#include <Wire.h>

#include "BluetoothSerial.h"

LiquidCrystal_I2C lcd(0x27, 16, 2);

 

#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)

#error Bluetooth is not enable! plear run make menuconfig to and enable it #endif

 

#if !defined(CONFIG_BT_SPP_ENABLED)

#error Serial Bluetooth not available or not enabled. it is only available for the ESP32 chip. #endif

 

BluetoothSerial SerialBT;

#define in1 27

#define in2 26

#define in3 25

#define in4 33

 

void setup() {

  Serial.begin(115200);   Wire.begin();

  lcd.init();   lcd.clear();   lcd.backlight();   lcd.setCursor(1, 0);

  lcd.print("**NEPATRONIX**");   delay(2000);   lcd.clear();

 

  SerialBT.begin("Nepatronix");

 

  pinMode(in1, OUTPUT);   pinMode(in2, OUTPUT);   pinMode(in3, OUTPUT);   pinMode(in4, OUTPUT);

}

void loop() {

 

  if (SerialBT.available()) {     String r = SerialBT.readString();     if (r == "Forward") {

 

      display(1, 0, "FORWARD");       forward();

    }

    if (r == "Backward") {

 

      display(1, 0, "BACKWARD");       backward();

    }

    if (r == "Right") {

 

      display(1, 0, "RIGHT");

      right();

    }

    if (r == "Left") {

 

      display(1, 0, "LEFT");

      left();

    }

    if (r == "Stop") {

 

      display(1, 0, "STOP");

      stop();

    }

  }

}

void display(int col, int row, String msg) {

  lcd.clear();   lcd.setCursor(col, row);   lcd.print(msg);

}

 

void forward() {   digitalWrite(in1, LOW);   digitalWrite(in2, HIGH);   digitalWrite(in3, LOW);   digitalWrite(in4, HIGH);

}

void backward() {   digitalWrite(in1, HIGH);   digitalWrite(in2, LOW);   digitalWrite(in3, HIGH);   digitalWrite(in4, LOW);

}

void right() {   digitalWrite(in1, HIGH);   digitalWrite(in2, LOW);   digitalWrite(in3, LOW);   digitalWrite(in4, HIGH);

} void left() {

  digitalWrite(in1, LOW);   digitalWrite(in2, HIGH);   digitalWrite(in3, HIGH);   digitalWrite(in4, LOW);

}

void stop() {   digitalWrite(in1, LOW);   digitalWrite(in2, LOW);   digitalWrite(in3, LOW);   digitalWrite(in4, LOW);

}

 

 

 

Working

1.      Initialization:

o   The ESP32 initializes the serial communication at 115200 baud rate. o             The I2C communication is set up for the LCD, and an initial message is displayed.

o   Bluetooth is initialized, allowing the ESP32 to communicate with a mobile device using the name "Nepatronix".

o   The motor driver pins are set as outputs.

2.      Main Loop:

o   The main loop checks if any Bluetooth data is available.

o   If a command is received, the corresponding action is displayed on the LCD and executed by the robot.

o   The robot can move forward, backward, left, right, or stop based on the received command.

3.      Movement Functions:

o   The robot's movement is controlled by setting the motor driver pins high or low.

o   For each command (forward, backward, left, right, stop), the appropriate pins are set to control the motors accordingly.

Testing

1.      Assembly: Assemble all components as per the pin configuration and connect the motors to the chassis.

2.      Power Up: Power the ESP32 and ensure the motor driver and LCD are powered.

3.      Bluetooth Connection: Pair the mobile device with the ESP32 over Bluetooth.

4.      Voice Commands: Use a Bluetooth terminal app to send voice commands (as text) such as "Forward", "Backward", "Left", "Right", and "Stop".

5.      LCD Display: Verify that the LCD displays the current action being performed by the robot.

6.      Movement: Ensure the robot moves in the correct direction based on the received command.

Conclusion

The Bluetooth Voice Controlled Robot project demonstrates the integration of Bluetooth communication, motor control, and LCD display using the ESP32 microcontroller. By utilizing voice commands sent from a mobile device, the robot can perform various movements, showcasing the practical applications of wireless control in robotics. This project provides a hands-on experience in implementing Bluetooth-based control systems, making it an excellent learning opportunity for those interested in robotics and IoT.