Bluetooth control arduino car

Bluetooth Controlled Car

This is my first Arduino-based, Bluetooth-controlled RC car. It is controlled by a smart phone application.

Dual H-Bridge motor drivers L298

Maker Essentials — Micro-motors & Grippy Wheels

\t Arduino Bluetooth RC Car

Code for Arduino blootooth controlled RC Car

This is the code you will have to upload to your Arduino board.

1char t; 2 3void setup()  4pinMode(13,OUTPUT); //left motors forward 5pinMode(12,OUTPUT); //left motors reverse 6pinMode(11,OUTPUT); //right motors forward 7pinMode(10,OUTPUT); //right motors reverse 8pinMode(9,OUTPUT); //Led 9Serial.begin(9600); 10 11> 12 13void loop()  14if(Serial.available()) 15 t = Serial.read(); 16 Serial.println(t); 17> 18 19if(t == 'F') //move forward(all motors rotate in forward direction) 20 digitalWrite(13,HIGH); 21 digitalWrite(11,HIGH); 22> 23 24else if(t == 'B') //move reverse (all motors rotate in reverse direction) 25 digitalWrite(12,HIGH); 26 digitalWrite(10,HIGH); 27> 28 29else if(t == 'L') //turn right (left side motors rotate in forward direction, right side motors doesn't rotate) 30 digitalWrite(11,HIGH); 31> 32 33else if(t == 'R') //turn left (right side motors rotate in forward direction, left side motors doesn't rotate) 34 digitalWrite(13,HIGH); 35> 36 37else if(t == 'W') //turn led on or off) 38 digitalWrite(9,HIGH); 39> 40else if(t == 'w') 41 digitalWrite(9,LOW); 42> 43 44else if(t == 'S') //STOP (all motors stop) 45 digitalWrite(13,LOW); 46 digitalWrite(12,LOW); 47 digitalWrite(11,LOW); 48 digitalWrite(10,LOW); 49> 50delay(100); 51>

Источник

Bluetooth Controlled Car using Arduino

Arduino bluetooth controlled car

In this project, we will learn how to make a bluetooth controlled car using Arduino. we will be using HC-05 Bluetooth Module and L293D Motor Driver Module. To enable bluetooth communication, we will use a smart phone and a simple Android app to control the car.

Before proceeding with this tutorial, it’s good to go through my other tutorials on HC-05 Bluetooth module and L293D Motor Driver module.

Main components needed for making a Bluetooth controlled car.

hc-05 Bluetooth module

The HC-05 Bluetooth Module is responsible for enabling Bluetooth communication between Arduino and the Android Phone.

l293d motor driver shield for Arduino

The L293D Motor Driver module is responsible for providing the necessary current to drive the motors of the car.

Schematic for Bluetooth Controlled Car using Arduino.

The RX and TX pins of the Bluetooth module are connected after uploading the code to the Arduino.

This setup requires sufficient power supply to be able to run the four motors and the Bluetooth Module. If the power is not sufficient, even though the Bluetooth Module powers on, it cannot transmit data or cannot be paired with other Bluetooth devices. I recommend using rechargeable batteries that can supply a steady current for a longer period of time.

Code for controlling the Bluetooth Controlled car with Arduino.

Since we are using the L293D motor driver shield, we have to use the AFMotor.h library which contains the commands for driving the four dc motors attached to the shield.

#include //initial motors pin AF_DCMotor motor1(1); AF_DCMotor motor2(2); AF_DCMotor motor3(3); AF_DCMotor motor4(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 motor3.setSpeed(255);//Define maximum velocity motor3.run(FORWARD); //rotate the motor clockwise motor4.setSpeed(255);//Define maximum velocity motor4.run(FORWARD); //rotate the motor clockwise >void back() < motor1.setSpeed(255); //Define maximum velocity motor1.run(BACKWARD); //rotate the motor anti-clockwise motor2.setSpeed(255); //Define maximum velocity motor2.run(BACKWARD); //rotate the motor anti-clockwise motor3.setSpeed(255); //Define maximum velocity motor3.run(BACKWARD); //rotate the motor anti-clockwise motor4.setSpeed(255); //Define maximum velocity motor4.run(BACKWARD); //rotate the motor anti-clockwise >void left() < motor1.setSpeed(255); //Define maximum velocity motor1.run(BACKWARD); //rotate the motor anti-clockwise motor2.setSpeed(255); //Define maximum velocity motor2.run(BACKWARD); //rotate the motor anti-clockwise motor3.setSpeed(255); //Define maximum velocity motor3.run(FORWARD); //rotate the motor clockwise motor4.setSpeed(255); //Define maximum velocity motor4.run(FORWARD); //rotate the motor clockwise >void right() < 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 motor3.setSpeed(255); //Define maximum velocity motor3.run(BACKWARD); //rotate the motor anti-clockwise motor4.setSpeed(255); //Define maximum velocity motor4.run(BACKWARD); //rotate the motor anti-clockwise >void Stop() < motor1.setSpeed(0); //Define minimum velocity motor1.run(RELEASE); //stop the motor when release the button motor2.setSpeed(0); //Define minimum velocity motor2.run(RELEASE); //rotate the motor clockwise motor3.setSpeed(0); //Define minimum velocity motor3.run(RELEASE); //stop the motor when release the button motor4.setSpeed(0); //Define minimum velocity motor4.run(RELEASE); //stop the motor when release the button >

Android App for controlling the car.

In order to control the car using a mobile phone, we need to install an application to enable Bluetooth communication between the Arduino board and the car. This App can be downloaded from here.

bluetooth controlled car android app

The Android application controls are as shown above. The car will move in the direction depending on the arrow pressed.

Android App accelerometer control

This application also supports accelerometer control which means the movement of the car is determined by the direction in which the phone is tilted.

Источник

Arduino Bluetooth RC Car (Android Controlled)

license

Introduction: Arduino Bluetooth RC Car (Android Controlled)

DIY Arcade Box With Raspberry Pi and RetroPie

BT LED Matrix Display - 80x8 Px Arduino Based

9 Arduino Tutorials for Grove Starter KIT From Seeed Studio

Hello, in this project I will show you how to transform an RC toy car to Bluetooth controlled through your Android smartphone!

Before starting, make sure that you have:

  • Arduino uno board
  • L293D motor driver
  • HC-06 Bluetooth module
  • RC Car that can fit all the above !
  • 1M & 100K resistor for battery level
  • 4x leds for lights
  • 1x speaker/buzzer for horn sound

For power, you can use the existing batteries (4x 1.5V AA), or replace them with a LiOn rechargeable battery pack.

(I used 12V LiOn rechargeable battery pack)

Step 1: Remove the Existing Rc Circuit

Before starting, remove the existing rc circuit. You will not need it any more. you will make a better one from the beginning with Arduino uno 😉

Now, with one battery AA 1.5V you must find the polarity of 2 c motors.

  • For movement motor (back side) the positive polarity cable will be that moves the car forward.
  • For direction motor (front side) the positive polarity cable will be that moves the wheels left.

Step 2: Breadboard Schematic

Ι suggest you to build your circuit on (small) breadboard first.

You can use on/off switch of car like this:

If you have a «big» rc car it will need more power so you can use L298 module board. L293D motor driver will give max 0.5A per channel and it will be come very hot after while. L298 module board has a heat sink and can give 1A per channel, but is bigger than L293D.

Step 3: Code

Download and open file with Arduino ide. Read every line of code (+comments) to understand how it’s working and then upload it to your Arduino uno board!

(for programming arduino uno board you must disconnect first the RX & TX pins of Bluetooth module)

Attachments

Step 4: Android Bluetooth Controller

To control your new Bluetooth car, download and install this android application:

First enable Bluetooth and establish connection with BT module.
(ex. HC-06, password 1234)
Use «Help & info» button if you can not understand how it is working.

Accelelometer function is under developing, use with attention!

If you have problem with this app on your android device you can also use this one.

Step 5: Video of My BT ArduiCar

Video is in Greek language but I believe that you can understand it.

Remember that Bluetooth technology will give you max 15-20 meters of control.

13 People Made This Project!

  • Arduino Bluetooth RC Car (Android Controlled)

Arduino Bluetooth RC Car (Android Controlled)

Arduino Bluetooth RC Car (Android Controlled)

Arduino Bluetooth RC Car (Android Controlled)

Arduino Bluetooth RC Car (Android Controlled)

Arduino Bluetooth RC Car (Android Controlled)

Arduino Bluetooth RC Car (Android Controlled)

Arduino Bluetooth RC Car (Android Controlled)

Arduino Bluetooth RC Car (Android Controlled)

Did you make this project? Share it with us!

Recommendations

High Contrast Braille Keypad With Indicator Lights

AI-assisted Pipeline Diagnostics and Inspection W/ MmWave

ESP32-Powered Tabletop Kinetic Sand Drawing Robot

Touch Cam - a Raspberry Pi Camera

Project-Based Learning Contest

Project-Based Learning Contest

Metal Contest

Metal Contest

Make It Bridge

Make It Bridge

192 Comments

HariN27

bro i want to add a ultrea sonic [distance sensoer] to the same code that is the car will stop automatically when objects come naear 2meters,plz pm me harinadh.38@gmail.com

JomarM3

could you kindly send this also to me? i am also planning to add the ultrasonic sensor 🙂 thank you, my email is jmangubat528@gmail.com

HariN27

HariN27

HariN27

IM SOORY I DID NOT SEE YOUR MESSAGE
PING ME AT harinadh.38@gmail.com

HariN27

if isuccess i will send u

bajabhai846

Hey I have an HC-05 can I use it.

jimgarbe

I made it, but changed it, but used lighter weight materials. I created another branch of instructables at https://www.instructables.com/id/Bluetooth-RC-Car-With-STM32F103C-and-L293D-Inexpen/.

Thank you, Vasilakis Michalis!

HarisY

Hello, I have made this project and run well. But when I press forward or other button continuously, the system became hang and not respond to any command from android. After I press reset button on Arduino, it back to normal again. At first I think arduino deficient power because I use 1 battery source. So I try to separate battery for arduino and for motor DC and configure the jumper on L293D motor driver shield. But it still hang when I run the car with continuous pressing. What should I do? anybody have the same problem like me? thanks in advance.

viaggiatoresolitario7


The Bluetooth module must be configured otherwise it will NOT work! https://www.youtube.com/watch?v=ZdvKh3c_yoQ . . That’s why my module doesn’t give life signs.

Parasji100

How much mah battery we have to use ?

LashaG

I was using this app for a while and now it sends only S on any button can you help me?

Parasji100

JokubasG1

I made rc car that is a bit bigger than it’s shown. My problem is that there is too low voltage to turn front wheels. I don’t know what to add or change to put more voltage. I think that arduino puts out too low voltage. 10V battery sould be enough. Could you help me out?

image.jpg

HuseynS1

You can use L298N motor driver and add additional battery to use the motor.

RoboT16

Can i use l298n in this programing

saqibsyd

Hello, can I change my iOS Bluetooth controlled car to Remote Control? I have

Silverlit RC 1:16 Enzo Ferrari

hobby electronics

Can I use HC-05 bluetooth module instead of 06 and is there any AT mode settings in this project

ErvanP

Can i have the android apps code.

JhonG26

Can I use here 10000mah 5V powerbank instead of 12v LiOn battery; and instead of bluetooth module can I use wifi module instead? thanks!

Источник

Читайте также:  Dual band wireless ac 3168 bluetooth
Оцените статью
Adblock
detector