RC Arduino Car
Where has it been developed?
In IES Ramón Giraldo at Robotic Subject during the months of january, february and march 2019.
The objective
It consists of remote car´s desing and construction by Bluetooh. It is required to use an Arduino Board.
Plan
The car is made up of one plastic sheet with two motors and an idler. Spins are made reversing the motor rotation.
Materials and budget
• Plastic sheet
(5mm)
• Arduino UNO board
• Protoboard
• 2 DC Motors of continous spin
• 2 rubber wheels
• An idler
• Wires (40 male-female Pack
• Bluetooth HC-06 unit
• Binding parts (silicone)
• L298 unit
• 4 AA batteries
• An external battery (2000 mAh)
• Mobile phone
• Software: Arduino IDE program and Bluetooth RC controller app for Android or iOS
To get the control of the car by Bluetooth we have to use a HC-06 unit.
// Control coche movil-arduino
// IES Ramón Giraldo 2018-2019
char val;
int motor1a = 7; // motor 1 adelante
int motor1b = 8; // motor 1 atrás
int motor2a = 9; // motor 2 adelante
int motor2b = 10; // motor 2 atrás
void setup() {
Serial.begin(9600); // velocidad conexión
pinMode(motor1a, OUTPUT);
pinMode(motor1b, OUTPUT);
pinMode(motor2a, OUTPUT);
pinMode(motor2b, OUTPUT);
}
void loop() {
if( Serial.available() )
val = Serial.read();
if( val == 'F' )
{
digitalWrite(motor1a, HIGH);
digitalWrite(motor2a, HIGH); //motores hacia adelante activos
digitalWrite(motor1b, LOW);
digitalWrite(motor2b, LOW); //motores hacia atrás parados
}
if( val == 'S' )
{
digitalWrite(motor1a, LOW);
digitalWrite(motor2a, LOW);
digitalWrite(motor1b, LOW);
digitalWrite(motor2b, LOW); //todos los motores parados
}
if( val == 'B' )
{
digitalWrite(motor1a, LOW);
digitalWrite(motor2a, LOW); //motores hacia adelante parados
digitalWrite(motor1b, HIGH);
digitalWrite(motor2b, HIGH); //motores hacia atrás activos
}
if( val == 'R' )
{
digitalWrite(motor1a, HIGH); //motor 1 hacia adelante
digitalWrite(motor2a, LOW);
digitalWrite(motor1b, LOW);
digitalWrite(motor2b, HIGH); //motor 2 hacia atrás (giro derecha)
}
if( val == 'L' )
{
digitalWrite(motor1a, LOW);
digitalWrite(motor2a, HIGH); //motor 1 hacia atrás
digitalWrite(motor1b, HIGH); //motor 2 hacia adelante (giro izquierda)
digitalWrite(motor2b, LOW);
}
}
Bluetooth RC Controller App
• Arduino UNO board
• Protoboard
• 2 DC Motors of continous spin
• 2 rubber wheels
• An idler
• Wires (40 male-female Pack
• Bluetooth HC-06 unit
• Binding parts (silicone)
• L298 unit
• 4 AA batteries
• An external battery (2000 mAh)
• Mobile phone
• Software: Arduino IDE program and Bluetooth RC controller app for Android or iOS
To get the control of the car by Bluetooth we have to use a HC-06 unit.
Car diagram
Programming code:
// Adrián Ramiro// Control coche movil-arduino
// IES Ramón Giraldo 2018-2019
char val;
int motor1a = 7; // motor 1 adelante
int motor1b = 8; // motor 1 atrás
int motor2a = 9; // motor 2 adelante
int motor2b = 10; // motor 2 atrás
void setup() {
Serial.begin(9600); // velocidad conexión
pinMode(motor1a, OUTPUT);
pinMode(motor1b, OUTPUT);
pinMode(motor2a, OUTPUT);
pinMode(motor2b, OUTPUT);
}
void loop() {
if( Serial.available() )
val = Serial.read();
if( val == 'F' )
{
digitalWrite(motor1a, HIGH);
digitalWrite(motor2a, HIGH); //motores hacia adelante activos
digitalWrite(motor1b, LOW);
digitalWrite(motor2b, LOW); //motores hacia atrás parados
}
if( val == 'S' )
{
digitalWrite(motor1a, LOW);
digitalWrite(motor2a, LOW);
digitalWrite(motor1b, LOW);
digitalWrite(motor2b, LOW); //todos los motores parados
}
if( val == 'B' )
{
digitalWrite(motor1a, LOW);
digitalWrite(motor2a, LOW); //motores hacia adelante parados
digitalWrite(motor1b, HIGH);
digitalWrite(motor2b, HIGH); //motores hacia atrás activos
}
if( val == 'R' )
{
digitalWrite(motor1a, HIGH); //motor 1 hacia adelante
digitalWrite(motor2a, LOW);
digitalWrite(motor1b, LOW);
digitalWrite(motor2b, HIGH); //motor 2 hacia atrás (giro derecha)
}
if( val == 'L' )
{
digitalWrite(motor1a, LOW);
digitalWrite(motor2a, HIGH); //motor 1 hacia atrás
digitalWrite(motor1b, HIGH); //motor 2 hacia adelante (giro izquierda)
digitalWrite(motor2b, LOW);
}
}
Bluetooth RC Controller App
We
have used this
app to control the remote
cars and it is
very easy to
use.
Car evolution
No hay comentarios:
Publicar un comentario