Introduction: Tracked Robot Bluetooth Controlled by Arduino Via Android Application

Picture of Tracked Robot Bluetooth Controlled by Arduino Via Android Application

After trying to remote tracked robot by IR remote control.I have proceed to control same robot platform by Bluetooth

Arduino controller via Android application.This method is more reliable,longer distance,pretty Android application enhancement.

Same principle,low cost play and home level technical skill.Programming khownledge is not necessary.

Thanks for free download Arduino Bluetooth RC Car from Google play.

Project more : http://hobbywitch666.blogspot.com

You can purchase electronic parts from Aliexpress, Banggood, ebay,etc.

Step 1: Materials and Tools

Picture of Materials and Tools

Materials

1.Tamiya Track and wheel set.

2.Tamiya Gear box - Individual drive-two motors.

3.Tamiya perforated plastic plate.

4.Dupont wires 200 mm.

5.Arduino UNO.

6.HC-06 Bluetooth module for Arduino.

7.L298N Dual H-Bridge motor drive module.

8. 2-LEDs(Different color)

9. 2-Resistor 1 kohm. 1/4 watt.

10.Piezo buzzer.

11.Battery 5-12V.

Tools

1.Screw driver.

2.Plier.

Step 2: Mechanical Assembly & Electrical Connecting

Picture of Mechanical Assembly & Electrical Connecting

1.Assembly Track and wheel set as manual instruction.

2.Install Arduino UNO controller ,LEDs ,Buzzer,L298N motor drive module and battery on chassis.

3.Wiring all components together as circuit diagram.(In diagram,It's another motor drive module, I cannot find L298N device.)

Arduino pins to HC-06 :

0 - Rx

1 - Tx

2 - State

Arduino pins to L298N motor drive module :

10 - ENA

9 - IN1

8 - IN2

7 - IN3

6 - IN4

5 - ENB

Connect Arduino GND pin and L298N motor drive module GND.

Arduino pins to L298N motor drive module :
Connect power output to Motor A and B

Connect battery to Arduino controller and L298N drive module (can use battery up to 12V.)

Arduino pins to other parts :

Front light LED - 3

Back light LED - 4

Piezo buzzer - 12

Step 3: The Sketch Code and Android Application

Picture of The Sketch Code and Android Application

Arduino sketch code :

1.Down load and install attached main sketch.

2.Upload sketch to Arduino controller.(Before click upload ,it's necessary to take HC-06 Bluetooth 5V. power off)

3.Open Arduino software serial monitor to see output.

Smart phone/Tablet Android application installation :

1.Use Android smart phone to install "Arduino Bluetooth RC Car" free application from Google play store.

2.Pair Bluetooth communication between smart phone and HC-06.

2.1 Scan device and pair.Password of HC-06 is "1234" from factory.

2.2 After paired ,open application and choose BT connection menu on application to connect between devices.

2.3 If communication complete,green light will appear.If communication not complete,red light will blink.Try to pair device again.

Test each functions on application to find wrong wiring or any mistakes during installation.Normally,software have been tested many times.It should not have any problems.

Let's enjoy!

Comments

Balasubramanir (author)2017-07-25

Bro plzz anyone paste me a code for my arduino ,I have just built an car ,soo plzz help me up to my project of operating with my smart phn ,with basics like front ,stop ,back,left and right directions using bluetooth

nipon4666 (author)Balasubramanir2017-07-27

You can download from the instruction's step.

nipon4666 (author)2016-09-24

Can you check following circuit diagram,that correct or not?
Don't forget to connect the Ground between UNO and L298N.
The battery main power cable have to connect at L298N +12V terminal and GND terminal.
I wonder the serial monitor did not print anything.It mean the command from smartphone did not input BT and UNO.
See attached files.

vinsuka (author)nipon46662016-09-26

may i try ardiuno sheild for my board?

nipon4666 (author)vinsuka2016-09-26

I have re-built the circuit again,I found a new problem that BT HC-06 cannot communicate to smartphone,I have search that someone advice to connect 3.3V to EN or KEY pin of HC-06 to activate.And I succeed to communicate with the App and run it perfectly.(See the VDO at https://youtu.be/eUb5EDz3PSQ )

About the shield, I think you have to modify the sketch according to the instruction of the shield's brand you will use.But I suggest to correct your existing project first.

vinsuka (author)2016-09-21

I uploaded it successfully.and i paired it with my smartphone.but it dosent move.why is that?

nipon4666 (author)vinsuka2016-09-23

Can you open serial monitor to see what step it's doing ?
If you push forward it printed "forward" then it should go.
if motors quiet,there many possible problem of circuit connection.Can you check or take a photo?

PS.When the app on ready the light must be green.

vinsuka (author)nipon46662016-09-24

when i pushed forward it doesnt print anything.i cheked l298 motor driver board and it works perfectly.ardiuno board is also working perfectly.this is my robot--

nipon4666 (author)vinsuka2016-09-24

I wonder the monitor did not show anything,If the sketch uploaded correctly.It means no input to controller to execute.Can you check the circuit diagram there are something wrong between BT module UNO and L298N or not.

Perhap,you can try interchanging Tx and Rx at BT pin,possibly wrong data input to output.

See attached files.

nipon4666 (author)vinsuka2016-09-22

Could you check the phone paired with BT module or not ,It would ask password that usually 1234 or 0000?
If the device status unpaired the app will show red circle.

vinsuka (author)nipon46662016-09-23

yeah i checked it all.then i checked my Bluetooth module with a hyper terminal bluetooth app.then i figured out this.i can send any texts to my phone via ardiuno serial monitor.But i cant send any texts to the serial monitor vi my phone.Is that a problem in Bluetooth module?

Adarsh C (author)2016-09-05

bro
when I upload the code " An error occurred while uploading the sketch" comes
which version u used for coding??
or any other solution!??

Adarsh C (author)Adarsh C2016-09-05

problem solved I used 1.6.9

nipon4666 (author)Adarsh C2016-09-05

Yeh,use Arduino classic is better.

nipon4666 (author)2016-08-26

Geared motor and 360 degree Servo for robotic application.

Adarsh C (author)2016-08-26

another confusion
if I don't have those wheels and set can u use other motors and plzz say what is the rpm and voltage of motor I have to use

nipon4666 (author)Adarsh C2016-08-26

You can apply on two geared wheel with one free swivel wheel.It acts like tracked robot. L298N can drive motor from 3-6V. This tiny robot use DC motors not over 6V. no problem.

Adarsh C (author)Adarsh C2016-08-26

*can i

Adarsh C (author)2016-08-25

if I don't want buzzer and led can I remove it?? without changing code??

nipon4666 (author)Adarsh C2016-08-25

You do not install hardware,no effect at all,no need to modify sketch.

Adarsh C (author)Adarsh C2016-08-25

if I don't need only buzzer

MalikH11 (author)2016-06-27

my code cant open

nipon4666 (author)MalikH112016-06-27

/*******************************************************************/

/* Written by Pason Tanpaiboon // 14-01-2016 V.1.3

/* Project: Tracked Robot via Arduino Bluetooth with Android Smartphone

/* 29/2/2016 change input sketch-delay control solving

/* 29/2/2016 modify command step

/*******************************************************************/

//Buzzer / Speaker to Arduino UNO Pin 12

const int buzzer = 12 ;

//Bluetooth (HC-06 JY-MCU) State pin on pin 2 of Arduino

const int BTState = 2;

const int pinfrontLights = 3; //Pin that activates the Front lights.

const int pinbackLights = 4; //Pin that activates the Back lights.

int state;

int vSpeed=255; // Default speed, from 0 to 255

/****************************************************************/

//Motor based on L298N motor drive module

// motor A

int enA = 10;

int in1 = 9;

int in2 = 8;

// motor B

int enB = 5;

int in3 = 7;

int in4 = 6;

String readString;

/*****************************************************************/

void setup() {

pinMode(pinfrontLights, OUTPUT);

pinMode(pinbackLights, OUTPUT);

pinMode(buzzer, OUTPUT);

pinMode(BTState, INPUT);

pinMode(enA, OUTPUT);

pinMode(enB, OUTPUT);

pinMode(in1, OUTPUT);

pinMode(in2, OUTPUT);

pinMode(in3, OUTPUT);

pinMode(in4, OUTPUT);

// Initialize serial communication at 9600 bits per second:

Serial.begin(9600);

}

void loop() {

/***********************************Bluetooth**********************************************/

//Stop car when connection lost or bluetooth disconnected

if(digitalRead(BTState)==LOW) {

state='S';

}

//Save income data to variable 'state'

if(Serial.available() > 0){

state = Serial.read();

delay(15);

}

//Chars '0' - '9' have an integer equivalence of 48 - 57, accordingly.

else if((state >= 48) && (state <= 57))

{

//Subtracting 48 changes the range from 48-57 to 0-9.

//Multiplying by 28 changes the range from 0-9 to 0-255(L298N max speed)

vSpeed = (state - 48)*28.3;

// yellowCar.SetSpeed_4W(velocity);

Serial.println(vSpeed);

}

/***********************Forward****************************/

//If state is equal with letter 'F', car will go forward!

if (state == 'F') {

// turn on motor A

digitalWrite(in1, HIGH);

digitalWrite(in2, LOW);

analogWrite(enA, vSpeed);

// turn on motor B

digitalWrite(in3,HIGH);

digitalWrite(in4, LOW);

analogWrite(enB, vSpeed);

Serial.println("Going forward");

}

/**********************Forward Left************************/

//If state is equal with letter 'G', car will go forward left

if (state == 'G') {

// turn on motor A

digitalWrite(in1, HIGH);

digitalWrite(in2, LOW);

analogWrite(enA, vSpeed);

// turn on motor B

digitalWrite(in3, LOW);

digitalWrite(in4, LOW);

analogWrite(enB, vSpeed);

Serial.println("Forward left");

}

/**********************Forward Right************************/

//If state is equal with letter 'I', car will go forward right

if (state == 'I') {

// turn on motor A

digitalWrite(in1, LOW);

digitalWrite(in2, LOW);

analogWrite(enA, vSpeed);

// turn on motor B

digitalWrite(in3, HIGH);

digitalWrite(in4, LOW);

analogWrite(enB, vSpeed);

Serial.println("Going forward-right");

}

/***********************Backward****************************/

//If state is equal with letter 'B', car will go backward

if (state == 'B') {

// turn on motor A

digitalWrite(in1, LOW);

digitalWrite(in2, HIGH);

analogWrite(enA, vSpeed);

// turn on motor B

digitalWrite(in3, LOW);

digitalWrite(in4, HIGH);

analogWrite(enB, vSpeed);

Serial.println("Going backward");

}

/**********************Backward Left************************/

//If state is equal with letter 'H', car will go backward left

if (state == 'H') {

// turn on motor A

digitalWrite(in1, LOW);

digitalWrite(in2, HIGH);

analogWrite(enA, vSpeed);

// turn on motor B

digitalWrite(in3, LOW);

digitalWrite(in4, LOW);

analogWrite(enB, vSpeed);

Serial.println("Going backward-left");

}

/**********************Backward Right************************/

//If state is equal with letter 'J', car will go backward right

if (state == 'J') {

// turn on motor A

digitalWrite(in1, LOW);

digitalWrite(in2, LOW);

analogWrite(enA, vSpeed);

// turn on motor B

digitalWrite(in3, LOW);

digitalWrite(in4, HIGH);

analogWrite(enB, vSpeed);

Serial.println("Going backward-right");

}

/***************************Left*****************************/

//If state is equal with letter 'L', wheels will turn left

if (state == 'L') {

// turn on motor A

digitalWrite(in1, HIGH);

digitalWrite(in2, LOW);

analogWrite(enA, vSpeed);

// turn on motor B

digitalWrite(in3, LOW);

digitalWrite(in4, HIGH);

analogWrite(enB, vSpeed);

Serial.println("Rotating left");

}

/***************************Right*****************************/

//If state is equal with letter 'R', wheels will turn right

if (state == 'R') {

// turn on motor A

digitalWrite(in1, LOW);

digitalWrite(in2, HIGH);

analogWrite(enA, vSpeed);

// turn on motor B

digitalWrite(in3, HIGH);

digitalWrite(in4, LOW);

analogWrite(enB, vSpeed);

Serial.println("Rotating right");

}

/************************front Lights*****************************/

//If state is equal with letter 'W', turn front leds on

if (state == 'W') {

digitalWrite(pinfrontLights, HIGH);

Serial.println("Frontlight on");

}

if (state == 'w') {

digitalWrite(pinfrontLights, LOW);

Serial.println("Frontlight off");

}

/************************Back Lights*****************************/

//If state is equal with letter 'W', turn front leds on

if (state == 'U') {

digitalWrite(pinbackLights, HIGH);

Serial.println("Backlight on");

}

if (state == 'u') {

digitalWrite(pinbackLights, LOW);

Serial.println("Backlight off");

}

/**********************Horn sound***************************/

//If state is equal with letter 'V', play (or stop) horn sound

if (state == 'V'){

tone(buzzer, 1000);//Speaker on

Serial.println("Horn on");

}

if (state == 'v'){

noTone(buzzer); //Speaker off

Serial.println("Horn off");

}

/************************Stop*****************************/

//If state is equal with letter 'S', stop the car

if (state == 'S'){

// turn on motor A

digitalWrite(in1, LOW);

digitalWrite(in2, LOW);

analogWrite(enA, vSpeed);

// turn on motor B

digitalWrite(in3, LOW);

digitalWrite(in4, LOW);

analogWrite(enB, vSpeed);

}

}//void loop()end

MalikH11 (author)2016-06-27

can some one paste the code for me please

nipon4666 (author)2016-04-10

Before uploading ,take bluetooth power pin off,nevertheless error will occur.

PramojT (author)2016-04-10

I got this message while try to upload the code..


exit status 1
'BTState' was not declared in this scope

I dont know how to solve this. Need your kindly advice Sir.

PramojT (author)PramojT2016-04-10

After few times Try n Error uploading..now I succesfully uploaded the code. Thanks.

PramojT (author)2016-04-06

Just got HC-06 and realized that it have no ' State' pin which need to connect Hc-06 to Arduino. HC-06 have 4 pins. Do I have to add new pin for State pin in Hc06?

nipon4666 made it! (author)PramojT2016-04-07

You can solder one more pin at the state hole.Mine also done too.

nipon4666 (author)2016-04-01

You can try I think it should work exactly.

sanjith.tt (author)2016-04-01

can i use hc 05

Zenil mehta (author)2016-03-12

Bro do I need to use the abive bluetooth controller app or I can use any other app too.........if I can use any other app then would I need to do any change in the code ..........plzzzzzzzzzz help

nipon4666 (author)Zenil mehta2016-03-13

Yes,it can do but you have to study the App.that you want to use and adapt the sketch.Like in attached sketch command "F" order to go forward.Other app. may use "A" to go forward.

deswiger (author)2016-03-04

I once built a large remote tank (many, many years ago), but the batteries never lasted long. So I took the batteries from our military radio and form fitted it in steed and I could not run fast enough to keep up.

Question; you are useing a 9 volt, what if we up that to say a 12v or even 18v and add a camera? [maybe a BB gun, remote arm, tazer, speaker and mic for comm.... too much huh, well maybe just a camera then]

nipon4666 made it! (author)deswiger2016-03-06

This tracked robot ,I used 7.2 LIPO batt.It's too much powerful for motor 130.I have a 1/16 M26 tank installed FPV using 7.2V Nicd Batt.Have BB gun,smoke fumer,sound.Never have problem with battery.How big is your tank?What's the motor size?

deswiger (author)nipon46662016-03-07

Good info, thanks.

deswiger (author)nipon46662016-03-06

Back then (1975ish) it was the TAMIYA 1/16 R/C Leopard 2 A6 Main Battle Tank, powered by 2 high-torque Type 540 motors and a 7.2v battery. Converting it to use a 12 v NiCad made it rip up the grass and even be able to go 2/3 submerged for a short time. No guns or lights then but the ramming power made all others run in fear. I added cut down tacks to the treads for grip and could climb most any surface. Man I miss that thing. Of course since then it is long gone but hopefully soon to have a come back as my grandsons get old enough.

nipon4666 (author)deswiger2016-03-06

I think Tamiya motor 540 only 6V. 12V supply could damage electronic speed control.May be motors too.But you can find Tamiya spare in ebay if you want to resurrect it.

malimaipolakrit (author)2016-03-02

hc-06 not State ?

What's the question meaning?

BrooklineLocksmith (author)2016-03-02

Great work

Thank you friend.

ЕвгенийП8 (author)2016-03-01

may I use hc-05?

I think it should be Yes.If it has pin STATE Rx Tx Vcc GND.

About This Instructable

5,461views

140favorites

License:

More by nipon4666:How to Build 8 Channel Transmitter nrf24l01 ArduinoHow to Control Tracked Robot Via 3-Channel RC Transmitter + ArduinoHow to Control Tracked Robot Via Joystick NRF24L01 Module Arduino Part2 Rx
Add instructable to: