Project is Four-Wheel Drive Racing Car Controlled via Bluetooth from a Smartphone.
Introduction
This project is one of the first attempts to build a small racing car that can be controlled via a smartphone using Bluetooth technology. This car features four-wheel drive, making it flexible and easy to maneuver, along with a quick response to commands. Remote control provides the user with an enjoyable and innovative driving experience through a simple mobile application.
Car Features
- Easy to drive from the phone: The car can be controlled through a smartphone application using Bluetooth technology.
- Instant response: The car responds quickly and immediately to commands sent from the phone.
- Four-wheel drive: The car is equipped with four motors that provide four-wheel drive, allowing for better control and stronger performance on various surfaces.
Four-Wheel Drive Benefits
- Ability to change direction: Thanks to the four-wheel drive system, the car can change direction left or right from the same point of stability, enhancing its maneuverability.
Components Used
- Arduino Uno
- Driver L298N
- 4 Motors
- Two 18650 Batteries
- Horizontal Dual Battery Holder
- Connecting Wires
- On/Off Switch
Explanation of Components
1. Arduino Uno
It is an open-source development board based on a microcontroller that allows control of electronic components. It is programmed in the Arduino language and is responsible for receiving commands from the HC-05 Bluetooth module and executing them on the car.
2. Driver L298N
It is a motor control unit used to control the direction and speed of electric motors. It allows for separate control of the four motors, providing the car with greater maneuverability.
3. HC-05
It is a Bluetooth module used to enable wireless communication between the smartphone and the car. It operates in the 2.4GHz frequency range and is known for its ease of programming and use.
Wiring Diagram
[Insert the wiring diagram showing how to connect the components together here.]
Code
//code from chat gpt
// Define the motor driver pins connected to the Arduino
#define IN1 8 // Input 1 for Motor A
#define IN2 7 // Input 2 for Motor A
#define IN3 6 // Input 1 for Motor B
#define IN4 5 // Input 2 for Motor B
// Bluetooth module pin
#define bluetoothSerial Serial
void setup() {
// Set all motor driver pins as output
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
// Start serial communication at 9600 baud rate
bluetoothSerial.begin(9600);}
void loop() {
// Check if there is any data available from the Bluetooth module
if (bluetoothSerial.available()) {
char command = bluetoothSerial.read(); // Read the incoming data
// Control the car based on the command received
switch (command) {
case 'F': // Move Forward
moveForward();
break;
case 'B': // Move Backward
moveBackward();
break;
case 'L': // Turn Left
turnLeft();
break;
case 'R': // Turn Right
turnRight();
break;
case 'S': // Stop the car
stopCar();
break;}}}
// Function to move the car forward
void moveForward() {
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);}
// Function to move the car backward
void moveBackward() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);}
// Function to turn the car left
void turnLeft() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);}
// Function to turn the car right
void turnRight() {
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}
// Function to stop the car
void stopCar() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
}
Application Used for Control
The Bluetooth RC Controller application was used to control the car, allowing commands to be sent from the phone to the car via Bluetooth.
Problems Encountered
- Problem of motor stopping when placed on the table: When the car was lifted, the motors were running slowly. After investigation, it was found that the cause was a drop in the voltage and current available to the motors.
– Solution: Replace the batteries with higher efficiency ones.
2. The car moved strangely: Upon powering the car, we noticed that its movement was abnormal.
– Solution: Correct the connections of the motors to the Driver L298N.
