Header Ads

Breaking News

Smartphone Controlled Car using Arduino and Bluetooth Module (HC-05)

SMARTPHONE CONTROLLED CAR: 

Smartphone controlled car is an Arduino based bot, which can be made to work with our smartphones having respective application (i.e. Arduino RC) installed in it. This car receives commands from our smartphones with the help of Bluetooth. Nowadays, we are connecting our smartphones with various electronic devices for the purpose of synchronization. By implementing this idea, we can also able to control the speed, direction, horn, music system, lights, opening and closing operations of the doors. If this prototype is made real, we can do various operations like controlling the car, from the parking zone by standing outside the car.



CIRCUIT AND WORKING:
        The circuit diagram for this bot is shown in the figure 2. The smaller chip is an Atmega8U2  in the Arduino board converts USB input to serial. The ATmega328 on the Uno comes with a bootloader. This allows us to upload the program to it without the use of an external hardware programmer (Refer to figure 1). This chip can be removable. The Uno board can be powered via the USB connection or with an external power supply using batteries or AC/ DC adapters in Vin. From this Vin, we can get the output as regulated 5V and 3.3V and this can be used for powering the Bluetooth module HC-05.
           These 28 pins in the ATmega328 on the Arduino UNO can be as an input or output. The Serial pin(refer figure 1) 0 (RX) and 1 (TX) is Used to receive (RX) and transmit (TX) serial data from Bluetooth module HC-05. The pins 4, 5, 6 and 7 are connected to the H-BRIDGE (refer figure 2). Out of these four pins, Pins 5 and 6 provides 8-bit PWM output with the analogWrite() function. The pins 2 and 3 are also used as external interrupts and this pins can also be used as inputs and outputs(i.e. for extra functions like lights , horn, etc.). When we are using servo motors, the PWM pins such as 3, 5, 6, 9, 10, and 11 are used. The servo motors can be used for making opening and closing actions of doors by setting different angles for left and right doors (prototype).
              The Uno can be programmed with the Arduino Software (IDE) and from that application, program can be uploaded to the Arduino.


Figure 1

CIRCUIT DIAGRAM:


Figure 2


----------------------------------------------------------------------------------------------------------------------
PROGRAM:


char val;   //defining a variable for receiving the input from the user 

void setup()

{   
   pinMode(4,OUTPUT);//connection of motor1 terminal to arduino

   pinMode(5,OUTPUT);//connection of motor1 terminal to arduino

   pinMode(6,OUTPUT);//connection of motor2 terminal to arduino

   pinMode(7,OUTPUT);//connection of motor2 terminal to arduino
   
   Serial.begin(9600);// THIS IS TO SPECIFY THE SPEED OF DATA TRANSFER
}

void loop()

{
  if (Serial.available() )
  {;}

val=Serial.read();

if (val=='0')// This condition for moving Forward

{

   digitalWrite(4,HIGH);

   digitalWrite(5,LOW);

   digitalWrite(6,HIGH);

   digitalWrite(7,LOW);

}

if(val=='1')//This condition for moving left

{

   digitalWrite(4,LOW);

   digitalWrite(5,HIGH);

   digitalWrite(6,HIGH);

   digitalWrite(7,LOW);

}

if(val=='2')//This condition for moving right

{

   digitalWrite(4,HIGH);

   digitalWrite(5,LOW);

   digitalWrite(6,LOW);

   digitalWrite(7,HIGH);

}


if(val=='3')//This condition for moving backward
{
 digitalWrite(4,LOW);

   digitalWrite(5,HIGH);

   digitalWrite(5,LOW);

   digitalWrite(7,HIGH);

}

if(val=='4')//This condition for stopping

{

   digitalWrite(4,LOW);

   digitalWrite(5,LOW);

   digitalWrite(6,LOW);

   digitalWrite(7,LOW);


}

if(val=='5')//condition for opening  the door 90 degree(this loop can be used only for servo motors)

for(angle = 0; angle < 90; angle++) 
  {                                 
    servo.write(angle);              
    delay(15);                  
  }



}

---------------------------------------------------------------------------------------------------------------------------------------
 
CONSTRUCTION AND TESTING:

      A 9V battery supply is given to Arduino UNO by connecting the positive terminal to “Vin” and negative terminal to “GND”. Then 5V from the Arduino is given to the “5v” pin, in the HC-05 Bluetooth module and then connect the GND to “GND” of the Bluetooth. Connect the “RX”(PIN 0) of the Arduino to the “TX” of the Bluetooth device and “RX” of the Bluetooth to the “TX”(PIN 1) of the Arduino(refer figure 2). The supply for the motor is taken from Pin 4, Pin 5, Pin 6 and Pin 7. The Arduino can deliver only a very small voltage as output from these pins. So, an additional power is required for the motor to give enough torque. For this, H-Bridge is used. We can give additional 12V supply, by connecting a 12V battery to the H-Bridge voltage terminals. The output from Pin 4, Pin 5, Pin 6 and Pin 7 is given to INP A1, INP A2, INP B1 and INP B2 terminals in H-Bridge(refer figure 2). The ground from H-Bridge is connected to the ground of the Arduino. Then the two motors are directly connected to H-Bridge motor terminals. 




          The Bluetooth module is switched off or disconnected while burning the program to the Arduino UNO. Then the mechanical arrangement of the BOT(Car) is completed by inserting wheels to motors and placing it in right areas. Army directional wheels should be used in the front part of the car for moving left and right direction. After all the connections and mechanical arrangements are done, open the ArduinoRC application in Android smartphone and connect with the HC-05 Bluetooth device by typing “1234” as pin for pairing with HC-05. Feed the values of the program such as 0, 1, 2, 3, 4 in the app. Then switch on the battery supply in H-Bridge and the Bot is ready to be controlled by our smartphones. Like this we can add many additional features like lights, horn and music system to this BOT.

No comments