Harmony Science Faire Project
Harmony Science Faire Project
EXPLANATION CHART ABOUT MY PROJECT OF MAKING BLUETOOTH CONTROL CAR FOR SCIENCE FAIR
PROJECT.
Below is a step-by-step guide to help you create your own Bluetooth-controlled car using
Arduino.
🛠️Materials Needed
Arduino Uno – the microcontroller that will control the car.
HC-05 Bluetooth Module – enables wireless communication between your smartphone
and the Arduino.
L298N Motor Driver Module – controls the direction and speed of the motors.
2 DC Motors – drive the wheels of the car.
Wheels – attached to the motors.
Chassis – the frame to mount all components.
9V Battery and Battery Clip – powers the Arduino.
Jumper Wires – for making connections.
Smartphone with Bluetooth – used to control the car.
🔌 Circuit Connections
1. Motor Driver to Motors:
o Connect the two motors to the output terminals of the L298N motor driver.
2. Motor Driver to Arduino:
o Connect the input pins of the L298N to the digital pins of the Arduino (e.g., IN1
to pin 9, IN2 to pin 10, IN3 to pin 11, IN4 to pin 12).
3. Bluetooth Module to Arduino:
o Connect the HC-05 module to the Arduino: VCC to 5V, GND to GND, TX to
RX, and RX to TX.
4. Power Supply:
o Connect the 9V battery to the motor driver's power input and the Arduino's VIN
pin.
Ensure all connections are secure to prevent any interruptions during operation.
💻 Arduino Code
Upload the following code to your Arduino using the Arduino IDE:
cpp
CopyEdit
#define IN1 9
#define IN2 10
#define IN3 11
#define IN4 12
void setup() {
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
Serial.begin(9600);
}
void loop() {
if (Serial.available()) {
char command = Serial.read();
if (command == 'F') {
forward();
} else if (command == 'B') {
backward();
} else if (command == 'L') {
left();
} else if (command == 'R') {
right();
} else if (command == 'S') {
stopCar();
}
}
}
void forward() {
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}
void backward() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}
void left() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}
void right() {
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}
void stopCar() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
}
This code allows the car to move forward, backward, left, right, and stop based on commands
received via Bluetooth.
📱 Smartphone App
To control the car, download a Bluetooth terminal app on your smartphone, such as "Bluetooth
Terminal" or "Arduino Bluetooth Controller." Pair your phone with the HC-05 module (default
password is usually 1234 or 0000). Once paired, use the app to send commands:
F – Move Forward
B – Move Backward
L – Turn Left
R – Turn Right
S – Stop.
🧩 Assembly Tips
Secure all components onto the chassis using screws or hot glue.
Ensure the motors are properly aligned with the wheels.
Double-check all wiring before powering up to prevent short circuits.
Test the car in an open space to ensure it moves as expected.
PROBLEM STATEMENT
In Kiruhura District, cattle keeping is a cornerstone of the local economy, with approximately
380,000 head of cattle. However, farmers face several challenges that impact their livestock's
health and productivity. One significant issue is tick resistance.
Farmers in Kiruhura have reported that ticks are becoming increasingly resistant to conventional
acaricides. This resistance is compounded by the proliferation of counterfeit drugs in the market,
rendering standard treatments ineffective. Additionally, overgrazing and inadequate veterinary
services exacerbate the situation. Many farmers resort to self-medication, using unregulated
concoctions, which often leads to further complications and livestock losses.
1. Remote Tick Surveillance: The car can navigate grazing areas to identify and document
tick hotspots, providing data on infestation levels.
2. Data Transmission: Collected data can be sent to local veterinary officers or agricultural
extension workers for analysis and timely intervention.
3. Farmer Education: The project can serve as an educational tool, demonstrating the
importance of proper tick management and the dangers of counterfeit drugs.
4. Community Engagement: Involving local youth in operating and maintaining the car
can raise awareness about tick resistance and encourage community participation in
sustainable livestock management practices.
By addressing tick resistance through innovative technology, this initiative could enhance
livestock health, improve productivity, and contribute to the overall development of Kiruhura
District.
Here are the steps taken when programming a Bluetooth-controlled car (using a
microcontroller like Arduino, ESP32, or Raspberry Pi):
1. Gather Components
Connect:
o Bluetooth module TX → RX, RX → TX of microcontroller
o Motor driver IN1–IN4 to digital pins of microcontroller
o Motors to motor driver outputs
o Power supply to motor driver and microcontroller
Receive commands via Bluetooth (e.g., 'F' for forward, 'B' for backward)
Control motors based on the command
cpp
CopyEdit
char command;
void setup() {
Serial.begin(9600);
pinMode(8, OUTPUT); // Motor pin
pinMode(9, OUTPUT); // Motor pin
}
void loop() {
if (Serial.available()) {
command = Serial.read();
if (command == 'F') {
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
}
else if (command == 'B') {
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
}
}
}
📱 4. Install a Bluetooth Controller App
Use apps like Bluetooth Terminal, Arduino Bluetooth Controller, or custom app
Connect your phone to the Bluetooth module
Let me know which microcontroller you're using (Arduino, ESP32, Raspberry Pi), and I can give
you a specific example code and wiring diagram.
You said:
arduino uno
ChatGPT said:
Arduino Uno
HC-05 Bluetooth module
L298N motor driver module
2x DC motors with wheels
Car chassis
9V or 12V battery pack
Jumper wires
Smartphone (with Bluetooth controller app)
🔌 2. Circuit Connections
💻 3. Arduino Code
cpp
CopyEdit
char command;
void setup() {
Serial.begin(9600); // Bluetooth default baud rate
pinMode(8, OUTPUT); // IN1
pinMode(9, OUTPUT); // IN2
pinMode(10, OUTPUT); // IN3
pinMode(11, OUTPUT); // IN4
}
void loop() {
if (Serial.available()) {
command = Serial.read();
switch (command) {
case 'F': // Forward
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
break;
Here are the steps taken when programming a Bluetooth-controlled car (using a
microcontroller like Arduino, ESP32, or Raspberry Pi):
1. Gather Components
Connect:
o Bluetooth module TX → RX, RX → TX of microcontroller
o Motor driver IN1–IN4 to digital pins of microcontroller
o Motors to motor driver outputs
o Power supply to motor driver and microcontroller
Receive commands via Bluetooth (e.g., 'F' for forward, 'B' for backward)
Control motors based on the command
cpp
CopyEdit
char command;
void setup() {
Serial.begin(9600);
pinMode(8, OUTPUT); // Motor pin
pinMode(9, OUTPUT); // Motor pin
}
void loop() {
if (Serial.available()) {
command = Serial.read();
if (command == 'F') {
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
}
else if (command == 'B') {
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
}
}
}
Use apps like Bluetooth Terminal, Arduino Bluetooth Controller, or custom app
Connect your phone to the Bluetooth module
🔄 5. Upload and Test
Let me know which microcontroller you're using (Arduino, ESP32, Raspberry Pi), and I can give
you a specific example code and wiring diagram.
You said:
arduino uno
ChatGPT said:
Arduino Uno
HC-05 Bluetooth module
L298N motor driver module
2x DC motors with wheels
Car chassis
9V or 12V battery pack
Jumper wires
Smartphone (with Bluetooth controller app)
🔌 2. Circuit Connections
💻 3. Arduino Code
cpp
CopyEdit
char command;
void setup() {
Serial.begin(9600); // Bluetooth default baud rate
pinMode(8, OUTPUT); // IN1
pinMode(9, OUTPUT); // IN2
pinMode(10, OUTPUT); // IN3
pinMode(11, OUTPUT); // IN4
}
void loop() {
if (Serial.available()) {
command = Serial.read();
switch (command) {
case 'F': // Forward
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
break;
case 'B': // Backward
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
digitalWrite(10, LOW);
digitalWrite(11, HIGH);
break;
⚠️Tips
You said:
yes
ChatGPT said:
Image created
Share
You said:
l want diagram of connection of arduino uno and l293d motor driver and both front and back
lights and hc 05 bluetooth module plus motor
ChatGPT said:
Image created
Share
You said:
Arduino Bluetooth control car with Front & Back Lights using Arduino UNO, L293D Motor
Driver, HC-05 .help me on how to programme this one
ChatGPT said:
Arduino UNO
L293D Motor Driver
HC-05 Bluetooth Module
Front & Back Lights (LEDs)
✅ Functions
Move: Forward, Backward, Left, Right, Stop
Turn ON front light when moving forward
Turn ON back light when reversing
📲 Bluetooth Commands
Send single-letter commands from your Bluetooth app:
Command Action
F Forward
B Backward
L Turn Left
R Turn Right
S Stop
Arduino Code
cpp
CopyEdit
// Motor pins
const int motor1Pin1 = 2; // IN1
const int motor1Pin2 = 3; // IN2
const int motor2Pin1 = 4; // IN3
const int motor2Pin2 = 5; // IN4
// Light pins
const int frontLight = 6;
const int backLight = 7;
void setup() {
// Set motor pins as output
pinMode(motor1Pin1, OUTPUT);
pinMode(motor1Pin2, OUTPUT);
pinMode(motor2Pin1, OUTPUT);
pinMode(motor2Pin2, OUTPUT);
void loop() {
if (Serial.available()) {
command = Serial.read();
// Movement Functions
void moveForward() {
digitalWrite(motor1Pin1, HIGH);
digitalWrite(motor1Pin2, LOW);
digitalWrite(motor2Pin1, HIGH);
digitalWrite(motor2Pin2, LOW);
digitalWrite(frontLight, HIGH);
digitalWrite(backLight, LOW);
}
void moveBackward() {
digitalWrite(motor1Pin1, LOW);
digitalWrite(motor1Pin2, HIGH);
digitalWrite(motor2Pin1, LOW);
digitalWrite(motor2Pin2, HIGH);
digitalWrite(frontLight, LOW);
digitalWrite(backLight, HIGH);
}
void turnLeft() {
digitalWrite(motor1Pin1, LOW);
digitalWrite(motor1Pin2, HIGH);
digitalWrite(motor2Pin1, HIGH);
digitalWrite(motor2Pin2, LOW);
digitalWrite(frontLight, LOW);
digitalWrite(backLight, LOW);
}
void turnRight() {
digitalWrite(motor1Pin1, HIGH);
digitalWrite(motor1Pin2, LOW);
digitalWrite(motor2Pin1, LOW);
digitalWrite(motor2Pin2, HIGH);
digitalWrite(frontLight, LOW);
digitalWrite(backLight, LOW);
}
void stopCar() {
digitalWrite(motor1Pin1, LOW);
digitalWrite(motor1Pin2, LOW);
digitalWrite(motor2Pin1, LOW);
digitalWrite(motor2Pin2, LOW);
digitalWrite(frontLight, LOW);
digitalWrite(backLight, LOW);
}
⚠️Notes:
Bluetooth RX/TX should be connected to Arduino TX (1) and RX (0).
Disconnect HC-05 before uploading code.
Use a voltage divider (1kΩ + 2kΩ) between Arduino TX and HC-05 RX.
Would you like me to show how the code matches your circuit diagram or help you test the
Bluetooth app setup too?
You said:
yes
ChatGPT said:
Great! Let's break it down so you clearly understand how the code matches your circuit
diagram and how to test it using your Bluetooth app.
🔴 Important: Disconnect HC-05 before uploading code, then reconnect for testing.
“Bluetooth Terminal” or
“Arduino Bluetooth Controller” (available on Play Store)
🔧 Steps:
🧪 3. Testing Tips
Make sure you’re powering the L293D motor driver from a 9V or 12V battery for enough
torque.
Add a common GND between the battery, Arduino, and motor driver.
Try sending commands one at a time and observe LED + motor behavior.
Great! Here's a step-by-step testing guide to help you confirm everything is working for your
Bluetooth-controlled Arduino car with front and back lights.
Make sure:
Double-check wiring
Make sure serial monitor is closed
Ensure HC-05 RX uses voltage divider
Let’s make motors spin faster/slower using PWM on ENA and ENB pins of the L293D:
🧰 Wiring:
cpp
Copy code
const int ena = 9;
const int enb = 10;
int speedMotor = 200; // Range: 0 - 255
In setup():
cpp
Copy code
pinMode(ena, OUTPUT);
pinMode(enb, OUTPUT);
analogWrite(ena, speedMotor);
analogWrite(enb, speedMotor);
✅ Now motors will run at 200/255 speed. You can change it dynamically if needed.