Project tutorial

RobotBT © GPL3+

A Bluetooth-controlled robot car.

  • 1,159 views
  • 0 comments
  • 14 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

Apps and online services

About this project

Hello there!

It's always fun having to control the movement of a robot from a remote control but it's more fun to control it from our smartphone.

This tutorial will guide you on how to design, build and control your own Bluetooth-controlled Car.

We will be making use of the HC-05 Bluetooth Module to receive data sent from the smartphone. The data received are in form of characters that enable us to change the direction of our car.

The Motor Shield used in this project is the Adafruit Motor Shield. It is stacked on the Arduino. It is used to drive the DC motors because the Arduino alone cannot drive them. It is advisable to use a power supply with good current rating(e.g 12V). This helps in giving your Robot Car traction on any surface you place it.

You may need to solder some headers to the Motor Shield. We made use of analog pins A3 and A4 as the Rx and Tx pins respectively.

About the App

To control the Car from my smartphone, I designed an App using MIT App inventor. The App was named 'RobotBT'. A screenshot of the app is shown below

In order to use the App, the following steps are required:

  • Pair your smartphone with the HC-05 Bluetooth Module. A pin would be required. The default pin is 1234.
  • After pairing, launch the RobotBT app
  • Click on the Bluetooth icon to connect to the HC-05 Bluetooth Module.
  • Once you are connected, the label below the Bluetooth icon will change to 'Client connected'.
  • You are now ready to control your Robot Car using the RobotBT App.

To download the RobotBT app, click the link below:

RobotBT download

Coupling Phase

The following steps are required to couple the 2WD Robot Car:

  • Attach the speed encoders to the DC Motor.

  • Attach the Arduino Uno to the Chassis base

  • Connect the connectors to the rear castor

  • Mount the rear castor under the chassis base

  • Attach the DC Motors to the Chassis base.

  • Attach the wheels to the DC Motors.

  • Mount the motor shield on the Arduino.

  • Attach the wires from the DC Motors to the motor shield.

  • Connect the Arduino to the power source.

Code

RobotBT.inoC/C++
This is the Arduino Code for the Bluetooth controlled Robot Car.
/*This controls the Robot car from a smartphone
 * The RobotBT App was designed using MIT App inventor 
 *    Creator: OJO AYOMIPO ISRAEL
 */
#include <AFMotor.h>
#include <SoftwareSerial.h>
SoftwareSerial robotBT(A3,A4);//Rx and Tx configured using software robotBT..NOTE->Do not use A5. It won't work.
char Data;

//Motors initialization
AF_DCMotor leftmotor(4, MOTOR34_1KHZ);
AF_DCMotor rightmotor(3, MOTOR34_1KHZ);

//Forward and backward function
 void Japaa(char what, byte vel)
 {
  leftmotor.setSpeed(vel);
  rightmotor.setSpeed(vel);
  leftmotor.run(what);
  rightmotor.run(what);
  robotBT.println(what);
 }

 //TurnLeft
 void turnleft(char what, byte vel)
 {
  rightmotor.setSpeed(vel);
  rightmotor.run(what);
  leftmotor.run(BACKWARD);
  robotBT.print("Turning left");
 }

 //TurnRight
 void turnright(char what, byte vel)
 {
  leftmotor.setSpeed(vel);
  leftmotor.run(what);
  rightmotor.run(BACKWARD);
  robotBT.print("Turning right");
 }
 
void setup() {
  // put your setup code here, to run once:
//Serial.begin(9600);
robotBT.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
if (robotBT.available()){
  Data = robotBT.read();
  switch (Data){
    //Forward
    case 'F':
      Japaa(FORWARD,255);
    break;
    
    //TurnLeft
    case 'L':
      turnleft(FORWARD,255);
    break;

    //TurnRight
    case 'R':
      turnright(FORWARD,255);
    break;

    //Backward
    case 'D':
      Japaa(BACKWARD,255);
     break;

    //Stop
    case 'S':
      Japaa(RELEASE,255);
     break;
  }
  robotBT.println("Error connecting to the Smartphone!!!");
}
delay(200);
}

Schematics

Breadboard layout
This shows the breadboard layout for wiring up the Bluetooth-controlled Robot Car
Robotbt bb eydyjjitw9

Comments

Similar projects you might like

Bluetooth Controlled Car

Project tutorial by JANAK13

  • 6,996 views
  • 13 comments
  • 31 respects

Bluetooth Controlled Pick And Place Robot

Project tutorial by Ahmed Ebrahem Ahmed

  • 10,143 views
  • 15 comments
  • 47 respects

Health Kit: Humidity and Temperature Control

Project tutorial by Diana Khalipina

  • 5,094 views
  • 2 comments
  • 42 respects

Voice-Controlled Pick-and-Place Robot

by Sagar pawar

  • 2,348 views
  • 0 comments
  • 10 respects

Make an Autonomous "Follow Me" Cooler

Project tutorial by Hacker Shack

  • 99,331 views
  • 194 comments
  • 387 respects

BLE Bot 9000

Project tutorial by 5 developers

  • 24,843 views
  • 7 comments
  • 75 respects
Add projectSign up / Login