ELG3336ProjectJournaling (2)
pdf
keyboard_arrow_up
School
University of Ottawa *
*We aren’t endorsed by this school
Course
2336
Subject
English
Date
Nov 24, 2024
Type
Pages
7
Uploaded by MegaSteelBat
ELG3336
Journaling the Design/Build Project (30 Marks)
Group Number:
Student 1 Name/Number
Chelse Rose Vadakkeveettilan Hilariyos/300214163
Student 2 Name/Number
Shayleen Ghanaat/300198724
TA:
Edesiri Mowarin
Proposed Title of the Project
Pestique Protector
–
Pest Control Device
Submission 3: Project Engineering Final Design with Prototype
Demonstration
(15 marks)
(Last week of classes and lab sessions,
December 5
th
, 2023
)
Design Details:
Include the finalized design and code of your project, write a short explanation of
how your project works, and include what you came across as challenging. Demonstrate your
functional or semi functional prototype to your TA in the lab session.
Picture of Final Product:
Picture of Final CAD Model:
Circuit Diagram:
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Final Code:
#include
<Servo.h>
Servo myservo;
// Create a servo object
int
pirPin =
2
;
int
trigPin =
3
;
int
echoPin =
4
;
int
servoPin =
9
;
int
buzzerPin =
5
;
void
setup
() {
Serial
.
begin
(
9600
);
myservo
.
attach
(servoPin);
// Attaches the servo on pin 9 to the servo object
pinMode
(pirPin, INPUT);
pinMode
(trigPin, OUTPUT);
pinMode
(echoPin, INPUT);
pinMode
(buzzerPin, OUTPUT);
}
void
loop
() {
int
pirValue =
digitalRead
(pirPin);
if
(pirValue == HIGH) {
int
distance =
getUltrasonicDistance
();
Serial
.
print
(
"Distance: "
);
Serial
.
print
(distance);
Serial
.
println
(
" cm"
);
if
(distance <
20
) {
triggerServo
();
// Call the function to move the servo
triggerBuzzer
(
128
);
// Call the function to activate the buzzer with
reduced volume
delay
(
1000
);
// Delay to avoid repeated triggering
}
}
}
void
triggerServo
() {
myservo
.
write
(
360
);
delay
(
1000
);
// Wait for the servo to reach the desired position
myservo
.
write
(
0
);
// Return to the initial position
}
void
triggerBuzzer
(
int
volume) {
analogWrite
(buzzerPin, volume);
delay
(
15000
);
analogWrite
(buzzerPin,
0
);
// Turn off the buzzer
}
int
getUltrasonicDistance
() {
digitalWrite
(trigPin, LOW);
delayMicroseconds
(
2
);
digitalWrite
(trigPin, HIGH);
delayMicroseconds
(
10
);
digitalWrite
(trigPin, LOW);
long
duration =
pulseIn
(echoPin, HIGH);
int
distance = duration *
0.034
/
2
;
return
distance;
}
Explanation of how our product works:
The Pestique Protector is a pest control device that can be used to scare pests away by a visual
and noise deterrent. It uses an infrared motion sensor and ultrasonic distance sensor to detect
movement of pests and a buzzer sensor and a servo motor with an attached scarecrow to scare
away all types of pests. Below the code has been broken down to four steps to show how the
device works using all its sensors and motor.
Step 1.
The infrared motion sensor (pirValue) detects a movement within 20 cm of itself, it
calls on the ultrasonic distance sensor.
if
(pirValue == HIGH) {
int
distance =
getUltrasonicDistance
();
Serial
.
print
(
"Distance: "
);
Serial
.
print
(distance);
Serial
.
println
(
" cm"
);
if
(distance <
20
) {
triggerServo
();
// Call the function to move the servo
triggerBuzzer
(
128
);
// Call the function to activate the buzzer with
reduced volume
delay
(
1000
);
// Delay to avoid repeated triggering
}
}
Step 2.
The ultrasonic distance sensor measures the distance at which the pest is being
detected in centimeters.
int
distance =
getUltrasonicDistance
();
Serial
.
print
(
"Distance: "
);
Serial
.
print
(distance);
Serial
.
println
(
" cm"
);
int
getUltrasonicDistance
() {
digitalWrite
(trigPin, LOW);
delayMicroseconds
(
2
);
digitalWrite
(trigPin, HIGH);
delayMicroseconds
(
10
);
digitalWrite
(trigPin, LOW);
long
duration =
pulseIn
(echoPin, HIGH);
int
distance = duration *
0.034
/
2
;
return
distance;
}
Step 3.
Both the sensors’ detections of the pest’s movement will trigger the buzzer and the
servo motor.
if
(distance <
20
) {
triggerServo
();
// Call the function to move the servo
triggerBuzzer
(
128
);
// Call the function to activate the buzzer with
reduced volume
delay
(
1000
);
// Delay to avoid repeated triggering
}
Step 4.
The buzzer’s alarm goes off at reduced volume of
128 and waits 15000 milliseconds
for another trigger. The servo motor which is attached to a scarecrow will rotate 360 degrees
and return to its original position before waiting for another trigger. The buzzer works as a
noise deterrent to pests such as mice who fear noises. The servo motor or scarecrow will act as
a visual deterrent which will scare any pests from sudden movement. Which all will help
remove a pest problem from an area.
void
triggerServo
() {
myservo
.
write
(
360
);
delay
(
1000
);
// Wait for the servo to reach the desired position
myservo
.
write
(
0
);
// Return to the initial position
}
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
void
triggerBuzzer
(
int
volume) {
analogWrite
(buzzerPin, volume);
delay
(
15000
);
analogWrite
(buzzerPin,
0
);
// Turn off the buzzer
}
Challenges that we encountered:
•
Our initial idea was to incorporate Bluetooth sensors, but they burnt out unexpectedly.
So, we had to incorporate a third sensor quickly to make sure we met the criteria of the
final project.
•
The casing we 3D printed was just the right size which did not allow for any clearance
for fitting the components into the case. This made it very difficult to put all the
sensors, Arduino Uno, and breadboard into the casing, but we were able to make it fit
at the end.
•
Also, we had a immense learning curve as we have never worked with Arduinos or
circuitry before this project, so with the help of our research, TA’s and professor, we
were able to make a fully functioning prototype by the deadline.