DIY Simple Arduino Bluetooth Controlled Robot Car

DIY Simple Arduino Bluetooth Controlled Robot Car

You will never get bored of playing with remote control toys and you will never outgrow them. So today I will be showing you how to make your own remote-controlled RC car. The best part of this project is that you won’t be building a remote for this car because you already have one in your hand. We will be using your smartphone as the remote controller and will be controlling it over Bluetooth. So let’s start the build

Things you need

  • Arduino board (Uno, Nano, Mega any Arduino compatible board will do the job)
  • HC-05/06 Bluetooth Module
  • Motor Driver (L2938 or any similar motor driver, I will be using L298 for this project )
  • Motor (9v/12v Geared motor)
  • Robotic Car Chassis
  • Power Supply (9v/12v Lead-acid/ Li-ion batteries)

Before we begin, A big shoutout to sponsor of this content DIgitspace
DigitSpace is an open source hardware provider catering to future creators. We supply innovative, user-friendly open source hardware products ranging from boards to corresponding components and kits for worldwide community of engineers, designers, inventors and makers who love creating electronics.

Motor Driver

As I told before I will be using L298N Motor driver for this project. I will explain some basics of this motor driver.
This module uses an L298 motor driver IC, I will be using the breakout board (highly recommended). And has an onboard 5v regulator which can be used for powering the Arduino board.
This board has 4 + 2 data input pin IN1, IN2, IN3, IN4 and 2 Enable pins EN1 and EN2. If the EN1 is high it will enable OUT1 and 2. Similar for EN2.
The enable pins can control the speed of the motor.
For now, we will connect it to 5v and make it HIGH.

Schematic

Make the above-mentioned connection. Only very few connections are there, it will be simple.

  • TX of Bluetooth goes to RX of Ardunio and RX of Bluetooth to TX of Arduino.
  • Connect both EN1 and EN2 to 5v
  • Connect Digital pins 8, 9, 10, 11 to IN4, IN3, IN2, IN1 respectively
  • Give 12v/9v power supply to the first and second screw terminal.
  • Power the Arduino using the 5v output from motor driver.

Things to note while doing the connections are
1. Make sure you placed the jumper which short both enable pin and 5v
2. Make the common ground for motor drivers and Arduino.

Assemble the robot

This part is completely up to your creative mind. You can either create your own chassis for the robotic car or get ready-made ones. Check your local hobby electronics store.
You can decide if you want 4WD or 2WD model.

Since I had access to 3D Printing and I want to of sharpen my CAD designing skills. I thought of designing and 3D Printing the chassis
If you want to do the same, here is the link for the.STL file of the chassis.

Code

/*
    DIY Simple Arduino Bluetooth Controlled Robot Car
    Coder - Mayoogh Girish
    Website - http://mgprojecthub.com/
    Download the App :
*/

char data = 0;                //Variable for storing data

int RMA = 8;
int RMB = 9;
int LMA = 10;
int LMB = 11;

void setup()
{
  Serial.begin(9600);         //Sets the data rate in bits per second (baud) for serial data transmission
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
}
void loop()
{
  if (Serial.available() > 0)
  {
    data = Serial.read();      //Read the incoming data and store it into variable data
    Serial.print(data);        //Print Value of data in Serial monitor
    Serial.print("\n");        //New line
    
    
    if (data == 'S')
      stop_();
      
    else if (data == 'F')
      forward_();

    else if (data == 'B')
      backward_();

    else if (data == 'L')
      left_180();

    else if (data == 'R')
      right_180();

    else if (data == 'G')
      forwardLeft();

    else if (data == 'I')
      forwardRight();

    else if (data == 'H')
      backwardLeft();

    else if (data == 'J')
      backwardRight();
  }
}

void stop_() {
  Serial.print("STOP");
  digitalWrite(LMA, LOW);
  digitalWrite(LMB, LOW);
  digitalWrite(RMA, LOW);
  digitalWrite(RMB, LOW);
}

void forward_() {
  Serial.print("FORWARD");
  digitalWrite(LMA, HIGH);
  digitalWrite(LMB, LOW);
  digitalWrite(RMA, HIGH);
  digitalWrite(RMB, LOW);
}

void backward_() {
  Serial.print("BACKWARD");
  digitalWrite(LMA, LOW);
  digitalWrite(LMB, HIGH);
  digitalWrite(RMA, LOW);
  digitalWrite(RMB, HIGH);
}

void left_180() {
  Serial.print("LEFT 180");
  digitalWrite(LMA, LOW);
  digitalWrite(LMB, HIGH);
  digitalWrite(RMA, HIGH);
  digitalWrite(RMB, LOW);
}

void right_180() {
  Serial.print("RIGHT 180");
  digitalWrite(LMA, HIGH);
  digitalWrite(LMB, LOW);
  digitalWrite(RMA, LOW);
  digitalWrite(RMB, HIGH);
}

void forwardLeft() {
  Serial.print("FORWARD - LEFT");
  digitalWrite(LMA, LOW);
  digitalWrite(LMB, LOW);
  digitalWrite(RMA, HIGH);
  digitalWrite(RMB, LOW);
}

void forwardRight() {
  Serial.print("FORWARD - RIGHT");
  digitalWrite(LMA, HIGH);
  digitalWrite(LMB, LOW);
  digitalWrite(RMA, LOW);
  digitalWrite(RMB, LOW);
}

void backwardLeft() {
  Serial.print("BACKWARD - LEFT");
  digitalWrite(LMA, LOW);
  digitalWrite(LMB, LOW);
  digitalWrite(RMA, LOW);
  digitalWrite(RMB, HIGH);
}

void backwardRight() {
  Serial.print("BACKWARD - RIGHT");
  digitalWrite(LMA, LOW);
  digitalWrite(LMB, HIGH);
  digitalWrite(RMA, LOW);
  digitalWrite(RMB, LOW);
}

Upload the above code to your Arduino.
REMOVE THE TX RX CONNECTION ON ARDUINO WHILE UPLOADING THE SKETCH, OR ELSE YOU WILL HAVE SURELY HAVE ERROR WHILE UPLOADING.

Pairing the Bluetooth Module

  • Turn ON Bluetooth Module
  • Search for available Bluetooth device on your smartphone
  • Select HC-05, the default pairing code with 1234 or 0000
  • Once it’s paired the blinking pattern of the Bluetooth module will change.

Android Application

  • Select the Setting ⚙ icon and click connect to car.
  • Select the HC-05 from the list.
  • If the connection is successful you will see a green circle at the top left corner
  • Enjoy the ride😉

4 thoughts on “DIY Simple Arduino Bluetooth Controlled Robot Car

    1. Those are just variable name for 2 motors. Since a motor has 2 terminal.
      RMA – Right Motor A
      RMB – Right Motor B
      LMA – Left Motor A
      LMB – Left Motor B
      I hope it’s clear now

Leave a Reply

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