0% found this document useful (0 votes)
9 views27 pages

Harmony Science Faire Project

The document provides a comprehensive guide for creating a Bluetooth-controlled car using Arduino for a science fair project. It includes a list of materials, circuit connections, Arduino code for controlling the car, and instructions for using a smartphone app to send commands. Additionally, it addresses the issue of tick resistance in cattle farming in Kiruhura District and suggests using the car for remote tick monitoring and data collection to improve livestock health.

Uploaded by

allanssebidde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views27 pages

Harmony Science Faire Project

The document provides a comprehensive guide for creating a Bluetooth-controlled car using Arduino for a science fair project. It includes a list of materials, circuit connections, Arduino code for controlling the car, and instructions for using a smartphone app to send commands. Additionally, it addresses the issue of tick resistance in cattle farming in Kiruhura District and suggests using the car for remote tick monitoring and data collection to improve livestock health.

Uploaded by

allanssebidde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 27

COMPOSITION ABOUT MY 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.

🦠 Tick Resistance in Kiruhura

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.

🚗 Potential Solution: Bluetooth-Controlled Car for Tick Monitoring


A Bluetooth-controlled car equipped with a camera and sensors could serve as a mobile
monitoring unit to assess tick infestations in real-time. Here's how it could help:

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

 Microcontroller (e.g., Arduino Uno, ESP32, etc.)


 Bluetooth module (e.g., HC-05 or inbuilt Bluetooth in ESP32)
 Motor driver (e.g., L298N)
 DC motors and wheels
 Chassis
 Battery pack
 Jumper wires
 Smartphone (to control the car via Bluetooth app)

🧠 2. Design the Circuit

 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

💻 3. Write the Program (Code)

Upload code to the microcontroller to:

 Receive commands via Bluetooth (e.g., 'F' for forward, 'B' for backward)
 Control motors based on the command

Example Arduino Code Snippet:

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

🔄 5. Upload and Test

 Upload the code to your microcontroller


 Power up the car
 Open the Bluetooth app and send commands like 'F', 'B', 'L', 'R'

✅ 6. Debug and Improve

 Check motor directions


 Adjust code for speed control (e.g., using PWM)
 Add features like obstacle avoidance, horn, or lights

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:

Great! Here's a complete guide to programming a Bluetooth-controlled car using Arduino


Uno and an HC-05 Bluetooth module:

✅ Steps to Program a Bluetooth-Controlled Car (Arduino


Uno)
🧰 1. Materials Needed

 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

🟦 HC-05 Bluetooth Module

 VCC → 5V (on Arduino)


 GND → GND
 TX → Arduino pin 0 (RX)
 RX → Arduino pin 1 (TX) (Use a voltage divider or resistor)

🟥 L298N Motor Driver

 IN1 → Arduino pin 8


 IN2 → Arduino pin 9
 IN3 → Arduino pin 10
 IN4 → Arduino pin 11
 ENA → Jumper cap or PWM pin (e.g., pin 5)
 ENB → Jumper cap or PWM pin (e.g., pin 6)
 Motor A → Left motor
 Motor B → Right motor
 +12V → Battery positive
 GND → Arduino GND and battery GND

💻 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;

case 'L': // Left


digitalWrite(8, LOW);
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
break;

case 'R': // Right


digitalWrite(8, HIGH);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, HIGH);
break;

case 'S': // Stop


digital Write(8, LOW);
digital Write(9, LOW);
digital Write(10, LOW);
digitalWrite(11, LOW);
break;
}
}
}

📲 4. Phone Bluetooth Controller

 Install Arduino Bluetooth Controller or Bluetooth Terminal app


 Pair your phone with HC-05 (Password: usually 1234 or 0000)
 Use buttons in the app to send:
F → Forward
B → Backward
L → Left
R → Right
S → Stop
⚠️Tips

 Disconnect the Bluetooth module before uploading code.


 Use a voltage divider for HC-05 RX pin (since it expects 3.3V).
 Test all directions one by one.

Here are the steps taken when programming a Bluetooth-controlled car (using a
microcontroller like Arduino, ESP32, or Raspberry Pi):

1. Gather Components

 Microcontroller (e.g., Arduino Uno, ESP32, etc.)


 Bluetooth module (e.g., HC-05 or inbuilt Bluetooth in ESP32)
 Motor driver (e.g., L298N)
 DC motors and wheels
 Chassis
 Battery pack
 Jumper wires
 Smartphone (to control the car via Bluetooth app)
🧠 2. Design the Circuit

 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

💻 3. Write the Program (Code)

Upload code to the microcontroller to:

 Receive commands via Bluetooth (e.g., 'F' for forward, 'B' for backward)
 Control motors based on the command

Example Arduino Code Snippet:

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
🔄 5. Upload and Test

 Upload the code to your microcontroller


 Power up the car
 Open the Bluetooth app and send commands like 'F', 'B', 'L', 'R'

✅ 6. Debug and Improve

 Check motor directions


 Adjust code for speed control (e.g., using PWM)
 Add features like obstacle avoidance, horn, or lights

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:

Great! Here's a complete guide to programming a Bluetooth-controlled car using Arduino


Uno and an HC-05 Bluetooth module:

✅ Steps to Program a Bluetooth-Controlled Car (Arduino


Uno)
🧰 1. Materials Needed

 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

🟦 HC-05 Bluetooth Module

 VCC → 5V (on Arduino)


 GND → GND
 TX → Arduino pin 0 (RX)
 RX → Arduino pin 1 (TX) (Use a voltage divider or resistor)

🟥 L298N Motor Driver

 IN1 → Arduino pin 8


 IN2 → Arduino pin 9
 IN3 → Arduino pin 10
 IN4 → Arduino pin 11
 ENA → Jumper cap or PWM pin (e.g., pin 5)
 ENB → Jumper cap or PWM pin (e.g., pin 6)
 Motor A → Left motor
 Motor B → Right motor
 +12V → Battery positive
 GND → Arduino GND and battery GND

💻 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;

case 'L': // Left


digitalWrite(8, LOW);
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
break;

case 'R': // Right


digitalWrite(8, HIGH);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, HIGH);
break;

case 'S': // Stop


digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
break;
}
}
}

📲 4. Phone Bluetooth Controller

 Install Arduino Bluetooth Controller or Bluetooth Terminal app


 Pair your phone with HC-05 (Password: usually 1234 or 0000)
 Use buttons in the app to send:
F → Forward
B → Backward
L → Left
R → Right
S → Stop

⚠️Tips

 Disconnect the Bluetooth module before uploading code.


 Use a voltage divider for HC-05 RX pin (since it expects 3.3V).
 Test all directions one by one.
Would you like a diagram of the wiring? I can generate one for you.

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:

Here's a complete Arduino program for a Bluetooth-controlled car using:

 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;

char command; // stores Bluetooth command

void setup() {
// Set motor pins as output
pinMode(motor1Pin1, OUTPUT);
pinMode(motor1Pin2, OUTPUT);
pinMode(motor2Pin1, OUTPUT);
pinMode(motor2Pin2, OUTPUT);

// Set LED pins as output


pinMode(frontLight, OUTPUT);
pinMode(backLight, OUTPUT);
// Initialize serial communication with HC-05
Serial.begin(9600);
}

void loop() {
if (Serial.available()) {
command = Serial.read();

// Actions based on command


switch (command) {
case 'F': // Forward
moveForward();
break;
case 'B': // Backward
moveBackward();
break;
case 'L': // Left
turnLeft();
break;
case 'R': // Right
turnRight();
break;
case 'S': // Stop
stopCar();
break;
}
}
}

// 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.

🔌 1. Match Between Code and Circuit


Defined in Code
Component Wired To Arduino Pin Function
As
Motor IN1
Pin 2 motor1Pin1 Left motor direction A
(Left)
Motor IN2
Pin 3 motor1Pin2 Left motor direction B
(Left)
Defined in Code
Component Wired To Arduino Pin Function
As
Motor IN3
Pin 4 motor2Pin1 Right motor direction A
(Right)
Motor IN4
Pin 5 motor2Pin2 Right motor direction B
(Right)
Front Light
Pin 6 frontLight Turns ON during Forward
LED
Back Light LED Pin 7 backLight Turns ON during Backward
Receives commands from
HC-05 TX Arduino RX (Pin 0) Serial.read()
phone
Arduino TX (Pin 1) via Sends data (not needed in
HC-05 RX
voltage divider this case)

🔴 Important: Disconnect HC-05 before uploading code, then reconnect for testing.

📱 2. Set Up Bluetooth App on Your Phone


✅ Recommended App:

 “Bluetooth Terminal” or
 “Arduino Bluetooth Controller” (available on Play Store)

🔧 Steps:

1. Turn on your HC-05 module (you’ll see a blinking red LED).


2. On your phone, go to Bluetooth Settings → Pair with HC-05
(PIN: 1234 or 0000)
3. Open the Bluetooth controller app.
4. Connect to HC-05.
5. Use button or terminal mode to send these commands:

Send What Happens


F Car moves forward + front lights ON
B Car moves backward + back lights ON
L Turns left
R Turns right
S Stops all motors + lights OFF

🧪 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.

✅ Testing Guide for Arduino Bluetooth Car

🔌 Step 1: Hardware Setup Check

Make sure:

 Motors are properly connected to L293D driver (IN1–IN4).


 Front and back LEDs are connected (with 220Ω resistors) to pins 6 and 7 of Arduino.
 HC-05 Bluetooth module is wired:
o TX → Arduino RX (Pin 0)
o RX → Arduino TX (Pin 1) via a voltage divider (2kΩ + 1kΩ)
o VCC → 5V
o GND → GND

💾 Step 2: Upload Code to Arduino

1. DISCONNECT the HC-05 module before uploading.


2. Connect Arduino to your PC via USB.
3. Upload the code from earlier.
4. After uploading, reconnect the HC-05.

📱 Step 3: Bluetooth Pairing (Phone)

1. Go to your phone’s Bluetooth Settings.


2. Pair with HC-05. (PIN: 1234 or 0000)
3. Install and open "Bluetooth Terminal" or "Arduino Bluetooth Controller" app.
📲 Step 4: Sending Test Commands

After connecting the app to HC-05:

Command Result What to Check


F Car goes forward Front LED (pin 6) should light up
B Car goes backward Back LED (pin 7) should light up
L Car turns left No LEDs light up
R Car turns right No LEDs light up
S Car stops All LEDs off, no motor movement

If anything doesn’t work:

 Double-check wiring
 Make sure serial monitor is closed
 Ensure HC-05 RX uses voltage divider

🌟 Bonus: Add Speed Control (PWM)

Let’s make motors spin faster/slower using PWM on ENA and ENB pins of the L293D:

🧰 Wiring:

 ENA → Arduino pin 9


 ENB → Arduino pin 10

💻 Add this to your code (top):

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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy