Remote Control Car - Arduino
Remote Control Car - Arduino
[email protected], [email protected]
[email protected], [email protected]
Summary. This article presents the description of the construction of a remote-controlled car.
wireless remote using Bluetooth Module (HM-10), Arduino Nano and circuit
logical. I have also described in this article the programming used in the
I have methods to exemplify the logic of how the project works.
In summary, this article will provide the theoretical basis of the project in a methodical way.
for the purpose of evaluating the excellent professor Danielo Gomes for the
conclusion of the course Introduction to Computer Engineering.
˜
1. Introduction
Since the emergence of the internet and wireless communication means, it is urgent to
the need for people to have total control over everything around them. With this need
the means of automation and control emerged, where the entire current industry operates, such as
also has a tendency for the market of autonomous houses and the internet of things.
Due to this, we had the idea of creating a remote-controlled car that works
with the same purpose of controlling things remotely, to simplify a more complex system
complex and to demonstrate clearly to the audience some applications of the field of
Remote Control.
2. Project Development
Bluetooth technology is used for long-distance communication between
devices of various shapes, through a standard communication protocol.
We use the HM-10 module, which is capable of transmitting the Bluetooth protocol to the
car control through communication between the Arduino Nano, coupled to the car, and the
cell phone
Figure 1. Bluetooth module (HM-10)
With that, some basic functions for the communication of the module were defined.
with the Arduino and the cell phone. We had to assemble the part of the electronic circuit based on the
datasheet of the HM-10 module, which provides a standard for assembly, where it was necessary to make
some connections with wires between the board and the module. The entire process was accompanied by
welded to ensure that the circuit would not detach from the car when it was
in motion.
For the processing of the data sent by the Bluetooth module, we use a
Arduino Nano that is lighter, which increases the speed of the car, and has more ports.
digital and analog. To facilitate the connection and reconfiguration of the wires with the Arduino,
we connect the microcontroller on a breadboard.
Similarly, the task was divided among each person in the group, which made
possible to finish the work more quickly. We left half of the people with the
Hardware and the other half with Software that were created simultaneously in a way
that it would be possible to test the potential failures of each step of the project. The first project
I went to do the communication of the Bluetooth Module with the Arduino, which basically was the
most important part of the project, as through this communication it was possible to make with
so that the cell phone could control the motors, buzzer, and the direction of the car. Then after this
stage, we installed the module to the car, which had this arrangement in the project:
#define IN1 8
#define IN2 7
#define IN3 6
#define IN4 5
#define ENA 9
#define ENB 10
#define buzzerPin 11
#define ledPin 4
#define CUSTOM_SETTINGS
#define INCLUDE_GAMEPAD_MODULE
#include <Dabble.h>
void setup() {
Serial.begin(9600);
Dabble.begin(9600);
pinMode(buzzerPin, OUTPUT);
pinMode(ledPin, OUTPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2,OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4,OUTPUT);
pinMode(ENA, OUTPUT);
pinMode(ENB, OUTPUT);
}
functions to acquire the status of each button
void loop() {
Dabble.processInput();
bool buzzerState = GamePad.isSquarePressed();
bool ledState = GamePad.isCirclePressed();
bool isBrake = GamePad.isTrianglePressed();
bool upperButton = GamePad.isUpPressed();
bool lowerButton = GamePad.isDownPressed();
bool rightButton = GamePad.isRightPressed();
bool leftButton = GamePad.isLeftPressed();
float c = GamePad.getx_axis();
float d = GamePad.gety_axis();
float vTan = map(d, -7, 7, -255, 255);
float steering = map(c, -7, 7, -255, 255);
float v1 = vTan + steering;
float v2 = vTan - steering;
car horn
if(buzzerState){
analogWrite(buzzerPin,25);
Serial.print(buzzerState);
}
if(!buzzerState){
analogWrite(buzzerPin,0);
Serial.print(buzzerState);
}
//far´ois
if(ledState){
digitalWrite(ledPin, HIGH);
}
if(!ledState){
digitalWrite(ledPin,LOW);
}
if(!isBrake)
{
if(upperButton)
{
setMotor(255,255);
}
if(lowerButton)
{
setMotor(-255,-255);
}
if(rightButton)
{
setMotor(255,-255);
}
if(leftButton)
{
setMotor(-255, 255);
}
if(!upperButton&&!lowerButton&&!rightButton&&!leftButton)
{
setMotor(v1,v2);
}
}
conditioning for the direction and acceleration of the car
if(isBrake)
{
digitalWrite(IN1, HIGH);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, HIGH);
analogWrite(ENA,255);
analogWrite(ENB,255);
}
}
//function for car movement (up, down, left, right)
void setMotor(int vA, int vB)
{
int v1 = constrain(vA, -255, 255);
int v2 = constrain(vB, -255, 255);
if(v1>=0&&v2>=0)
{
digitalWrite(IN1,HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3,HIGH);
digitalWrite(IN4, LOW);
analogWrite(ENA, abs(v1));
analogWrite(ENB, abs(v2));
}
if(v1>=0&&v2<0)
{
digitalWrite(IN1,HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4,HIGH);
analogWrite(ENA, abs(v1));
analogWrite(ENB,abs(v2));
}
if(v1<0&&v2>=0)
{
digitalWrite(IN1,LOW);
digitalWrite(IN2,HIGH);
digitalWrite(IN3,HIGH);
digitalWrite(IN4, LOW);
analogWrite(ENA,abs(v1));
analogWrite(ENB, abs(v2));
}
if(v1<0&&v2<0)
{
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3,LOW);
digitalWrite(IN4,HIGH);
analogWrite(ENA,abs(v1));
analogWrite(ENB, abs(v2));
}
}
The code is easy to understand as it basically focuses on motor activations.
actions resulting from button presses, with a series of if statements to organize the
interruptions that the control made in the engines.
˜
3. Final Considerations
The project was of utmost importance to the team, as we had to learn several
technologies to make the car work, whether with the communication of the module with the con-
I also learned to properly use the Arduino. We also understand the im-
importance of the integration of hardware with software, since we made direct commands
to the car with software and we had to test if the commands were working. Or-
Another important point is the prototyping and arrangement of components on the protoboard, having in
it is clear that a good organization of the manufacturing and electronics made the project easier
to assemble. Regarding the importance of the car, we can see it as a base for
learn wireless communication and networking protocols, which are the basis for the internet of things
Automation and control systems, which are fundamental for an engineering professional.
computation that will enter the automation market. In theory, it was a quite
productive that made us think as a team and acquire knowledge that the disciplines of
semesters do not provide us, making everything even more challenging and interesting.
ˆ
4. References
Arduino Open Source. General overview of the Arduino Nano. Available in:
Access 06
Jun. 2019
Future Electronic Corporation. H bridge L298 module datasheet. Available at:
[https://www.fecegypt.com/uploads/dataSheet/1522493822.h.pdf]. Access on: 06.
jun.2019
Guangzhou HC Information Technology Co. Product Datasheet of HC-06. Available
em:[https://www.olimex.com/Products/Components/RF/BLUETOOTH-SERIAL-HC-
06/resources/hc06.pdf]. Accessed on: June 06, 2019
Tinkercad. Create 3D digital designs with online CAD. Available at:
[https://www.tinkercad.com/]. Accessed on May 23, 2019.