Ojo Ayomipo Israel
Published © GPL3+

RobotBT

A Bluetooth-controlled robot car.

IntermediateFull instructions provided5 hours2,242

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Adafruit Motor Shield
×1
Male Header 40 Position 1 Row (0.1")
Male Header 40 Position 1 Row (0.1")
×1
2WD Robot Car chassis
×1
AA Batteries
AA Batteries
×2

Software apps and online services

MIT App Inventor RobotBT
Arduino IDE
Arduino IDE
Fritzing

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Circuit diagram

This shows the circuit layout for wiring up the Bluetooth-controlled Robot Car

Code

RobotBT.ino

C/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);
}

Credits

Ojo Ayomipo Israel

Ojo Ayomipo Israel

2 projects • 3 followers
I'm an enthusiastic and productive physicist. I'm interested in solving real-world problems through technological innovations.

Comments