bluetooth robot

How to Build a Bluetooth Controlled 2WD Robot Using Arduino Uno and HC-05 , Best DIY Project 2026

Building your own wireless mobile robot is one of the best ways to get started with microcontroller programming, motor drivers, and wireless communication. Whether you are building a prototype or working on a university engineering project, a smartphone-controlled smart car is a classic, rewarding project.

In this tutorial, we will walk you through how to build a 2WD Bluetooth Controlled Robot using an Arduino Uno, an HC-05 Bluetooth module, and an L298N motor driver.

Required Hardware Components

Before you begin wiring, make sure you have the following components ready (you can find all of these in our online store):

Step 1: Mechanical Assembly

Assemble the Chassis: Start by removing the protective plastic film from the acrylic chassis plate. Mount the two dual-shaft DC motors to the underside using the provided mounting brackets and screws.

Attach Wheels: Push the yellow rubber wheels onto the motor shafts and secure them. Mount the universal caster wheel to the front slot of the chassis for balance.

Mount Electronics: Place your Arduino Uno, L298N motor driver, and battery pack onto the top acrylic plate using spacers or double-sided tape.

Step 2: Circuit Wiring & Connections

Proper wiring is critical to ensure your motors receive enough power without crashing the Arduino logic board.

Motor Connections:

  • Connect the Left Motor wires to OUT1 and OUT2 on the L298N driver.
  • Connect the Right Motor wires to OUT3 and OUT4 on the L298N driver.

L298N to Arduino Uno:

  • ENA pin (Remove jumper, connect to Arduino Digital Pin 3 for PWM speed control)
  • IN1 pin Arduino Digital Pin 4
  • IN2 pin Arduino Digital Pin 5
  • IN3 pin Arduino Digital Pin 6
  • IN4 pin Arduino Digital Pin 7
  • ENB pin (Remove jumper, connect to Arduino Digital Pin 9 for PWM speed control)
  • GND pin Connect to Arduino GND (Crucial: Share a common ground with the battery source!)

HC-05 Bluetooth Module to Arduino Uno:

  • VCC Arduino 5V (Caution: Some HC-05 modules require 3.3V, check your module specifications)
  • GND Arduino GND
  • TXD Arduino Digital Pin 0 (RX) (Disconnect during code upload)
  • RXD Arduino Digital Pin 1 (TX) through a voltage divider or direct line depending on your board logic level.

Step 3: Arduino Sample Code

Copy and paste the code below into your Arduino IDE, select your board, and upload it via USB. (Remember to unplug the HC-05 RX/TX pins while uploading code to prevent serial conflict).

#include <SoftwareSerial.h>

// Define motor control pins
const int enA = 3;
const int in1 = 4;
const int in2 = 5;
const int in3 = 6;
const int in4 = 7;
const int enB = 9;

char incomingCommand; // Variable to store incoming Bluetooth data

void setup() {
  // Set all motor control pins to outputs
  pinMode(enA, OUTPUT);
  pinMode(enB, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);

  // Set initial motor speed (0 - 255)
  analogWrite(enA, 200);
  analogWrite(enB, 200);

  // Start serial communication for Bluetooth
  Serial.begin(9600);
}

void loop() {
  if (Serial.available() > 0) {
    incomingCommand = Serial.read();
    
    // Control logic based on incoming character commands
    if (incomingCommand == 'F') {
      moveForward();
    } 
    else if (incomingCommand == 'B') {
      moveBackward();
    } 
    else if (incomingCommand == 'L') {
      turnLeft();
    } 
    else if (incomingCommand == 'R') {
      turnRight();
    } 
    else if (incomingCommand == 'S') {
      stopRobot();
    }
  }
}

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

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

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

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

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

Step 4: Testing Your Robot

Power on your robot via the battery pack. The LED on your HC-05 module should be blinking, indicating it is ready to pair.

Open your smartphone Bluetooth settings, search for devices, and pair with the HC-05 (Default password is usually 1234 or 0000).

Download any standard Bluetooth RC Controller app from the Google Play Store.

Configure the app buttons to send text commands: F for Forward, B for Backward, L for Left, R for Right, and S for Stop.

Tap the buttons and watch your robot move wirelessly!

Ready to Build Yours?

If you need all these parts bundled together without hunting for individual components, check out our ready-to-ship 2WD Arduino Bluetooth Controlled Robot Kit (Unassembled) available right here on Collegeroadonline.com with fast delivery across Pakistan!

Leave a Reply

Your email address will not be published. Required fields are marked *