Bluetooth Controlled Robot Car Using Arduino

54,549

42

39

Introduction: Bluetooth Controlled Robot Car Using Arduino

About: Student at University of Colombo

In this instructable, i'm going to guide you on making a robot car that control over Bluetooth from your android mobile phone. Not only that, the robot car has special ability of avoiding obstacles which it meet when moving the car forward. The robot car is fully based on arduino and I hope to do step by step guide on making this robot in very easy way. Hope you will enjoy it.

Step 1: What You Need for This Robot

  1. Arduino UNO - https://www.ebay.com/p/Arduino-UNO-R3-Board-With-...
  2. HC-06 Bluetooth Module - https://www.ebay.com/itm/2PCS-Wireless-Serial-4-Pi...
  3. L298n motor driver - https://www.ebay.com/itm/New-L298N-DC-Stepper-Mot...
  4. HC-SR04 Ultrasonic Sonar Sensor - https://www.ebay.com/itm/Ultrasonic-HC-SR04-HC-SR...
  5. Smart robot car chassis with 2 x toy car wheels and 1 x Universal wheel (or ball casters) - https://www.ebay.com/itm/Motor-New-Smart-Robot-Ca...
  6. Two DC motors - https://www.ebay.com/itm/Arduino-Smart-Car-Robot-...
  7. 2x 9V Batteries
  8. 1K and 2K Resistors
  9. Jumper wires (male-to-male, male-to-female)
  10. Mini breadboard
  11. Screws and nuts
  12. Screwdriver
  13. Soldering iron
  14. Double sided tape(optional)
  15. Hot glue gun(optional)

Step 2: Assembling the Chassis

Solder two wires to each DC motor. Then fix two motors to the chassis using the screws. If you need any clarification, please watch this youtube video https://www.google.lk/url?sa=t&rct=j&q=&esrc=s&so... and it will show you how to assemble the Smart 2WD Robot car chassis. Finally attach the Universal wheel (or ball caster wheel) to the back of the chassis.

Step 3: Mount the Components

Mount the Arduino UNO, L298n motor driver and the Breadboard on the chassis. Attach the HC-06 Bluetooth module on the breadboard. Mount the HC-SR04 Ultrasonic sensor at the front of the chassis. Note: when mounting the arduino board, leave enough space to plug the USB cable, since later you have to program the arduino board by connecting the it to the PC via a USB cable.

Step 4: HC-06 Bluetooth Module Connections

Tip: This circuit diagram only shows you, how the pins of HC-06 Bluetooth module should be connected to the arduino board. This is not the circuit diagram of our robot.

Make resistor connections correctly!!!

You can use 'two series 1K' resistors instead of 2K resistor.

Power the Bluetooth module using arduino 5V output.

Important: You have to remove any connections you made to the arduino digital pin 0(RX) and digital pin 1(TX) before upload any code. Otherwise your code will not upload to the board. After uploading the code, you can plug wires to both pins.

Step 5: Wire Connections

L298n motor driver:

+12V → 9V battery (+)

GND → 9V battery (- ) and to arduino board any GND pin

In1 → arduino digital pin 7

In2 → arduino digital pin 6

In3 → arduino digital pin 5

In4 → arduino digital pin 4

OUT1 → Motor 1

OUT2 → Motor 1

OUT3 → Motor 2

OUT4 → Motor 2

HC-SR04 Ultrasonic Sonar sensor:
VCC → +5V

Trig → arduino analog pin 1

Echo → arduino analog pin 2

GND → breadboard GND

HC-06 Bluetooth module:

VCC → +5V

GND → breadboard GND

TXD → arduino digital pin 0 (RX)

RXD → arduino digital pin 1 (TX) [after going throught resistor connections]


Step 6: Programming Arduino UNO

  1. Install NewPing Library. (Ultrasonic sensor function library)
    • Download the NewPing.rar file
    • Unrar the file and copy NewPing file
    • Paste the file to Arduino libraries folder where you have installed the Arduino software in your PC (e.g:-C:\Arduino\libraries)
  2. Download and open bluetooth_obstacle_avoiding.ino
  3. Remove any connections made to arduino digital pin 0 (RX) and digital pin 1 (TX)
  4. Upload the bluetooth_obstacle_avoiding.ino code
  5. Make necessary connections to arduino digital pin 0 (RX) and digital pin 1 (TX) again

Step 7: The Android App

  1. Download mkrbot.apk on your android mobile
  2. Install the app. If your mobile prevent installing the app, Go to settings → security → enable unknown sources
  3. Open the app
  4. At the beginning, the app will show "Disconnected" and the HC-06 Bluetooth module red LED will blink
  5. Tap the Bluetooth symbol ᛒ on the app
  6. Select something named with HC-06
  7. Now the app will show connected and the LED in the HC-06 Bluetooth module will light up continuously without blinking

Step 8: Great!!!

Now you can control the robot from your android mobile over Bluetooth and it will automatically avoid any obstacle before crash!!!

I would be happy to answer any questions you have

email me: dnayantha88@gmail.com

search me on facebook and linkedin for more projects - Danusha nayantha

Thank You

Arduino Contest 2017

Participated in the
Arduino Contest 2017

Remote Control Contest 2017

Participated in the
Remote Control Contest 2017

Epilog Challenge 9

Participated in the
Epilog Challenge 9

3 People Made This Project!

Recommendations

  • The 1000th Contest

    The 1000th Contest
  • Battery Powered Contest

    Battery Powered Contest
  • Hand Tools Only Challenge

    Hand Tools Only Challenge

39 Discussions

0
iaghajani
iaghajani

2 months ago

thanks.. i need more btn for light and ..
how to build it ?!

0
Nayantha KGD
Nayantha KGD

Reply 2 months ago

Need more details about your problem, then I can help you. Type of lights, purpose ..etc

0
iaghajani
iaghajani

Reply 2 months ago

I'm making a replica. A truck..
Two buttons to move the container up and down (up and down)
One button for the trailer headlight
One button for taillight (brake)
One button for flasher (right and left simultaneously)
One button for high beam front ..
Thank you for your attention and response

0
Nayantha KGD
Nayantha KGD

Reply 2 months ago

You need more buttons to operate lights but unfortunately the App I have used in this project has only four. I.e. the app can be only used for move the robot front, back, left & right.
However there are other apps in the app store with more buttons. First you have to find a suitable one. Then modify the code accordingly.

0
iaghajani
iaghajani

Reply 2 months ago

thank you dear..
i create app with "appinventor" :)

1
Nayantha KGD
Nayantha KGD

2 years ago

Please vote me on instructables contests!!!

Thank you

0
harshas31
harshas31

Reply 3 months ago

hello nayantha, i made it using node MCU
the problem is it is not detecting obstacles when any command is already executed

















0
Nayantha KGD
Nayantha KGD

Reply 3 months ago

Hello, have you ever used the ultrasonic sensor with node MCU before? Did you make any changes to the code?

0
RathnajiM
RathnajiM

Question 1 year ago

Wat is the Rpm of two DC motors

1
Star Robatics
Star Robatics

Answer 1 year ago

Those are very cheap motors, you can use more powerful motors with higher rmp

0
RathnajiM
RathnajiM

Question 1 year ago on Introduction

What is the range of HC-SR04 ultra sonic sensors

0
SachinR51
SachinR51

1 year ago

Without breadbox it will work

0
SachinR51
SachinR51

1 year ago

Sir i upload this code on my arduino my bluetooth module start working but my ultrasonic sensor didn't work why?

0
Star Robatics
Star Robatics

Reply 1 year ago

Did You get any error message while uploading the code?
If the code completely uploaded into your arduino, there must be some error with your hardware connections.

0
profbilal0
profbilal0

Question 1 year ago on Step 8

I have done each and every step but brother DC motors are not rotating through module, if i apply separate 9V to each motor then they work, what should i Do? I am too stuck, please help

0
profbilal0
profbilal0

Answer 1 year ago

Brother thank you very much connection was bit loose. Brother what about power supoly have connected 3x 9V batteries in parallel then it worked but bluetooth module disconnected early as 9V is used to energize arduino,so what i should do about power supply?

0
Star Robatics
Star Robatics

Answer 1 year ago

Do you have grounded (GND) the motor driver?

1
thebrophet
thebrophet

2 years ago

The compiler is showin some kind error in program

Arduino: 1.8.5 (Windows Store 1.8.10.0) (Windows 10), Board: "Arduino/Genuino Uno"

------

Downloads\bluetooth_obstacle_avoiding\bluetooth_obstacle_avoiding.ino:2:21: fatal error: NewPing.h: No such file or directory

#include <NewPing.h>

^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
-------
please help
0
Star Robatics
Star Robatics

Reply 2 years ago

You have to install the Newping library first.
Please download and copy, phaste it to the Arduino/libaries where you have installed Arduino software in your pc.

Then delete the #include part in my code and re enter it by following
Sketch-->include libaries--->NewPing

If you have trouble, give me your email address and i will send you screenshots of how to install NewPing