Project Report
Project Report
Submitted by
CHETHAN M (727721EUMT025)
DINESH B (727721EUMT030)
GANESH K (727721EUMT032)
of
BATCHELOR OF ENGINEERING
IN
MECHATRONICS ENGINEERING
MARCH 2024
BONAFIDE CERTIFICATE
SIGNATURE SIGNATURE
Dr. M. LYDIA Dr. D. PRITIMA
HEAD OF THE DEPARTMENT SUPERVISOR
Department of Mechatronics Engineer- Department of Mechatronics Engineer-
ing, ing,
Sri Krishna College of Engineering Sri Krishna College of Engineering
and Technology, Coimbatore -641008 and Technology, Coimbatore -641008.
spatial awareness, the Smart Guide System not only assists in navigating
physical spaces but also fosters the social inclusion of visually impaired
of GPS and GSM technologies, the Smart Guide System ensures the
i
ACKNOWLEDGEMENT
ii
TABLE OF CONTENTS
iii
5 DESCRIPTION OF EQUIPMENT 19
5.1 ARDUINO NANO 19
5.2 BATTERY 19
5.3 ULTRASONIC SENSOR 20
5.4 VIBRATION SENSOR 21
5.5 GSM MODULE 22
5.6 BUZZER 23
5.7 GPS MODULE 23
6 ELECTRICAL CIRCUIT 25
7 WORKING PRINCIPLE 26
7.1 OBSTACLE AVOIDANCE 26
7.2 EMERGENCY ALERT 26
7.3 FLOWCHART 28
8 COST ESTIMATION 29
9 CONCLUSION 32
REFERENCES 34
ANNEXURE 37
iv
LIST OF TABLES
iv
LIST OF FIGURES
5.6 BUZZER 23
7.3.1 FLOWCHART 28
v
CHAPTER 1
INTRODUCTION
1
In an era where remote monitoring and security are paramount, the in-
tegration of GPS and GSM modules with vibration sensors represents a signific-
ant advancement in real-time asset tracking and security systems. This innovat-
ive technology offers a proactive approach for safeguarding valuable assets by
instantly alerting stakeholders when unexpected vibration levels are detected.
At the heart of this system lies the vibration sensor, which serves as the
frontline defense against unauthorized access, tampering, or theft. This sensor
detects fluctuations in vibration levels, such as those caused by physical impacts
or manipulation of the monitored asset. Upon detecting an increase in vibration
beyond predefined thresholds, the system triggers an alert, promptly notifying
stakeholders of potential security breaches or operational anomalies.
A smart blind stick integrated with GPS and GSM technologies is a revolu-
tionary device that significantly enhances the mobility and safety of visually im-
paired individuals. The GPS module enables precise location tracking, allowing
users to navigate unfamiliar environments with confidence. Real-time location
data can be displayed on a small screen or transmitted to a smartphone app,
providing users with up-to-date information about their surroundings. The GSM
module provides communication capabilities, enabling users to make emer-
gency calls or send SMS messages to predefined contacts in times of need. Ad-
ditionally, remote assistance can be provided through the GSM module, allows
2
supporting person to remotely access the device's GPS data and provide guid-
ance to the user.
The smart blind stick represents a beacon of hope and progress in the
journey towards a more inclusive and accessible world for all. By harnessing
the power of innovation and empathy, we can empower individuals with disabil-
ities to navigate their lives with dignity, independence, and confidence.
CHAPTER 2
LITERATURE REVIEW
3
2.1 LITRATURE SURVEY
4
be used as the main processing unit. Next,NEO-6m GPS module is used to rout-
ing the coordinate while SIM 900A GSM module is used to connecting with the
user. The product was successfully run at outdoor and having some problem at
indoor due to GPS module cannot extract the accurate coordinate when there is
a roof or obstructer that block the direct signal connection between the GPS and
satellite [3]. The development of remote control technology has grown rapidly
along with the development of communication technology nowadays. The
simplest communication technology available is by using GSM protocol. In this
paper, a prototype of electric appliance control tool via SMS by using GSM is
proposed. GSM protocol was chosen because it does not depend on mobile
devices' platform. GSM SIM 900 and Arduino for controlling a relay module
were utilized here [4]. GSM network is the most worldwide mobile communica-
tion network nowadays. Based on the SIEMENS MC35 GSM module, general
techniques of communication with GSM network are depicted, including the
initialization of terminal equipment, sending and reading short messages (SMS),
sending SMS to group users, and the management on phonebook of SIM card,
furthermore, a flexible solution on real-time reading SMS is proposed. Finally,
application cases are given for GSM module [5]. Home security system is
needed for convenience and safety system was invented by Abhishek et al to
keep home safe from intruder. In this work, we present the design and imple-
mentation of a GSM based wireless home security system. which take a very
less power. The system is a wireless home network which contains a GSM mo-
dem and magnet with relay which are door security nodes. The system can re-
sponse rapidly as intruder detect and GSM module will do alert homeowner.
This security system for alerting a house owner wherever he will. In this system
a relay and magnet installed at entry point to a precedence produce a signal
through a public telecom network and sends a message or redirect a call that
that tells about your home update or predefined message which is embedded in
5
microcontroller. Suspected activities are conveyed to remote user through SMS
or Call using GSM technology [6]. This paper introduces a novel method for
designing the transducer of a highly directional ultrasonic range sensor for de-
tecting obstacles in mobile robot applications. The transducer consists of wave
generation, amplification, and radiation sections, and a counter mass. The oper-
ating principle of this design is based on the parametric array method where the
frequency difference between two ultrasonic waves is used to generate a highly
directional low-frequency wave with a small aperture. [7]. A sensor is a device
that converts one type of energy to another. Arduino is a small microcontroller
board with a USB plug to connect to the computer. The Arduino board senses
the environment by receiving input from a variety of sensors and can affect its
surroundings by controlling lcds, speakers, motors and GS module. Ultrasonic
Sensor measures the distance of target objects or materials through the air using
“non-contact” technology. They measure distance without damage and are easy
to use. The output Signals received by the sensor are in the analog form, and
output is digitally formatted and processed by microcontroller. In present work,
it is used to detecting an obstacle, along with its exact distance. The internal
analog to digital converter is used is calibrated to get almost accurate distance
measurement. The measured distance is also displayed on an LCD screen [8].
Automatic variable-rate sprayers require accurate measurement of can-
opy size. An estimate of canopy size is made by measuring the distance to the
canopy at several elevations above the ground; an ultrasonic sensor was used to
determine canopy distance in this study. It is sometimes necessary to conduct
spray operations during harsh operating conditions. In this study ultrasonic
sensors were subjected to simulated environmental and operating conditions to
determine their durability and accuracy [9]. Vibration sensing is critical to mon-
itor and ultimately preserve the health state of engineering systems. These sys-
tems with a large structure are typically working in some harsh environments
including strong magnetic fields. However, traditional electrical sensors are dif-
6
ficult to accurately measure the vibration under harsh environments. Besides
these instinct advantages of normal fibre optic sensors (FOS) sensors such as
compact size, passive sensing, resistance to electromagnetic interference, etc.,
fibre Bragg grating (FBG) sensors have a capability of distributed sensing based
on wavelength demodulation and resistance to light intensity fluctuation and un-
wanted fibre bending losses [10]. Vibration is one of the most popular phenom-
ena that exists in our daily life. Detection of mechanical vibration usually uses
laser technology. Here, we demonstrated the first application of a piezoelectric
nanogenerator (NG) as a self-powered sensor for detecting the vibration status
of a cantilever. By attaching a NG at the surface of a cantilever near the fixed
end, the resonance frequency and amplitude damping have been quantified us-
ing the output voltage of the NG without a power source. This study proves an-
other exciting application of NG in the self-powered vibration detection systems
by Aifang and co [11]. At present, one of the key equipment in pillar industries
is a large rotating machinery. Conducting regular health monitoring is important
for ensuring safe operation of the large rotating machinery. Because vibrations
sensors play an important role in the workings of the rotating machinery, meas-
uring its vibration signal is an important task in health monitoring [12]. In this
paper, we present new research on the new coming Arduino Nano boards for
summer 2019. Arduino has expanded its family of tiny Nano boards with new
offerings that deliver better specs for a lower price. Four new boards of Ardu-
ino, Nano will be on the market soon, they have integrated interesting features
for attractive applications. The new boards include Wi-Fi and Bluetooth as
wireless communication. Some of them include general-purpose sensors that is
temperature, humidity, pressure and acceleration for movement detection. We
have detailed the new boards and made a comparison study. It can be concluded
that these boards will improve and facilitate the design of IoT projects and ap-
plications and the wireless sensors network [13]. Agriculture needs an irrigation
infrastructure, which includes major and minor canals from river bodies,
7
groundwater stored in wells, tank storages and rainwater harvesting systems.
The irrigation infrastructure improvements have helped India to improve food
security, increase agricultural output and decreased dependency on rainwater.
This project focused on proposing an effective moisture control based Modern
Irrigation System (MIS) using Arduino Nano with various adjustments to the
plantation. The main purpose of this project is to reduce the excess water usage,
thereby saving crops from damage. There were numerous projects and proto-
types for automatic irrigation using Arduino, but these projects are effective
only for only one crop. The proposed system can be applied to various crops, as
those crops have different moisture conditions for its growth [14]. This study
shown by Ivana Maretha Siregar et al aims to create a robot prototype for a
garbage collection ship made using an Arduino nano microcontroller. The pro-
totype of this garbage collection robot vessel is controlled by an Android smart-
phone application that is connected via Bluetooth. The prototype of the robot of
the boat was made to deal with piles of garbage that can cause flooding. The
method used in making the prototype ship robot along with the controller ap-
plication begins with identifying the problem, namely the problem of piles of
garbage, then needs analysis. Moreover, in this research, what will be developed
is in terms of design, ship robot prototype, and ship robot controller design.
Next is implementation and testing [15].
In optical-fibre networks, it is important to monitor water which seeps
into splice enclosures. The fibres have residual stress at splicing points, and
when water is present, this adversely affects fibre lifetime. A water sensor
which has a simple structure for monitoring water at splicing points has been
developed. This water sensor causes optical loss due to fibre bending when wa-
ter seeps into splicing enclosures. The design method using a fibre-bending
model and sensor performance are described [16]. The success of time domain
reflectometry (TDR) has led to the development of other instruments that use
the soil dielectric constant as the basis for determining volumetric soil water
8
content. An example is the Water Content Reflectometer (WCR; Campbell Sci-
entific, Logan, UT), which is much less expensive than TDR and is used
widely, although little has been published concerning its applicability to soil
water content monitoring [17]. Safety belt use or non-use by drivers in their
vehicles was visually observed at 152 sites in and around 10 cities and towns in
four states in May, June, and early July, 1972. Sites were chosen where belt use
can be seen easily in daylight from the right side of the vehicle at some freeway
entrances and exits, jam areas, and other sites where vehicles slow to less than
about 15 miles per hour. As a given vehicle approached, the observer tape-re-
corded the sex, estimated age, and racial appearance of the driver. When the
vehicle was alongside, the driver's use or non-use of belts was recorded. The
rear license plate number was recorded as the vehicle moved away. The process
was then repeated for the next available vehicle [18]. The aim of this study is to
describe the construction of buzzer identity on social media. Buzzer is one of
the actors in social media who has the role as an influencer who persuades the
followers on a particular topic in Twitter. Buzzer sometimes provides Twitter’s
biography (bio) in order to describe the simplest user identity. The common
user never realizes the existence of a buzzer if just identify based on the short
biography, status updates or tweets on social media. Researcher examines the
buzzer identity by using the descriptive approach and symbolic interaction the-
ory draws on George Herbert Mead through interaction and self-presentation in
Twitter [19]. Technologies are rapidly evolving, allowing people to live health-
ier and simpler lives. Sightless people are unable to carry out their everyday
activities, such as walking down the street, visiting friends or relatives, or doing
some other mundane tasks. As a result, the smart stick is a stick that can assist a
person in walking safely without fear of colliding with another person or solid
objects is proposed as a solution to this major issue. It is a development of the
traditional blind stick as it acts as a companion for the blind when walking by
sending audio alerts to the blind via a headphone connected to the phone with
9
obstacles (water/walls/stairs/muddy ground) and also enables him to make a
phone call to ask for help. EasyEdasoftware was used for designing and simu-
lating electrical circuits, was used to model the electric circuit. The system de-
veloped by Shubham Bele and co functions similarly to a white cane in that it
assists blind people in scanning their surroundings for obstacles or orientation
marks [20]. Independence is the building methodology in achieving dreams,
goals, and objectives in life. Visually impaired persons find themselves challen-
ging to go out independently. There are millions of visually impaired or blind
people in this world who are always in need of helping hands. For many years
the white cane became a well-known attribute to blind person’s navigation and
later efforts have been made to improve the cane by adding remote sensors.
Blind people have a big problem when they walk on the street or stairs using a
white cane, but they have sharp haptic sensitivity. The electronic walking stick
will help the blind person by providing a more convenient means of life. The
main aim of this paper is to contribute our knowledge and services to the people
of the blind and disable society [21].
*
CHAPTER 3
DESIGN CALCULATION
10
3.1 PRIMARY ALUMINIUM TUBE
MASS CALCULATION:
Length of Aluminium Tube (L) = 60 cm
Internal Diameter of Aluminium Tube (di) =2.3 cm
Volume (V):
V=A*L
V = 0.754 * 60
V = 45.24 cm3
Mass (M):
M=V * ρ
Given that the density ρ is 2.7 g/cm3
11
M=45.24 * 2.7
M=122.148 g
MASS CALCULATION:
Volume (V):
V=A*L
V = 0.598 * 51
V = 30.498 cm3
Mass (M):
M= V * ρ
Given that the density ρ is 2.7 g/cm3
M= 30.498 * 2.7
12
M=82.344 g
CHAPTER 4
3D MODELLING
Creating a Fusion 360 model for a smart blind stick involves a digital
13
design process geared towards developing a functional and ergonomic
housing. Starting with sketching, designers outline the dimensions and
shape of the housing, considering factors like grip comfort and weight
distribution. Through extrusions and revolves, the 2D sketches are
transformed into 3D geometry, forming the main body and handle of the
housing. To enhance both aesthetics and user comfort, fillets and chamfers
are added to smooth out edges and corners. Utilizing Fusion 360's intuitive
tools, designers then hollow out the interior of the housing while
maintaining structural integrity through the shell feature. Precise placement
of openings for components like sensors and ports is achieved through cut-
extrudes, ensuring proper alignment and clearance .The CAD model of a
blind stick, especially one designed with smart features for visually
impaired individuals, encompasses a detailed digital representation of the
device's physical structure and technological components. This model
typically includes intricate geometric details, such as the stick's overall
dimensions, the ergonomic design of the handle for optimal grip and
support, and any collapsible features for convenient storage. Moreover, it
incorporates sensors, electronics, and feedback mechanisms integral to its
smart functionalities, like ultrasonic sensors for obstacle detection and
navigation assistance. Attention to manufacturing details, including
materials, textures, tolerances, and assembly instructions, ensures the
practicality and manufacturability of the blind stick. Overall, the CAD
model serves as a crucial tool in the design, prototyping, and production
phases, facilitating the creation of an effective and user-friendly assistive
device for individuals with visual impairments.
14
Fig. 4.1 Front view (Stick)
15
insight into the object's shape and arrangement of features, aiding in
visualization and design assessment.
16
Fig. 4.3 Side view (Stick)
CHAPTER 5
DESCRIPTION OF EQUIPMENT
18
5.1 ARDUINO NANO
The Arduino Nano is a compact microcontroller board featuring an AT-
mega328P chip. It offers 14 digital I/O pins, 8 analog inputs, and operates at
5V with a 16MHz clock speed. With a mini/micro-USB port for program-
ming and power, it supports UART, I2C, and SPI communication. Pre-
loaded with a bootloader, it's programmable using the Arduino IDE. LEDs
indicate power and status. Its small size, compatibility with shields, and
open-source design make it ideal for diverse projects, from robotics to IoT.
Overall, the Arduino Nano provides a versatile and accessible platform for
prototyping and creating electronic projects in a compact form factor. The
Arduino nano is shown in Fig. 5.1 .
5.2 BATTERY
Lithium-ion (Li-ion) batteries are rechargeable energy storage devices
widely used in portable electronics, electric vehicles, and renewable energy
systems. They feature a lightweight design and high energy density, provid-
ing extended runtime compared to traditional battery chemistries. Li-ion
batteries typically consist of a lithium-cobalt oxide cathode, a graphite an-
ode, and a lithium-ion electrolyte. Their rechargeable nature allows for hun-
dreds to thousands of charge-discharge cycles with minimal capacity loss.
19
However, Li-ion batteries require protection circuits to prevent overcharging
and overheating, as they can be prone to thermal runaway if mishandled.
Advancements in Li-ion battery technology continue to improve energy
density, safety, and longevity. These batteries are pivotal in the transition to
clean energy and electrification of transportation. Nonetheless, challenges
such as cost, resource availability, and environmental concerns regarding
extraction and disposal remain areas of active research and development in
the energy storage field .The Battery is shown is Fig. 5.2.
20
applications, and automotive systems for parking assistance and collision
avoidance .
21
Fig. 5.4 Vibration Sensor
22
5.6 BUZZER
A buzzer is an electromechanical device that produces sound when an
electrical current passes through it. It typically consists of a coil of wire, a
diaphragm, and a housing. When powered, the coil creates a magnetic field,
causing the diaphragm to vibrate and produce sound waves. Buzzers are
commonly used in electronic devices for audible alerts, alarms, and notifica-
tions. They come in various sizes, frequencies, and power requirements,
making them versatile for different applications.The Buzzer is shown in Fig.
5.6.
23
GPS receiver needs signals from at least four satellites. The GPS receiver
uses a technique called trilateration to determine its position.
Incorporating our selected sensors into the smart blind stick design em-
powers it with comprehensive environmental awareness. By seamlessly integ-
rating ultrasonic, water, and vibration sensors alongside GPS functionality, our
device ensures enhanced safety and navigation for visually impaired individu-
als. This integration heralds a significant leap forward in assistive technology,
promising heightened independence and confidence in navigating diverse sur-
roundings.
CHAPTER 6
ELECTRICAL CIRCUIT
The electric circuit for a smart guide for visually impaired individuals,
built around an Arduino Nano, incorporates ultrasonic sensors for obstacle
24
detection. The Nano processes sensor data and controls feedback
mechanisms like vibration motors and buzzers. Power is provided by a
rechargeable battery, with a voltage regulator ensuring stable operation.
User interaction is facilitated by buttons and switches, while LEDs convey
device status. Additionally, the Nano's compact size makes it ideal for
wearable designs. Thorough testing and consideration of user ergonomics
are crucial for ensuring the device's efficacy in assisting visually
impaired individuals. The electrical circuit is shown in Fig 6.1
CHAPTER 7
WORKING PRINCIPLE
25
The working principle of a smart blind stick revolves around integrating
various technologies to enhance navigation and communication for visually im-
paired individuals.
The vibration sensor danger alert system with GPS and GSM SMS
sending is a sophisticated safety mechanism designed to detect and respond
to potentially dangerous situations. At its core, the system relies on a vibra-
tion sensor that is sensitive to significant movements or impacts. When such
vibrations are detected, indicating a potential fall or impact, the sensor
promptly triggers an alert mechanism. This alert is then seamlessly pro-
cessed by a microcontroller, which serves as the brain of the system. Upon
activation, the microcontroller orchestrates the functioning of the GPS
26
(Global Positioning System) and GSM (Global System for Mobile Commu-
nications) modules integrated into the device .The GPS module plays a
pivotal role in determining the precise location of the device. By leveraging
satellite signals, it accurately pinpoints the user's coordinates, offering vital
information that can be crucial for emergency services or caregivers to
swiftly locate the individual in distress .Simultaneously, the GSM module
comes into action by sending out an SMS notification to a list of predefined
contacts. This message not only alerts recipients about the detected danger
but also provides them with the essential location data obtained from the
GPS module. Such real-time information empowers the designated contacts
to respond promptly and effectively to the situation, ensuring timely assist-
ance for the user. In essence, this integrated system functions as a proactive
safety net, capable of delivering instant alerts and location details in times of
need. By combining vibration sensing technology with GPS and GSM com-
munication capabilities, it significantly enhances the safety and well-being
of users, offering peace of mind to both individuals and their caregivers.
7.3 FLOWCHART
27
Fig. 7.3.1 Flowchart
28
CHAPTER 8
COST ESTIMATION
The cost estimation for a smart blind stick depends on the components
used in its construction. Key components typically include a GPS module
for location tracking, a GSM module for communication, a microcontroller
for processing, sensors for obstacle detection such as Ultrasonic sensor, for
vibration analysis here the vibration sensor also used, a rechargeable bat-
tery, Jumper Wires for the connectivity and aluminium stick with proper
handle. Each of these components contributes to the overall functionality
and cost of the smart blind stick .The below table 8.1 represents the cost
and specifications of the components.
29
TOTAL
S.NO. COMPONENTS SPECIFICATIONS QUANTITY COST
COST
Arduino Nano
1 Operating voltage – 2 ₹250.00 ₹500
5V
UltraSonic Max Range-4m
2 Sensor(HC-SR04) Min Range-2cm 2 ₹65 ₹130
Measuring Angle-15
LM2596S DC-DC
Buck Converter
3 Buck Converter Power Supply 1 ₹65 ₹65
Operating Voltage:
4 Vibration Sensor 3.3V to 5V DC 1 ₹60 ₹60
NEO-6M GPS
5 GPS module Module with 1 ₹375 ₹375
EPROM
Nominal Volt-
age-3.2
6 Battery Nominal Capac- 1 ₹160 ₹160
ity-30Ah
30
11 Water Sensor Operating Voltage 3- 1 ₹50 ₹50
5V
-
12 Soldering Kit 1 ₹220 ₹220
Operating Voltage 3V
13 Buzzer 2 ₹20 ₹20
Net Weight-600g
14 Aluminum Walk- 1 ₹700 ₹700
ing Stick
Male - Male, Male -
Female, Female - Fe-
15 Jumper Wires - ₹250 ₹250
male,
31
CHAPTER 9
CONCLUSION
32
Beyond its immediate practical benefits, the smart blind stick
symbolizes the power of technology to empower individuals with disabilities
and promote inclusivity in society. By breaking down barriers to mobility and
independence, this innovative solution enables visually impaired individuals to
participate more fully in everyday activities, pursue education and employment
opportunities, and engage with their communities on their own terms.
33
REFERENCES
34
tance sensing with ultrasonic sensor and Arduino’. International
Journal of Advance Research, Ideas and Innovations in Technology
Vol.2,No.5, pp.01-05.
9. Hong Y Jeon, Heping Zhu, Richard Derksen, Edal Ozkan and Charles
Krause.(2011). ‘Evaluation of ultrasonic sensor for variable-rate spray
applications’. Computers and electronics in agriculture Vol.75,
No.01, pp.213-221.
10. Tianliang Li, Jinxiu Guo, Yuegang Tan and Zude Zhou.(2020). ‘Re-
cent advances and tendency in fiber Bragg grating-based vibration
sensor’. IEEE Sensors Journal Vol.20, No.20, pp.12074-12087.
11. Aifang Yu, Peng Jiang and Zhong Lin Wang.(2012). ‘Nanogenerator
as self-powered vibration sensor’. Nano Energy Vol.1, No.03, pp.418-
423.
12. Shaoyi Xu, Fangfang Xing, Ruilin Wang, Wei Li, Yuqiao Wang and
Xianghui Wang.(2018). ‘Vibration sensor for the health monitoring of
the large rotating machinery: Review and outlook’. Sensor Review
Vol.38, No.01, pp.44-64.
15. Ivana Maretha Siregar, Muhammad Yunus and Victor Marudut Mulia
Siregar.(2022). ‘A Prototype of Garbage Picker Ship Robot Using Ar-
duino Nano Microcontroller’. Internet of Things and Artificial Intelli-
gence Journal Vol.02, No.3, pp.150-168.
35
17. Seyfried and MD Murdock.(2001). ‘Response of a new soil water sen-
sor to variable soil, water content, and temperature’. Soil Science So-
ciety of America Journal Vol.65,No.01, pp.28-34.
20. Shubham Bele, Swapnil Ghule, Akshay Gunjal and Nitesh Anwat.
(2020). ‘Design and implementation of smart blind stick’. 2nd Interna-
tional Conference on Communication & Information Processing (IC-
CIP).
21. Abhay Pratap Singh, Akhilesh Kr. Sharma, Amrit Pandey and
Prof. Kriti.(2016). ‘A Review on Ultrasonic Radar Sensor for Security
system’ . Journal of Emerging Technologies and Innovative Re-
search (JETIR).
36
ANNEXURE
const int vibPin = A5; // Analog pin connected to the vibration sensor
int vibValue = 0;
const int trigPin1 = A1;
const int echoPin1 = A0;
const int buzzerPin = 9;
const int buzzerPin1 = 8;
const int Pin = A6; // Analog pin connected to the water sensor
int watersensor = 0; // Variable to store the sensor reading
int waterLevel = 0;
long duration1;
int distance1;
void setup()
{
// Memulai koneksi serial pada baudrate 9600
Serial.begin(9600);
pinMode(trigPin1, OUTPUT); // Set trigger pin as output
pinMode(echoPin1, INPUT); // Set echo pin as input
37
pinMode(trigPin2, OUTPUT); // Set trigger pin as output
pinMode(echoPin2, INPUT); // Set echo pin as input
pinMode(buzzerPin, OUTPUT);
pinMode(buzzerPin1, OUTPUT);
void loop()
{
// Membuat tampilan data ketika terdapat koneksi
while (gpsSerial.available() > 0)
{
if (gps.encode(gpsSerial.read()))
{
displayInfo();
// Read the sensor value (0 to 1023)
vibValue = analogRead(vibPin);
watersensor = analogRead(Pin);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
38
delayMicroseconds(2);
}
Serial.print("Distance1: ");
Serial.print(distance1);
Serial.println(" cm");
if (distance1 < 80 && distance1 > 50)
{
digitalWrite(buzzerPin, HIGH);
delay(600);
digitalWrite(buzzerPin, LOW);
delay(100); // Wait for 1 second
}
else if (distance1 < 50 && distance1 > 30)
{
digitalWrite(buzzerPin, HIGH);
delay(900);
digitalWrite(buzzerPin, LOW);
delay(100); // Wait for 1 second
}
else if (distance1 < 30 && distance1 >=0)
{
digitalWrite(buzzerPin, HIGH);
delay(2000);
digitalWrite(buzzerPin, LOW);
39
delay(100); // Wait for 1 second
}
else
{
digitalWrite(buzzerPin, LOW); // Turn off buzzer
}
40
digitalWrite(buzzerPin1, LOW);
delay(100); // Wait for 1 second
else
{
digitalWrite(buzzerPin1, LOW); // Turn off buzzer
}
// Jika dalam 5 detik tidak ada koneksi, maka akan muncul error "No GPS
detected"
// Periksa sambungan dan reset arduino
if (millis() > 5000 && gps.charsProcessed() < 10)
{
Serial.println("No GPS detected");
while (true)
;
}
}
void displayInfo()
{
if (gps.location.isValid())
{
Serial.print("Latitude: ");
Serial.println(gps.location.lat(), 6);
Serial.print("Longitude: ");
Serial.println(gps.location.lng(), 6);
}
else
{
Serial.println("Location: Not Available");
}
41
// Adjusting date
int IST_Day = gps.date.day();
int IST_Month = gps.date.month();
int IST_Year = gps.date.year();
int IST_Hour = gps.time.hour() + 5;
int IST_Minute = gps.time.minute() + 30;
if (IST_Minute >= 60)
{
IST_Minute -= 60;
IST_Hour += 1;
}
if (IST_Hour >= 24)
{
IST_Hour -= 24;
// Increment day if hour crosses midnight
IST_Day++;
if (IST_Day > daysInMonth(IST_Month, IST_Year))
{
IST_Day = 1;
IST_Month++;
if (IST_Month > 12)
{
IST_Month = 1;
IST_Year++;
}
}
}
Serial.print(IST_Year);
Serial.print("-");
if (IST_Month < 10)
Serial.print("0");
Serial.print(IST_Month);
Serial.print("-");
if (IST_Day < 10)
Serial.print("0");
Serial.print(IST_Day);
Serial.print(" ");
// Adjusting time
Serial.print(IST_Hour);
Serial.print(":");
if (IST_Minute < 10)
42
Serial.print("0");
Serial.print(IST_Minute);
Serial.print(":");
if (gps.time.second() < 10)
Serial.print("0");
Serial.println(gps.time.second());
}
else
{
Serial.println("Date & Time: Not Available");
}
Serial.println();
Serial.println();
delay(1000);
}
43