Smartphone Controlled RC Car Using Arduino
Smartphone Controlled RC Car Using Arduino
AGRA
2. Arduino Uno
9. Smartphone
You can buy Ready made 4WD Car chassis or you can make it by using PVC / Any kind of Hard Board.
Motor / Actuator
In this project i use 6v DC motor . You can used any kind of 6v DC motor .
Strip out the insulation from the wires at each end Solder the wires to the motor terminal
You can check the motor polarity by connecting it to the battery pack.If it rotates in forward direction ( red
wire with positive and black wire with negative terminal of the battery) then the connection is correct .
The Arduino UNO is an open-source microcontroller board based on the Microchip ATmega328P
microcontroller and developed by Arduino.cc.
The board is equipped with sets of digital and analog input/output (I/O) pins that may be interfaced to
various expansion boards (shields) and other circuits. The board has 14 Digital pins, 6 Analog pins,
and programmable with the Arduino IDE (Integrated Development Environment) via a type B USB
cable. It can be powered by a USB cable or by an external 9 volt battery, though it accepts voltages
between 7 and 20 volts. It is also similar to the Arduino Nano and Leonardo. The hardware reference
design is distributed under a Creative
Commons Attribution Share-Alike 2.5 license and is available on the Arduino website. Layout and
production files for some versions of the hardware are also available. "Uno" means one in Italian and
was chosen to mark the release of Arduino Software (IDE) 1.0. The Uno board and version 1.0 of
Arduino Software (IDE) were the reference versions of Arduino, now evolved to newer releases. The
Uno board is the first in a series of USB Arduino boards, and the reference model for the Arduino
platform. The ATmega328 on the Arduino Uno comes preprogrammed with a bootloader that allows
uploading new code to it without the use of an external hardware programmer. It communicates using
the original STK500 protocol. The Uno also differs from all preceding boards in that it does not use the
FTDI USB-to-serial driver chip. Instead, it uses the Atmega16U2 (Atmega8U2 up to version R2)
programmed as a USB-to-serial converter.
The microcontrollers are typically programmed using a dialect of features from the programming
languages C and C++. In addition to using traditional compiler toolchains, the Arduino project provides
an integrated development environment (IDE) based on the Processing language project.
What is H- Bridge ?
The term H bridge is derived from the typical graphical representation of such a circuit .It is a circuit
which can drive a DC motor in forward and reverse direction. Working : See the above picture for
understanding the working of the H bridge.
It is consists of 4 electronics switches S1,S2,S3 and S4 ( Transistors / MOSFETs/ IGBTS ). When the
switches S1 and S4 are closed (and S2 and S3 are open) a positive voltage will be applied across the
motor.So it rotates in the forward direction.Similarly when S2 and S3 are closed and S1 and S4 are
opened a reverse voltage is applied across the motor, so rotates in revers direction.
Note : The switches in the same arm ( either S1,S2 or S3,S4) are never closed at a same time, it will
make a dead short circuit. H bridges are available as integrated circuits, or you can built your own by
using 4transistors or MOSFETs. In our case we are using LM298 H-bridge IC that can allows to control
the speed and direction of the motors.
GND: Ground
5v Pin: 5V output if 12V jumper in place, ideal for powering your Arduino (etc)
EnA: Enables PWM signal for Motor A (Please see the "Arduino Sketch Considerations" section)
So finally you have two terminals in each side. MOTORA is in charge of two right side motors,
correspondingly two left side motors are connected to MOTORB Follow the instruction below to
connect everything.
Motors Connection:
IN1 -> D5
IN2-> D6
IN2 ->D9
IN2-> D10
Rx-> Tx
Tx ->Rx
Power :
GND -> Connect Battery Black wire and Arduino GND pin
The software part is very simple,it does not need any library.If you understand the logic table in the
earlier steps then you can write you own code. I didn't spend much time on writing the code, so just
using a code written by someone else.To control the Robot Car, I am using my smartphone.The
smartphone is connected to the controller via a Bluetooth module ( HC -06 /05) Download the App
After installing the app, you have to pair it with the Bluetooth module.The password for pairing is
" 1234 ".
void loop() {
if (Serial.available() > 0) {
command = Serial.read();
Stop(); //Initialize with motors stoped.
switch (command) {
case 'F':
forward();
break;
case 'B':
back();
break;
case 'L':
left();
break;
case 'R':
right();
break;
case 'G':
forwardleft();
break;
case 'I':
forwardright();
Smartphone Controlled RC Car Using Arduino: Page
13
break;
case 'H':
backleft();
break;
case 'J':
backright();
break;
case '0':
Speed = 100;
break;
case '1':
Speed = 140;
break;
case '2':
Speed = 153;
break;
case '3':
Speed = 165;
break;
case '4':
Speed = 178;
break;
case '5':
Speed = 191;
break;
case '6':
Speed = 204;
break;
case '7':
Speed = 216;
break;
case '8':
Speed = 229;
break;
case '9':
Speed = 242;
break;
case 'q':
Speed = 255;
break;
}
Speedsec = Turnradius;
if (brkonoff == 1) {
brakeOn();
} else {
brakeOff();
}
}
}
void forward() {
analogWrite(in1, Speed);
analogWrite(in3, Speed);
Smartphone Controlled RC Car Using Arduino: Page
14
}
void back() {
analogWrite(in2, Speed);
analogWrite(in4, Speed);
}
void left() {
analogWrite(in3, Speed);
analogWrite(in2, Speed);
}
void right() {
analogWrite(in4, Speed);
analogWrite(in1, Speed);
}
void forwardleft() {
analogWrite(in1, Speedsec);
analogWrite(in3, Speed);
}