Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
California University of Pennsylvania
Department of Applied Engineering & Technology
Electrical / Computer Engineering Technology
EET450: Senior Project
Life-Sense
The Baby and Pet Detection Device
Names: Signature: Date:
1. Chris Bayerlein __________________________________ 4/26/19
2. Andrew Gustafson __________________________________ 4/26/19
3. Dustin Johnson __________________________________ 4/26/19
4. Mike Matyas __________________________________ 4/26/19
Table of Contents
Chapter 1 - Introduction 3
1.1 Problem Description 3
1.2 Outline 3
Chapter 2 – Literature 5
2.1 Introduction 5
2.2 Detection 5
2.3 Temperature 6
2.4 Location 6
2.5 Communication 6
Chapter 3 - Project Purpose 8
3.1 Overview 8
3.2 Research 8
Chapter 4 – Life-Sense 11
4.1 Overview 11
4.2 Project Goals and Objective 11
4.3 Block Diagrams and Flowchart 13
4.4 Bill of Materials and Project Timeline 16
Chapter 5 – Testing and Results 18
5.1 Overview 18
5.2 System Components 18
5.3 Component Testing 19
5.4 System Testing 21
5.5 Project Photographs 22
Chapter 6 – Project Impacts 25
6.1 Societal and Ethical Impacts 25
Chapter 7 – Concluding Remarks 26
7.1 Future Improvements 26
7.2 Conclusion 27
References 28
1
Appendix A: Hardware Schematic 30
Appendix B: Life-Sense Arduino Code 31
Tables and Figures
Figure 1 – Vehicular Heatstroke Deaths 9
Table 1 - Air Temperature vs Time 10
Figure 2: System Block Diagram 13
Figure 3: Sensor Sub-System 13
Figure 4: GSM Sub-System 14
Figure 5: GPS Sub-System 14
Figure 6: Flowchart 15
Table 2: Bill of Materials 16
Figure 7: Gantt Chart 17
Figure 8: Life-Sense Front View 22
Figure 9: Life-Sense Side View 23
Figure 10: Inside Life-Sense Device 23
Figure 11: Test Run 24
Figure 12: Schematic 30
2
Chapter 1
Introduction
1.1 Problem DescriptionDue to technology, the world we live in requires us to live at a faster pace, resulting in people
feeling rushed and it is easy to forget something. Unfortunately, sometimes forgetting can lead
to death or serious injury. Each year hundreds of babies and pets die, and many more are
seriously injured, from being forgotten in hot vehicles. Statistics show that the interior of a
vehicle can reach 104-degrees on a 70-degree day in as little as twenty minutes. At these extreme
temperatures, babies and pets can begin having a heat stroke [1]. In order to prevent future injury
or deaths from hot vehicles, we need a quick and effective method to have them rescued.
Life-Sense is a device that will detect if a living thing was left in a vehicle. Through the use of
sensors, the device will determine if a baby or pet was left in the car. Once something is
detected, the device will begin alerting a series of contacts. The driver will be alerted first on a
fob using wireless communication, or mobile phone application, and will be required to respond
within a set amount of time. If the driver does not respond, the emergency contact will be
notified next with Global Positioning System coordinates and the current temperature of the
vehicle included in the message. Once the vehicle reaches a dangerous temperature, 911 will be
called to ensure the baby or pet is rescued.
1.2 OutlineChapter 2 is a literature survey that provides research on various components and sensors that
were used in the Life-Sense device. The importance of each device is discussed in this section.
Information such as pros and cons of each device are listed as well. The literature survey will
present ideas for selecting such devices based on a purpose for the project.
Chapter 3 presents research and purpose for the project. Other products are discussed in this
section. Looking at these devices it is clear to see that there is a need for a better, more reliably
3
device. Research has been presented about heat related fatality rates, showing the need for a
device that can prevent these deaths.
Chapter 4 discusses the overall project goals and objectives. Included is the detection and
communication methods of Life-Sense. A timeline of the project is presented in the form of a
Gantt chart. We also provide the bill of materials showing this is a cost effective way to prevent
numerous excessive heat related fatalities.
Chapter 5 provides information on testing and results. Individual sensors were tested before
combining them to a complete system. Final protype testing was extensive to ensure the accuracy
of Life-Sense. A successful end result is discussed at the end of this chapter.
Chapter 6 talks about the societal and ethical impacts of the device. A device such as the Life-
Sense is relevant to today’s society as the government is attempting to pass a law requiring all
vehicles to contain technology to prevent child deaths.
Chapter 7 discusses ideal future improvements to be made to the Life-Sense project. Even
though the device is functional and accurate, there are many improvements that could be made as
technology advances. A conclusion is provided to sum up the entire Life-Sense project.
4
Chapter 2
Literature Survey
2.1 IntroductionThe baby and pet detection device is designed to keep them safe in a typical vehicle. The idea
stems from the numerous human deaths and indeterminate number of pets that die in unsafe
temperature conditions of vehicles every year. With the combination of different sensors and a
microcontroller (MCU), Life-Sense will be able to use Global Positioning System (GPS)
tracking and a Global System for Mobile communications (GSM) module and contact someone
who may be able to help the baby or pet in distress if an attempt has been made to contact the
driver but was ignored.
2.2 DetectionMotion sensor technology is extensive; although, motion detection technology could be used to
assist in determining if a heat signature is due to a passenger. Passive Infrared (PIR) is a
technology that relates changes in infrared radiation to motion all while not using any energy to
take readings [2]. This technology allows a warm body to trigger the sensor as it moves. PIR
sensors are commonly seen in security devices to detect a trespasser. A major advantage of a PIR
is that signals cannot be read though windows. This will help ignore disturbances that might pass
by the car window without giving false readings [9]. An advantage of PIR with motion sensing is
that there will not be any false signals from a hot object being in the car.
5
2.3 TemperatureTemperature has been measured in various ways with precision since the early 1700’s. Life-
Sense will use a highly accurate MCU friendly component, the Adafruit MCP-9808, to measure
temperature. Temperature is one of the most important factors in determining if the environment
of the vehicle is safe. A vehicle is able reach a value that is dangerous to babies in twenty
minutes on a seventy degree day, making this measurement a priority.
2.4 LocationGPS is a worldwide positioning system that uses a series of satellites to pinpoint the location of
any GPS receiver requesting a ping. Using GPS, as a means of locating the vehicle that a
passenger may be stranded in, could be the key factor in saving a life. GPS uses 30 different
satellites that are constantly orbiting around the earth at 20,000 kilometers above ground. Once
the module has been connected to three or more satellites, the receiver can then triangulate its
specific location. The United States government mentioned GPS positioning can be accurate up
to seven meters [11]. Companies have created receivers which guarantee accuracy up to one
meter, proving GPS is an accurate way to provide a location [12].
2.5 CommunicationGSM is a standard for mobile communication. This technology is older and outdated to todays’
4G LTE standard, but it still works and is affordable to implement into a small-scale project [4].
Being developed in 1970 by Bell Laboratories, it is a widely used mobile communication system
[15]. This device digitizes and reduces the data, then sends it through a channel to the client
data. The digital system can carry 64 kbps to 120 Mbps of data. Using a SIM card, the GSM
module can operate over the mobile network to send messages and calls with information given
to it. This technology can also feature SIM phonebook management. This would allow access to
6
a list of emergency contacts that can be preprogramed. This will be useful when the driver of the
car does not respond in the allotted time. With the correlation of sensing a passenger,
temperature and GPS location, a message can be derived and sent to the emergency contacts at
any moment. The Life-Sense will use GSM to alert an emergency contact or the authorities if the
system determines a baby or pet is in fatal danger.
7
Chapter 3Project Purpose
3.1 OverviewA vehicle protection device such as Life-Sense has been desired for a long time. The use of
technological advancements is important to assist in reducing the chance for human error
because of the ever-increasing pace of life. “Despite two decades of public education about the
dangers of leaving children in cars, the number of vehicular heatstroke deaths of children in the
U.S. has remained about the same — an average of 37 each year since 1998. Safety advocates
are now backing federal legislation that would mandate a technological solution, requiring new
cars to be equipped with a visual and audio alarm system to alert caregivers if a child is left
behind.” [17] When this law gets passed, manufacturers will have to provide a safety device in
all vehicles. A cost-effective device such as Life-Sense will be great for this.
3.2 Research
3.2.1 Relatable Products
Childminder Softclip
This device is simply a clip that replaces the one on a car seat. It syncs to either a smartphone
app or a key fob and sounds an alarm when you walk more than 15 feet from your car. A
problem with this device is that it is easy to remove, with the product stating it has a one-hand
emergency removal button. A child could unclip the device while the vehicle is moving,
resulting in the driver never receiving a warning message. There is also no display or light to
warn you when the batteries are too low to operate the Softclip.
Evenflow Car Seat with SensorSafe
The Evenflow is a car seat with two forms of protection. The first is a clip comparable to the
Softclip, which the errors for this were already discussed. The second is a sensor that plugs into
the vehicle diagnostic port so that the device knows when the engine is shut off. When the engine
8
is shut off, the SensorSafe technology begins emitting a series of tones, similar to what happens
when you leave your headlights on. This is meant to be a reminder to check the car seat each
time they leave the car. While this is a good idea, when you hear the same tone every time you
shut your car off most people will eventually not notice the alert.
3.2.2 Fatality Statistics
Statistics show that, even with new technology, the passing of babies in hot vehicles have not
diminished since 1998. There has been an average of 37 babies killed by heatstroke in vehicle
each year, with some of the highest totals in the last nine years. Unlike humans, dogs are unable
to sweat and are at an even greater risk of being killed in hot vehicles. Hundreds of pets die in
hot vehicles each year, and this is unfortunate because it is so easily preventable.
Figure 1: Vehicular Heatstroke Deaths
3.2.3 Temperature Statistics
Most people do not realize how quickly a car can reach dangerous temperatures, or that it can
happen on a cool day. On a 70-80 degree day, temperatures in cars can rise to over 105 degrees
in under 30 minutes. On 80-100 degree days, cars can reach shocking temperatures of up to 170
degrees. Heatstroke is clinically defined as when a person's temperature exceeds 104 degrees and
their thermoregulatory mechanism is overwhelmed. Some symptoms of heatstroke include
disorientation, seizures, and loss of consciousness. When a core body temperature of 107
degrees or greater is reached, cells are damaged and internal organs begin to shut down. This
9
cascade of events can rapidly lead to death. Children's thermoregulatory systems are not as
efficient as an adult's, and their body temperatures warm at a rate 3 to 5 times faster. [16]
Table 1: Air Temperature vs Time
10
Chapter 4
Life-Sense
4.1 OverviewLife-Sense is a safety device designed to prevent fatalities and injuries to passengers and pets
from excessive heat when left in a vehicle. This safety device uses an array of sensors for
detection purposes, such as PIR motion, ultrasonic and temperature sensors. After detection is
verified, the system communicates with the driver using a GSM module. In the case the driver
does not respond, the system will follow up with an alert message that includes GPS coordinates
to an emergency contact.
4.2 Project Goals and ObjectiveThe primary objective of Life-Sense is to detect the presence of any living thing, human or
animal, inside a vehicle using an array of multiple different sensors. Ultimately using these
sensors to first alert the owner of the vehicle that something living was left inside the vehicle.
Secondly, to alert the proper authorities if the owner does not respond or the temperature inside
the vehicle is increasing to a potentially harmful level. The ultimate goal of Life-Sense will be to
significantly reduce the number of humans and animals that are injured and/or die from being
left in vehicles that are too hot.
The sensing methods that Life-Sense will utilize are; a PIR motion sensor (Passive infrared
sensor), ultrasonic detection, and temperature. The PIR sensor is an electronic sensor that
measures infrared light radiating from objects in its field of view. The PIR sensor will not
activate until it detects heat energy being emitted from a living entity, this energy will be in the
11
form of infrared radiation. Ultrasonic detection will be used in conjunction with the PIR sensor
to detect if someone was left in the vehicle, ultimately obstructing the view of the back of a seat.
If all the sensing parameters are met, meaning a living thing left in the vehicle has been detected,
the system will then need to alert the owner of the vehicle. Alerting the owner of the vehicle will
be done in several steps depending on the severity of the situation. The first alert will be done via
a GSM module. This alert will activate within a set amount of time after the vehicle being shut
off, if a living thing is detected. The alert will remind the owner to return to the vehicle, because
he/she has forgotten a human or animal in the vehicle. The driver will then need to clear the alert
by flipping a switch on the device in the vehicle, proving that the passenger was saved. If no
response from the owner or the temperature is at a dangerous level, the system will then alert the
emergency contact. The system will contact emergency authorities with a general message
stating that a human or animal has been left in the vehicle and the temperature is reaching a
harmful level. Within the message, the GPS coordinates will also be sent; therefore, the
emergency contact will know the location of the vehicle in order to respond and rescue the
human/animal.
12
4.3 Block Diagrams
4.3.1 System
Figure 2: System Block Diagram
4.3.2 Sensors Sub-System
Figure 3: Sensor Sub-System4.3.3 GSM Sub-System
Figure 4: GSM Sub-System
4.3.4 GPS Sub-System
13
Communication tower
Figure 5: GPS Sub- System
4.3.5 Software Flowchart
14
Triangulating Satellites
Figure 6: Flowchart
4.4 Bill of Materials & Project Timeline
15
Table 2: Bill of MaterialsLife-Sense Bill of Materials
Part Name: Supplier:Part
Number: Quantity: Price: Total:Arduino UNO
MCU Arduino A000067 1 $22.00 $22.00 PIR Motion Sensor Alliexpress KS0052 1 $3.80 $3.80 Temperature Sensor Adafruit MCP9808 1 $4.95 $4.95
GPS Module Adafruit MTK3339 1 $49.95 $49.95 GSM Module Adafruit Fona 3G 1 $79.99 $79.99
Ultrasonic Sensor Vetco SR-04 1 $4.95 $4.95 Junction Box Lowe's N/A 1 $17.00 $17.00 Test Chamber Lowe's N/A 1 $35.00 $35.00
Total: $217.64
16
Figure 7: Gantt Chart
17
Chapter 5
Testing and Results
5.1 OverviewTesting is an imperative step in designing a safety device. When creating something with the
purpose of preventing injuries or death, you must make sure you test every feature and remove
all errors. Our team initially used a step by step testing method, learning how to use each sensor
separately before combing them to create the final system prototype. Once the system prototype
was built, intensive testing was done to remove any errors within the software.
5.2 System Components
Temperature Sensor
Accuracy is an important feature when selecting a temperature sensor for a dangerous
environment. The component we selected is the Adafruit MCP9808 High Accuracy Temperature
Sensor.
PIR Motion Sensor
PIR Motion Sensing is a critical detection method for Life-Sense, so selecting a good quality
component was essential. After researching various sensors, we selected Adafruit’s PIR motion
sensor because it met all our parameters while being cost effective and reliable.
Ultrasonic Sensor
Ultrasonic sensing is another important detection method incorporated in Life-Sense. In the case
that someone is asleep in the vehicle, the PIR sensor will not be triggered. The added feature of
an ultrasonic sensor allows us to determine if a passenger was left in the vehicle even while they
are not moving. The component we selected is the Yotino HC-SR04 ultrasonic module.
18
GPS Module
GPS coordinates, longitude and latitude, are known around the world as a method of determining
someone’s location. An important feature of Life-Sense is that the system will alert an
emergency contact when the driver does not respond to an initial alert. When an emergency
contact is notified, the chance of them knowing the exact location of the vehicle is slim. Life-
Sense includes GPS coordinates in the emergency message to ensure the vehicle can be found
and the passengers saved. To do this we utilize the Adafruit Ultimate GPS Module. This
component suited all of our needs, while including other features such as low power
consumption and high precision.
GSM Module
A GSM module was the most feasible method of communication to use in order to contact the
driver of the vehicle and an emergency contact. While there are many types of GSM modules,
we decided to use a 3G model because 2G is being phased out in the U.S. The module of choice
was the Adafruit FONA 3G Module because of it’s reliability and ease of use with our
microcontroller.
5.3 Component Testing
Temperature Sensor
The temp sensor used allows for high accuracy readings down to the thousandth of a degree
It was important to have a reliably accurate sensor, but our application only uses temp to the tenth degree
Reliability is more important than highly accurate readings Using Adafruit tutorials and documentation provided on the sensor, testing the MCP9808
was fairly simple Adding a simple library in the Arduino code allowed us to use built in functions to
operate the sensor and read values in both Fahrenheit and Celsius
PIR Motion Sensor
19
The motion sensor used in Life-Sense utilizes infrared technology Detects if there is a discrepancy in the initial reading of the beam, if something with a
distinctly different heat signature moves within the scope of the sensor’s range, it triggers a high on the input to the MCU
The code uses an include of the PIR sensor’s pre-established Arduino library Testing the sensor individually was successful without much difficulty
Ultrasonic Sensor
The ultrasonic sensor used with Life-Sense is a classic PING sensor, although a different brand, it uses the same method to achieve a distance reading
Programmable by writing a series of HIGH and LOW outputs to the sensors with delays to account for the time it takes for the ultrasonic pulse to be sent out and bounce back to be read by the receiver of the sensor
A quick calculation on the reading yields a distance in centimeters
GPS Module
The GPS in Life-Sense was a difficult component to test and understand Even with help from tutorials and forums dedicated to the use of our module, several
problems with reading coordinates occurred Testing the module by itself as a standalone system was eventually achieved after much
research and a more thorough understanding of the code and functions of the Arduino GPS library
Eventually determined that in order to get a reliable and consistent signal for the GPS, an external antenna was needed rather than the internal patch antenna
The GPS module runs at a 9600 baud rate To initialize the GPS, the baud rate needs set, an update rate (chose 1 Hz), the type of
data to be extracted from the signal, and the check antenna status After initialization, the GPS waits for a fix and that data is used for Life-Sense’s
application
GSM Module
The final GSM module used in Life-Sense was the Adafruit FONA 3G Before the 3G module, a 2G module was used because of the lower cost After testing and many SIM cards with different cellular providers, it was determined that
the module was outdated and would not work with the system The upgrade to 3G took extra time and money, but it was necessary to resume progress
on Life-Sense The FONA within our algorithm uses a header file and a C++ file made for the module Life-Sense only uses a fraction of the vast amount of features the FONA has to offer
because it simply needs to send SMS messages from the module
20
Initialization for the hardware and software are set up for software serial communication between the Arduino UNO and the FONA
FONA runs at a 4800 baud rate and after a connection to the cellular network is established, the program continues to run until the FONA needs to be utilized
When the situation arises that Life-Sense needs to contact the driver or emergency contact, the FONA sends pre-made messages to the phone numbers saved in the program
5.4 System Testing After each component was tested successfully and individually, the software for each of
the components was put into one main program that would make up the entire software portion of Life-Sense
In the beginning, the temperature, PIR, and ultrasonic sensors all worked in tandem harmoniously
At this point, parameters were tested in the test chamber (which is supposed to emulate the environment inside a car) so that distance and range for motion were set for the prototype
When the code for the GPS and GSM modules was added, problems occurred with either of them
It was determined after much testing that the two modules were trying to run simultaneously at different baud rates within the program sequence
To fix this problem, the decision was made to run the GSM initialization to connect to the network before running the main loop of the algorithm
The GPS would attempt to achieve of fix of location after the GSM was initialized, and then run the remaining code
Together these two processes typically take 5-15 seconds, so it was not a significant amount of time to derail the process that Life-Sense goes through in order to safely identify a living thing inside the vehicle
Re-ordering the code this way allowed for each module to run at its respective baud rate without interfering with each other or the rest of the sensors
Our testing proved to show that our sensors worked with undeniable reliability over and over
Acquiring an external antenna for the GPS, the spotty connection issues within the test chamber were solved
A space heater provided a way to control the environment of the chamber and simulate a dangerous situation where Life-Sense could help
With this ability to identify a child or pet moving in the chamber, the system will alert the driver and the emergency contact accordingly depending on the outcome of the tests from the sensors
Although this all worked according to plan, the Arduino UNO that was used was limited in terms of dynamic memory
21
The ideal system would have more cases in which the driver or emergency contact would be alerted along with the appropriate messages and suggested courses of action along with it
In the end, because of memory limitations, Life-Sense is only able to do the minimum in terms of situations that will trigger different messages for the saved contacts in the system
5.5 Project Photographs
Figure 8: Life-Sense Front View Inside Chamber
22
Figure 9: Life-Sense Side View Inside Chamber
Figure 10: Inside Life-Sense Device
23
Figure 11: Test Run
24
Chapter 6
Project Impacts
6.1 Societal and Ethical ImpactsBeing able to detect if a child or pet has been left in a vehicle is something that lawmakers have
been trying to standardize for a few years. Life-Sense will be designed to prevent putting a small
child or pet in a dangerous situation. This is ethically positive and benefits any user of Life-
Sense. While Life-Sense wouldn’t be something that would be required in every vehicle, it
promotes the ideology that whoever would use it wants to keep their children and pets safe,
which is a socially progressive impact. In theory, Life-Sense could be a mass-produced product,
so designing an effective device while keeping the cost low is also substantial. When something
as important as the life of a living thing is being considered, the importance of the end product
working every time without bugs is substantial. The idea of this project is to prevent hearing a
news story about how someone lost their child in their hot car. That will be the greatest
achievement of this project.
25
Chapter 7
Concluding Remarks
7.1 Future ImprovementsThe Life-Sense safety system has been designed and built with many constraints in mind. Being
that we are a group of college students and working jobs only a limited number of hours per
week, having a strict budget was very important. Another constraint we had to take into
consideration was the amount of time we had to finish this project, from start to finish we had
around three months to complete it.
A future improvement for the system would for the device to become a standard feature in the
mass production of vehicles. For this to happen, there are some changes that would need to be
made to the system. As of now the Life-Sense must be powered with an external 5vdc power
supply, via USB cable. For this to be a completely standalone system, it would need to be
powered by a rechargeable 5vdc lithium-ion battery so the system would continue to run for a
certain amount of time after the vehicle was turned off. The system would be configured as a
plug and play device to use the vehicles 12vdc power supply to charge the battery while the
vehicle is running. Ultimately it would be ideal for the Life-Sense to be mounted in place of the
interior light, above the rear seats.
Increasing the accuracy of the Life-Sense detection system could be another area for
improvement. The addition of video imaging to the detection system would be a great future
improvement. This would be added to current array of sensors that are being used for detection.
Being able to use and send an image of the child would ensure the driver or emergency contact
that someone has been left in the car. Newer video imaging would allow the Life-Sense to use
facial recognition as well. The use video imaging would be able to increase the accuracy of the
device.
The use of an MCU with more memory allocated for variables would help the project as well.
The current device ran out of memory for local and global variables. Due to this issue, the device
26
cannot store any more alert messages. It would be beneficial to test and compare more readings
and warn the user of different cases. In the current state, there are two messages that are being
sent to the driver and emergency contact respectively. Choosing an MCU with increased memory
would allow for more direct messages base on various conditions that are being met, increasing
the quality of the device.
Safety devices using the advancement of technologies are becoming more and more prevalent in
today’s day in age. Life-Sense can be a crucial part in those advancements and help save the
lives of those who are important to us.
7.2 ConclusionLife-Sense is a device that will be able to detect if a living thing is left in a vehicle. Once a living
thing has been detected, the driver of the car will be notified to remind them to let the passenger
out. If there is no response by the driver, emergency contacts will be notified accordingly. This
technology will not only protect many children and pets from being overheated in the vehicle but
also prevent serious brain damage and possible death.
Life-Sense utilizes various sensors to detect if a living thing is in the vehicle. By using a PIR
motion detection sensor, this device is able to accurately detect if a child or pet has been left in
the vehicle. Once detected, the device will send a prewritten text message using a GSM module
to the driver to alert them about the passenger being left in the vehicle. If the device does not
receive a response, emergency contacts will be notified. This emergency message will include
the GPS coordinates of the vehicle’s location. Adding the GPS location will be important in
allowing the emergency contacts to precisely locate the vehicle.
27
References
[1]
Animals in Vehicles. (2016, January 1). Retrieved from www.vernonhills.org: https://www.vernonhills.org/634/Animals-in-Vehicles
[2] Global Positioning System. (2018, November 15). Retrieved from Wikipedia: https://en.wikipedia.org/wiki/Global_Positioning_System
[3] GSM. (2018, November 18). Retrieved from Wikipedia: https://en.wikipedia.org/wiki/GSM
[4] Passive infrared sensor. (2018, October 17). Retrieved from Wikipedia: https://en.wikipedia.org/wiki/Passive_infrared_sensor
[5] Davila, M., Lewis, G. and Porges, S. (2017). The PhysioCam: A Novel Non-Contact Sensor to Measure Heart Rate Variability in Clinical and Field Applications. NCBI. Available at: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5702637/.
[6] Chilton, A. (2018). The Working Principle and Key Applications of Infrared Sensors. AZoSensors.com. Available at: https://www.azosensors.com/article.aspx?ArticleID=339.
[7] Merchant, J. (2018). Infrared Temperature Measurement Theory and Application. https://www.omega.com/. Available at: https://www.omega.com/technical-learning/infrared-temperature-measurement-theory-application.html.
[8] Ada, L. (2018). How PIRs Work. [online] Learn.adafruit.com. Available at: https://learn.adafruit.com/pir-passive-infrared-proximity-motion-sensor/how-pirs-work.
[9] Alarm Grid. (2018). Do Wireless Motion Detectors Work Through Window Glass?. Available at: https://www.alarmgrid.com/faq/do-wireless-motion-detectors-go-through-glass.
[10] Ametherm. (2018). Temperature Sensors. Thermistors vs Thermocouples. Available at: https://www.ametherm.com/blog/thermistors/temperature-sensors-thermistors-vs-thermocouples.
[11] Gps.gov. GPS Accuracy. Available at: https://www.gps.gov/systems/gps/performance/accuracy/.
[12] Water.usgs.gov. (n.d.). U.S. Geological Survey - Global Positioning Application and Practice. Available at: https://water.usgs.gov/osw/gps/.
[13] McClain, S. (n.d.). What are the limitations of Bluetooth. Techwalla. Available at: https://www.techwalla.com/articles/what-are-the-limitations-of-bluetooth.
28
[14] Iplocation.net. (n.d.). How does ZigBee Work?. Available at: https://www.iplocation.net/zigbee.
[15] ElProCus - Electronic Projects for Engineering Students. (n.d.). What is GSM: Architecture and Working of GSM Module with Circuit. Available at: https://www.elprocus.com/gsm-architecture-features-working/.
[16] Null, J. (2016, April 26). Heastroke deaths of children in vehicles. Retrieved from www.noheatstroke.org: https://www.noheatstroke.org/original/
[17] Wisniewski, M. (2017, August 6). If a child is left in a hot car, the vehicle should alert you. Retrieved from Chicago Tribune: https://www.chicagotribune.com/news/columnists/wisniewski/ct-hot-car-danger-getting-around-0807-20170806-column.html
29
30
Appendix A: Hardware Schematic
Figure 12: Schematic
31
Appendix B: Life-Sense Arduino Code#include <Wire.h>#include "Adafruit_MCP9808.h"#include <Adafruit_GPS.h>#include <SoftwareSerial.h>#include "Adafruit_FONA.h"
#define FONA_RX 2 // recieve data pin on GSM#define FONA_TX 3 // transmit data pin on GSM#define FONA_RST 4 // reset pin on GSM
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX); // init GSM for software serial commSoftwareSerial *fonaSerial = &fonaSS; // pointer for serial to software serial
Adafruit_FONA_3G fona = Adafruit_FONA_3G(FONA_RST); // declares prototype for 3G FONA module
SoftwareSerial mySerial(12, 11); // inits GPS for software serial on pins 11 and 12Adafruit_GPS GPS(&mySerial); // prototype for GPS using serial comm
#define GPSECHO false // prevents echoing of GPS data to the serial interface
boolean usingInterrupt = false; // prevents the use of a built in interrupt within external file
float GPSlat; // variables to use with GSM that get equated to the lat and longfloat GPSlon; // values from the GPS coordinates
Adafruit_MCP9808 tempsensor = Adafruit_MCP9808(); // creates object for temp sensor
byte inputPin = 7; // choose the input pin (for PIR sensor)byte pirState = LOW; // we start, assuming no motion detectedbyte val = 0; // variable for reading the pin statusbyte jawn = 1; // test variable to separate execution of GSM from GPS
31
const byte trigPin = 9; // pin for echo pulseconst byte echoPin = 10; // pin to receive echo
long duration; // variables for time and distancebyte distance; // parameters on the PING sensor
byte child=0; // variable for whether or not a child/pet is presentbyte emergency = 0; // variable to determine if emergency contact needs alertedbyte flip = 13; // pin number for flip switchbyte bigflip = 0; // variable to test if the switch was flipped
void setup() { Serial.begin(115200); if (!tempsensor.begin(0x18)) { while (1); // inits and starts to run the temp sensor }
tempsensor.setResolution(1); // sets the resolution mode of reading tempsensor.wake(); // wakes up the sensor, stays awake as long as program runs
pinMode(inputPin, INPUT); // declare sensor as input
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output pinMode(echoPin, INPUT); // Sets the echoPin as an Input
pinMode(flip, INPUT); // sets the exit switch for an input
// 9600 NMEA is the default baud rate for Adafruit MTK GPS GPS.begin(9600); //"minimum recommended" data GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCONLY); // Set the update rate GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ); // 1 Hz update rate // Ask for firmware version mySerial.println(PMTK_Q_RELEASE);
}
32
void loop() { while(GPS.fix == 0) // runs the code to achieve a fix before running GSM{ if (! usingInterrupt) { // read data from the GPS in the 'main loop' char c = GPS.read(); } // if a sentence is received, we can check the checksum, parse it... if (GPS.newNMEAreceived()) { if (!GPS.parse(GPS.lastNMEA())) // this also sets the newNMEAreceived() flag to false return; // we can fail to parse a sentence in which case we should just wait for another }}
while(jawn < 2) // waits for the GSM to establish network connection before exiting { fonaSerial->begin(4800); // begins to run the GSM module if (! fona.begin(*fonaSerial)) // runs setup and init to gain a connection { while (1); } jawn+=5; // terminates loop }
// Read the temperature int f = tempsensor.readTempF(); // reads the temp in environment
val = digitalRead(inputPin); // read input value if (val == HIGH) { // check if the input is HIGH if (pirState == LOW) { // we have just turned on pirState = HIGH; } } else { if (pirState == HIGH){ // we have just turned off pirState = LOW; }
33
}
digitalWrite(trigPin, LOW); // Clears the trigPin delayMicroseconds(2); // Sets the trigPin on HIGH state for 10 micro seconds digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); // Reads the echoPin, returns the sound wave travel time in microseconds duration = pulseIn(echoPin, HIGH); distance= duration*0.034/2; // Calculating the distance
GPSlat = GPS.latitudeDegrees; // sets the GPS coordinates from the external C++ GPSlon = GPS.longitudeDegrees; // file to program local variables
if (distance <= 100 && pirState == HIGH) { child = 1; // if distance and motion are both triggered, child/pet is in car }
/* * the following lines of code establish a phone number for the primary driver * of the vehicle as well as a pre-written message to send to the driver in the * case that they leave their child in the car. A string is converted into a character * array which is needed to pass to the GSM function call. */ char sendto1[] = "8147950839"; String msg2 = "Child left in car. Return to vehicle immediatley and flip switch."; char message2[66]; msg2.toCharArray(message2,66);
switch(child) //switch case for different circumstances of the system { case 0: // in this case, there is no child, break case and rerun sensor tests emergency = 0; break;
case 1: // in this case, child is present, alert the driver fona.sendSMS(sendto1, message2);
34
emergency = 1; // set emergency test to trigger break; } if(emergency == 1) // determines if emergency contact will need alerted { delay(35000); while(1) // gives driver 35 seconds(arbitrary) to acknowledge and reset switch { bigflip = digitalRead(flip); // tests if driver flipped switch f = tempsensor.readTempF(); // rereads temp to see if it is fatal if(bigflip == LOW && f > 80) // if temp is dangerous and driver hasn't flipped switch { /* * declare the phone number of the emergency contact and compile the * pre-written message into one large string and convert it to a char * array. Next, send the message containing a warning as well as the temp * and GPS coordinates of the vehicle to emergency contact. */ char sendto2[] = "8147069500"; const String msg3 = "Child left in car at lat. "; const String msg4 = ", long. "; const String msg5 = ", it is "; const String msg6 = " degrees."; const String copy3 = msg3+GPSlat+msg4+GPSlon+msg5+f+msg6; char message3[65]; copy3.toCharArray(message3,65); fona.sendSMS(sendto2, message3); exit(0); } if(bigflip == HIGH) // if driver flipped switch and took the child, exit { exit(0); } } } child = 0; // makes sure that the child not present variable is set before looping }
35