Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How To Make an Bluetooth Controlled Rover v2


AndroBot v1 : Part 1 

How To Make Bluetooth Based Smartphone Controlled Rover v2

Previously on Andro Root i Posted a tutorial on Android Controlled Robot.It was for beginners and it is having less functions and was very easy to build.Now i am planning for something bigger and better with lots of cool functions.Also given the name "AndroBot v1" to the Project.

AndroBot v1:-
AndroBot is an Android Controlled Advanced Robot and it is a combination of Android Controlled Rover With Robotic Arm.So Lets start with its history: Idea and Inspiration
Almost Two Months ago i watched a movie" The Hurt Locked ",In it a rover is shown which is with the Bomb squad team and it works good but failed to complete its main task.And its design and functions inspired me.I am not a well experienced Robotics Project maker but i know that i can make a similar one ya it will be not of that quality,accuracy and costly but it can perform same tasks.
After many attempts,research and experiments i found all the possible and combination of things to make the similar robot.The Robot Will have all the basic functions our Android Controlled Robot v1 with some extra function in the rover and a Robotic arm will also be Attached on it.I have divided  Complete Project into Three Part which are as following 
  1. How To Make an Android Controlled Robot v2
  2. How to Make an Android Controlled Robotic Arm
  3. How To Make AndroBot (Rover with Robotic Arm)
and then without wasting more time i will take all the parts one by one and explain them and show you that how i made it.so read the tutorial carefully and try to make the AndroBot v1.

How To Make Android Controlled Robot v2

First i am making the Android Controlled robot v2.And i just modified the Previous Project Android Controlled Robot,and i got the result what i want to.The Rover/Bot will be controlled through the Bluetooth and all its function will be controlled through the Atmega 328p-PU Microcontroller.Which we are also using a L298N motor driver Board which will control the Motors.All the Above thing will be powered by the 12v battery..
After This modification I added some Advanced Function ,And the list of its functions are as Following:-
  1. Four way Movement
  2. Front and Back light
  3. Horn
  4. Indication Light
  5. An Smartphone can Be Added to be used as Camera.
So After All the Introduction about the plan and ideas lets talk about the Requirements:- 
Requirements To make Android Controlled Robot:-
  • 1 x Arduino Uno Board
  • 1 x L298N Motor driver Board
  • 1 x Bluetooth Module
  • 11 x 12v battery
  • 2 xWhite LED
  • 1 x Red LED
  • 1 x Indication LED Any Color
  • 4 x Bo Motor or 2 x 12v Geared Motor
  • 1 x Buzzer
  • 4 x Toy tyres(if you have Bo Motors )If using 2 x 12v Geared Motor then Two Tyres and a Coster wheel.
  • 1 x Switch



Other Requirements;-
  • 1 x Robot Chassis/base :- i made it with combining 2 CD/DVD Outlets
  • 1 x PC/Laptop (Just for coding and watching the recived videos from the bot)
  • Arduino IDE
  • 2 x Android Phone
  • Android App to control robot.


About the components:-

Arduino Uno :-


The Arduino Board is an awesome Board which is very helpful to make and build some cool Project.The Arduino Uno R3 uses an ATmega328p-pu instead of the 8U2 or 16U2 found on the Uno (or the FTDI found on previous generations). This allows for faster transfer rates and more memory. No drivers needed for Linux or Mac (inf file for Windows is needed and included in the Arduino IDE), and the ability to have the Uno show up as a keyboard, mouse, joystick, etc.The Uno R3 also adds SDA and SCL pins next to the AREF. In addition, there are two new pins placed near the RESET pin. One is the IOREF that allow the shields to adapt to the voltage provided from the board. The other is a not connected and is reserved for future purposes. The Uno R3 works with all existing shields but can adapt to new shields which use these additional pins.Arduino is an open-source physical computing platform based on a simple i/o board and a development environment that implements the Processing/Wiring language. Arduino can be used to develop stand-alone interactive objects or can be connected to software on your computer (e.g. Flash, Processing, Max MSP). The open-source IDE can be downloaded for free (currently for Mac OS X, Windows, and Linux).Note:The Arduino Uno R3 requires the Arduino 1.0 drivers folder in order to install properly on some computers.
  • FEATURES OF ARDUINO UNO R3:-
    • ATmega328 microcontroller
    • Input voltage - 7-12V
    • 14 Digital I/O Pins (6 PWM outputs)
    • 6 Analog Inputs
    • 32k Flash Memory
    • 16Mhz Clock Speed


Bluetooth Module:-



HC-05 module is an easy to use Bluetooth SPP (Serial Port Protocol) module, designed for transparent wireless serial connection setup.
Serial port Bluetooth module is fully qualified Bluetooth V2.0+EDR (Enhanced Data Rate) 3Mbps Modulation with complete 2.4GHz radio transceiver and baseband. It uses CSR Bluecore 04-External single chip Bluetooth system with CMOS technology and with AFH(Adaptive Frequency Hopping Feature)


Hardware Features


  • Typical -80dBm sensitivity
  • Up to +4dBm RF transmit power
  • Low Power 1.8V Operation ,1.8 to 3.6V I/O
  • PIO control
  • UART interface with programmable baud rate
  • With integrated antenna
  • With edge connector

L298N Motor Driver:-


Internally the L298N consists of four independent power amps with 5-volt digital inputs and four high current, high voltage power amplifiers capable of driving single DC motors, and both unipolar and bi-polar stepper motors.
The four amplifiers are usually used in pairs forming an H-bridge to switch polarity for to control the direction of a single DC motor or as two pairs of H-bridges a bi-polar stepper motor. This part seems to be the favorite of hobby robot builders.

Step By step Procedure to make An Android Controlled Robot:-
 Chassis:-
Either Use Readymade Chassis some of them are As following:-

Or Make a easy one like i made:-
  1. We need some Large  space so Bring two Bad CD/DVD Drive from old PC.
  2. Open the Case/Outlet/Outer Body Of that CD/DVD drive using Screw Driver.
  3. Join them As shown in the image.
  4. Now Connect the clamps of the geared Motor,If you are using Bo Motor then fit them on the chassis as Following diagram.

So now we have made a chassis for the complete Project.and we are moving to the next most important thing which is Circuit Assembly.
Observe the following circuit Diagram which is made by Fritzing Software and than Make the connection.

Circuit Diagram To Make an Android Controlled Robot v2


  • Power Supply:-
    • L298N's +12v         =  +12v battery
    • L298N's GND        =  Gnd of Battery and GND of Arduino
    • L298N's 5v            =  Arduino's VIN
  • Arduino Board ---- Bluetooth Module
    • Arduino's RX       = Bluetooth Module's Tx
    • Arduino's TX       = Bluetooth Module's Rx
    • Arduino's 5v         = Bluetooth Module's VCC
    • Arduino's GND    = Bluetooth Module's GND
  • Arduino Board ---- L298N Motor Driver Board
    • Arduino's 5           = in1
    • Arduino's 6           = in2
    • Arduino's 10         = in3
    • Arduino's 11         = in4
  • Arduino Board ---- LED and Buzzer
    • Arduino's 2           = Buzzer's red
    • Arduino's 3           = Red Led ( with 220ohm resistor)
    • Arduino's 4           = White LED ( with 220ohm resistor)
Also Read:-
Distance Measuring LED's Bar Graph For Parking Sensor
 

Traffic Light System with Pedestrian Crossing lights

Code or Program to Make an Android Controlled Robot v2

Download the file AndroBot_rover.ino
or copy following Code and paste in IDE
//The AndroBot By Sourabh Kumar @ http://www.androroot.com
#define in1 5 //L298n Motor Driver pins.
#define in2 6
#define in3 10
#define in4 11
#define whitelight 4
#define redlight 3
#define buzzer 2
#define LED 12
int command; //Int to store app command state.
int Speed = 204; // 0 - 255.
int Speedsec;
int buttonState = 0;
int lastButtonState = 0;
int Turnradius = 0; //Set the radius of a turn, 0 - 255 Note:the robot will malfunction if this is higher than int Speed.
int brakeTime = 45;
int brkonoff = 1; //1 for the electronic braking system, 0 for normal.
void setup() {
  pinMode(LED, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);
  pinMode(whitelight, OUTPUT);
  pinMode(redlight, OUTPUT);
  pinMode(buzzer, OUTPUT);
  Serial.begin(9600);  //Set the baud rate to your Bluetooth module.
    Serial.println("The SKY Bot");
}
 void loop()
 {if (Serial.available() > 0) {
    command = Serial.read();
    Stop(); //Initialize with motors stoped.
    switch (command) {
      case 'F':
        forward();
        break;
      case 'B':
        back();
        break;
      case 'L':
        left();
        break;
      case 'R':
        right();
        break;
      case 'G':
        forwardleft();
        break;
      case 'I':
        forwardright();
        break;
      case 'H':
        backleft();
        break;
      case 'J':
        backright();
        break;
      case '0':
        Speed = 100;
        break;
      case '1':
        Speed = 140;
        break;
      case '2':
        Speed = 153;
        break;
      case '3':
        Speed = 165;
        break;
      case '4':
        Speed = 178;
        break;
      case '5':
        Speed = 191;
        break;
      case '6':
        Speed = 204;
        break;
      case '7':
        Speed = 216;
        break;
      case '8':
        Speed = 229;
        break;
      case '9':
        Speed = 242;
        break;
      case 'q':
        Speed = 255;
        break;
     
    case 'U': // Red light on
    Serial.println("Red LIght On");
    digitalWrite(redlight, HIGH);
    break;
 
    case 'u': // Red light off
    Serial.println("Red Light Off");  
    digitalWrite(redlight, LOW);
    break;
 
    case 'W': // Front Lights On
    Serial.println("White LIght On");
    digitalWrite(whitelight, HIGH);
    break;
 
    case 'w': // Front Lights Off
    Serial.println("White Light Off");  
    digitalWrite(whitelight, LOW);
    break;
 
    case 'V': //Buzzer On
    Serial.println("Buzzer On");
    digitalWrite(buzzer, HIGH);
    break;
 
    case 'v': // Buzzer OFF
    Serial.println("Buzzer Off");  
    digitalWrite(buzzer, LOW);
    break;
    }
    Speedsec = Turnradius;
    if (brkonoff == 1) {
      brakeOn();
    } else {
      brakeOff();
    }
  }
}
void forward() {
  analogWrite(in1, Speed);
  analogWrite(in3, Speed);
}
void back() {
  analogWrite(in2, Speed);
  analogWrite(in4, Speed);
}
void left() {
  analogWrite(in3, Speed);
  analogWrite(in2, Speed);
}
void right() {
  analogWrite(in4, Speed);
  analogWrite(in1, Speed);
}
void forwardleft() {
  analogWrite(in1, Speedsec);
  analogWrite(in3, Speed);
}
void forwardright() {
  analogWrite(in1, Speed);
  analogWrite(in3, Speedsec);
}
void backright() {
  analogWrite(in2, Speed);
  analogWrite(in4, Speedsec);
}
void backleft() {
  analogWrite(in2, Speedsec);
  analogWrite(in4, Speed);
}
void Stop() {
  analogWrite(in1, 0);
  analogWrite(in2, 0);
  analogWrite(in3, 0);
  analogWrite(in4, 0);
}
void brakeOn() {
  //Here's the future use: an electronic braking system!
  // read the pushbutton input pin:
  buttonState = command;
  // compare the buttonState to its previous state
  if (buttonState != lastButtonState) {
    // if the state has changed, increment the counter
    if (buttonState == 'S') {
      if (lastButtonState != buttonState) {
        digitalWrite(in1, HIGH);
        digitalWrite(in2, HIGH);
        digitalWrite(in3, HIGH);
        digitalWrite(in4, HIGH);
        delay(brakeTime);
        Stop();
      }
    }
    // save the current state as the last state,
    //for next time through the loop
    lastButtonState = buttonState;
  }
}
void brakeOff() {
}




Android App:-
I Found some good apps on Playstore and i also made a App for controlling the Rover:-
Links are as following:-

Option 1:-
Arduino Bluetooth RC Car


The application allows you to control an Arduino based RC car over Bluetooth. This is done using a Bluetooth enabled Android phone. Visit this site https://sites.google.com/site/bluetoothrccar/ for the Arduino code and control circuit. The app lets you control the car with either buttons or the phone's accelerometer. A slider bar allows you to control your car's velocity if the car's control circuit has this feature. There are also two buttons for front and back lights. A flashing light lets you know when the phone is connected to the car, and arrows light up letting you know the car's driving direction.
Option 2:-

With the help of MIT App Developer website i made an app and it is in beta test mode so you can give a try and then if anything goes wrong then we will solve that problem here is the link of my app.

AndroBot Rover.apk

Download the App and Install it in Android Smartphone.

Now we have to burn The code to the Arduino:

Steps are as following:-
  1. Download or copy the Code from the section Code or Program to Make an Android Controlled Robot v2 above.
  2. Now start Your computer transfer the .ino file and open it with Arduino IDE.
  3. Connect the Arduino Board and computer with Connecting Cable.
  4. Select the Port and Board
  5. Compile and Burn the code by clicking on the Upload button which will be on the Top-Left Corner of the IDE.
So now Everything is completed and Our BOT/ROVER is ready.And We just have to Power it UP and Switching It ON.


Steps to Controlling the Rover through The Android Phone:-

  1. Switch the Rover On
  2. In your Phone Go to Settings and find the Bluetooth settings.
  3. Switch on the Bluetooth of the Android Phone,And Search for new Bluetooth Devices.
  4. HC-04/05 will be Appear in the List after search result.
  5. Pair with the Bluetooth module by using Passward:-1234
  6. Now Open the Android App and click on Connect or connect to the bot.
  7. A new window will be appear in which all the Bluetooth devices will be appear.
  8. Click on HC-04/05.
  9. Now your bot is connected with the android Smartphone.
  10. Observe the Buttons and check then one by one by pressing them.
  11. To add a camera take a android phone install AirDroid app in your Smartphone and also on Computer and connect them.Camera option will appear on the main menu on desktop AirDroid click on it.Now place the smartphone in the free space of the rover.
I am not explaining last step because i have some different plan, i will add the camera in the next step.

Also Read:-
Haptic Proximity Module - Cheap and Easy
Make An Ultrasonic Radar or USDAR

If everything goes right and working then congratulate.you have completed Part 1  How To Make an Bluetooth Controlled Rover v2 of AndroBot and we are ready to move on the next step.i will post All Remaining Parts in next few days.Till than think what improvement we can do in this project and share with us.



This post first appeared on Andro Root, please read the originial post: here

Share the post

How To Make an Bluetooth Controlled Rover v2

×

Subscribe to Andro Root

Get updates delivered right to your inbox!

Thank you for your subscription

×