Tuesday, June 25, 2019

Arduino bluetouth car control

In this project I will show you how to create Smartphone (Bluetooth) Controlled Car Using Arduino. This Car can be controller using an Android Application.



Block Diagram

Let me explain the Design and Working of this project using the following Block Diagrams.


The Project is having Mainly 5 Blocks. Refer Figure 1
1. Bluetooth Module
2. Arduino UNO
3. DC Motor Driver
4. DC Motor 1
5. DC Motor 2

Bluetooth Module: This block is mainly responsible for establishing the connection between Andriod mobile phone and the Circuit

Arduino UNO: Arduino is the brain of this project. This will control and co-ordinate all the other components connected with this project.

DC Motor Driver:  We use this module as Arduino will not be able to provide the required Voltage and Current to Rotate the DC motor by alone. Digital Pins of Arduino will be connected to the input section of DC Motor Driver. This section will rotate the DC motors according the Volages received on the Arduino digital pins.

DC Motor 1 & DC Motor 2: These two DC motors will decide the direction of the Car. This car can move to the following directions.
1.Forward Direction
2.Reverse Direction
3.Forward Right
4.Forward Left

Now Lets talk little about the Android Application that we are going to use for this project you can using MTinventor app to creat application for this robot next time i will explain how to using MT inventor app its easy to use
Now let me try to explain the working of this project using Figure 3. The Circuit will get ready to receive commands once the Android Application is successfully paired with the Bluetooth Module HC-05.
When a button is pressed(Suppose Forward Button) a value will be sent(Value "F") and it will be received by the Bluetooth Module. This Value again will be sent to Arduino UNO by the Bluetooth Module.
Once Arduino receives the Value it will check what action need to be taken according to the value received. In this case Arduino will set digital pins 10 to 13 in such a way that the DC Motor will rotate in  forward direction. The digital pins 10-13 of Arduino UNO is connected to the  input pins of DC Motor Driver M1.a,M1.b,M2.a and M2.b respectively. Output pins of DC Motor driver will be connected to the DC Motors. This way Arduino will start to control the DC Motors using their Digital pins 10-13
The Table shown below explains the Value and action that are used for this project.
ValueAction
FForward
BBackward
SStop
RRight
LLeft

Components Required

Figure 4 explains the components required for this project. You can buy all these components from websites like Amazon/E-Bay etc


Visit our Amazon.in(India) Store to view and purchase recommended products 


 Circuit Diagram

Complete the connection as shown in figure 5.
Now you are ready to upload the program to you Arduino.
Note:- Make sure to remove the wire that is connected to the receive pin(Rx.0) of Arduino before uploading the Program and connect it back once program is uploaded succesfully.

program :
/control robot car by using bleuthooth this project created by charaf zouhair for my daughter fatim zahra
                int state; 
int motorleftA=30;
int motorleftB=31;
int motorrightA=32;
int motorrightB=33;
int motorenable1=34;
int motorenable2=35;

void setup(){
  pinMode(motorleftA,OUTPUT);
  pinMode(motorleftB,OUTPUT);                          
  pinMode(motorrightA,OUTPUT);
  pinMode(motorrightB,OUTPUT);
  pinMode(motorenable1,OUTPUT);
  pinMode(motorenable2,OUTPUT);
  digitalWrite(motorenable1,HIGH);
  digitalWrite(motorenable2,HIGH);

  Serial.begin(9600);                                                                                                                                                                                                                                                                                                          
  }
void loop(){
  if (Serial.available()>0){
    state=Serial.read();
 }
 if (state=='F'){
  digitalWrite(motorleftA,HIGH);
  digitalWrite(motorleftB,LOW);
  digitalWrite(motorrightA,HIGH),
  digitalWrite(motorrightB,LOW);
  Serial.println("go forward");}
  else if(state=='B'){
    digitalWrite(motorleftA,LOW);
    digitalWrite(motorleftB,HIGH);
    digitalWrite(motorrightA,LOW);
    digitalWrite(motorrightB,HIGH);
    Serial.println("go back"); }
    else if (state=='R'){
      digitalWrite(motorleftA,HIGH);
      digitalWrite(motorleftB,LOW);
      digitalWrite(motorrightA,LOW);
      digitalWrite(motorrightB,LOW);
      Serial.println("turn right");
      }
      else if(state=='L'){
        digitalWrite(motorleftA,LOW);
        digitalWrite(motorleftB,LOW);
        digitalWrite(motorrightA,HIGH);
        digitalWrite(motorrightB,LOW);
       Serial.println("turn left");
      }
      else if(state=='S'){
        digitalWrite(motorleftA,LOW);
        digitalWrite(motorleftB,LOW);
        digitalWrite(motorrightA,LOW);
        digitalWrite(motorrightB,LOW);
        Serial.println("STOP");
        
        
      }
      
}