Arduino Bluetooth Rc Car

4,952

32

12

this is my first Arduino project it is quite simple to make .
it will take about half an hour to make it it's quite simple as you think
you can also make it by following steps given below and make have fun it's give me create joy when I finally made it .
now it's your turn to make it.
just follow the steps given under description

Step 1: Requirements

Arduino uno board
Bluetooth module hc 05
4wd shield (adafruit)
Jumper wires
Two 9v battery (1. arduino board
2. external power supply to sheild )
Battery cap with 9v pin jack

Step 2: Connection

mount the shield on arduino board and connect Bluetooth to the audino or directly to the shield by soldering on it connect RX to TX ,TX to RX ,ground to ground ,vcc to vcc as shown in the figure and also connect Motors to M1 (left) and M2 (right)

Step 3: Coding

//*** 1- Documentation
//This program is used to control a robot car using a app that communicates with Arduino trough a bluetooth module

#include <AFMotor.h>


//creates two objects to control the terminal 3 and 4 of motor shield
AF_DCMotor motor1(3);
AF_DCMotor motor2(4);

char command;

void setup()
{
Serial.begin(9600); //Set the baud rate to your Bluetooth module.
}

void loop(){
if(Serial.available() > 0){
command = Serial.read();
Stop(); //initialize with motors stoped
//Change pin mode only if new command is different from previous.
//Serial.println(command);
switch(command){
case 'F':
forward();
break;
case 'B':
back();
break;
case 'L':
left();
break;
case 'R':
right();
break;
}
}
}

void forward()
{
motor1.setSpeed(255); //Define maximum velocity
motor1.run(FORWARD); //rotate the motor clockwise
motor2.setSpeed(255); //Define maximum velocity
motor2.run(FORWARD); //rotate the motor clockwise
}

void back()
{
motor1.setSpeed(255);
motor1.run(BACKWARD); //rotate the motor counterclockwise
motor2.setSpeed(255);
motor2.run(BACKWARD); //rotate the motor counterclockwise
}

void left()
{
motor1.setSpeed(255); //Define maximum velocity
motor1.run(FORWARD); //rotate the motor clockwise
motor2.setSpeed(0);
motor2.run(RELEASE); //turn motor2 off
}

void right()
{
motor1.setSpeed(0);
motor1.run(RELEASE); //turn motor1 off
motor2.setSpeed(255); //Define maximum velocity
motor2.run(FORWARD); //rotate the motor clockwise
}

void Stop()
{
motor1.setSpeed(0);
motor2.run(RELEASE); //turn motor1 off
motor2.setSpeed(0);
motor2.run(RELEASE); //turn motor2 off
}

Step 4: Uploading

remove Bluetooth module before uploading the codes

Step 5: Power Supply

connect 9 volt battery to arduino board and you can also connect 9 volt battery to shield through external power to increase power supply to your Motors
remove the power jumper shown in the figure.

Step 6: Install App

install Bluetooth RC controller app through play store
open the app
it ask for permission turn on Bluetooth allow it
the first time password is 1234 or 0000
then click on gear shown in the app now "choose connect to car"
the red button blinking in the app turn to green
now you are connected to your car play with it and enjoy your project.

thank you for watching this instruction

Share

Recommendations

  • Arduino Contest 2019

    Arduino Contest 2019
  • Classroom Science Contest

    Classroom Science Contest
  • Colors of the Rainbow Contest

    Colors of the Rainbow Contest

12 Discussions

0
None
ms5728

1 year ago

Hi sir. Can u help me to edit the same bluetooth control car with arduino by adding
1. ultrasonic sensor as sense the obstacle
2. 2 leds green when forward
3. 2 leds red when reverse
4. Siren by using buzzer
5. 1 led stop yellow

0
None
supniz

2 years ago

Hi, I am getting a lot of code errors, could you please help

C:\Users\user\Documents\Arduino\libraries\arduino_723047\src\Temboo.cpp: In member function 'int TembooChoreo::run(IPAddress, uint16_t, uint16_t)':

C:\Users\user\Documents\Arduino\libraries\arduino_723047\src\Temboo.cpp:281:52: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

if (!m_client.findUntil("HTTP/1.", HTTP_EOL)) {

^

C:\Users\user\Documents\Arduino\libraries\arduino_723047\src\Temboo.cpp:301:62: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

if (m_client.findUntil("x-temboo-time:", HTTP_EOH)) {

^

C:\Users\user\AppData\Local\Temp\ccqB0Z6e.ltrans0.ltrans.o: In function `__static_initialization_and_destruction_0':

C:\Users\user\Documents\BTcar\CarCode/CarCode.ino:6: undefined reference to `AF_DCMotor::AF_DCMotor(unsigned char, unsigned char)'

C:\Users\user\Documents\BTcar\CarCode/CarCode.ino:7: undefined reference to `AF_DCMotor::AF_DCMotor(unsigned char, unsigned char)'

C:\Users\user\AppData\Local\Temp\ccqB0Z6e.ltrans0.ltrans.o: In function `Stop':

C:\Users\user\Documents\BTcar\CarCode/CarCode.ino:73: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'

C:\Users\user\Documents\BTcar\CarCode/CarCode.ino:74: undefined reference to `AF_DCMotor::run(unsigned char)'

C:\Users\user\Documents\BTcar\CarCode/CarCode.ino:75: undefined reference to `AF_DCMotor::setSpeed(unsigned char)'

C:\Users\user\Documents\BTcar\CarCode/CarCode.ino:76: undefined reference to `AF_DCMotor::run(unsigned char)'

2 replies
0
None
shaileshY3supniz

Reply 2 years ago

and remove the Bluetooth module before uploading the code

0
None
shaileshY3supniz

Reply 2 years ago

maybe you should first install AFmotor library. it is easy To get through adafruit official site.

0
None
marlonss

2 years ago

Thanks for posting. Will save me time trying to figure it out.

1 reply
0
None
shaileshY3MuhammadA950

Reply 2 years ago

definitely it will works if you follow the instructions properly.

0
None
AryanD6

2 years ago

Can you tell the use of the shield and the connections bit more in detail also can this be made without the shield??

1 reply
0
None
shaileshY3AryanD6

Reply 2 years ago

if you using the shield I mentioned then you just mount pin to pin right mentioned on arduino and the shield it is quite easy to use.

0
None
shaileshY3

2 years ago

thanks for appreciating me??

0
None
shaileshY3

2 years ago

thanks for appreciating me ??