Professional Documents
Culture Documents
By:
Jian Gao
Luis Pabon
Abstract
The goal of this project is to develop a portable battery powered system that could detect and alert of
the presence of a child in a hot car. This is achieved by monitoring the ambient temperature, sound,
motion, and carbon dioxide concentration. This project explores the reliability of integrating an IC
temperature sensor, an electret condenser microphone, an ultrasonic sensor, and a carbon dioxide
sensor into this baby detection system. The results reveal that monitoring the environment by using an
IC temperature sensor and carbon dioxide sensor is an easily achieved by using a low power Microchip
PIC microcontroller. In contrast, monitoring with an ultrasonic sensor and microphone is a challenging
task that would require computationally intensive algorithms and more processing power.
Contents
1. Introduction .............................................................................................................................................. 5
1.1 Objectives............................................................................................................................................ 5
1.1.1 Goals............................................................................................................................................. 5
1.1.2 Functions ...................................................................................................................................... 5
1.1.3 Features ....................................................................................................................................... 5
2. Design........................................................................................................................................................ 6
2.1 Block Diagram ..................................................................................................................................... 6
2.2 Block Descriptions ............................................................................................................................... 7
2.2.1 Microcontroller ............................................................................................................................ 7
2.2.2 Motion Sensor .............................................................................................................................. 7
2.2.3 Microphone Circuit ...................................................................................................................... 7
2.2.4 Voice Filter ................................................................................................................................... 8
2.2.5 Carbon Dioxide Sensor ................................................................................................................. 9
2.2.6 Temperature Sensor .................................................................................................................... 9
2.2.7 Sleep Switch ............................................................................................................................... 10
2.2.8 Alarm .......................................................................................................................................... 10
2.2.9 Power Supply ............................................................................................................................. 11
2.3 Simulations........................................................................................................................................ 11
2.3.1 Voice Filter ................................................................................................................................. 11
2.4 Flowchart .......................................................................................................................................... 13
3. Design Verification .................................................................................................................................. 14
3.1 Microcontroller ................................................................................................................................. 14
3.2 Motion Sensor................................................................................................................................... 14
3.3 Microphone Circuit ........................................................................................................................... 15
3.4 Voice Filter ........................................................................................................................................ 15
3.5 Carbon Dioxide Sensor ...................................................................................................................... 16
3.6 Temperature Sensor ......................................................................................................................... 17
3.7 Sleep Switch ...................................................................................................................................... 18
3.8 Alarm ................................................................................................................................................. 18
3.9 Power Supply .................................................................................................................................... 18
4. Costs ........................................................................................................................................................ 19
3
Appendix B
Abbreviations ...................................................................................................................... 26
Appendix C
1. Introduction
There have been a number of incidents where babies are forgotten in a car by their parents. During a
hot summer day and in direct sunlight, a cars interior temperature can reach as high as 150 F. Within
minutes, a car can become a hot furnace exposing the child to life-threatening conditions. For these
reasons, we are designing a device that warns nearby pedestrians if a child is trapped inside a hot car.
1.1 Objectives
1.1.1 Goals
The goal of this project is to design a portable battery powered device that can reliably detect a child in
a hot car. This device must be able to detect the presence of a child through their motion and sounds.
In the case that the child is not moving or crying, the device will detect the presence of a child by
detecting their breathing.
1.1.2 Functions
The device will monitor the car using several sensors. The device will use a temperature sensor, a
motion sensor, a sound detector, and a carbon dioxide sensor. The device will be in sleep mode if the
temperature is below a certain threshold. If that threshold is reached, the device will exit sleep mode
and start monitoring its surroundings. Then, if motion, sound, or a rise in carbon dioxide level is
detected, the device alarm will be triggered. However, there will be a 10 seconds beeping warning
before the alarm is activated. This allows an adult to disable the alarm for 10 seconds in case the adult
triggered the alarm by accident.
1.1.3 Features
Small size (4 x 3.2 in)
Compact - all sensors are contained within a single circuit board
Easy to install and independent of car seat
Battery powered ( 4 x AA batteries)
A loud buzzer with warning and alarm modes
Power savings mode results in 14 times reduction in power consumption
Ultrasonic motion sensing for accurate detection
o Unaffected by heat and external movements
Voice filtering to reduce false alarms
Accurate breathing detection by measuring carbon dioxide levels
A sleep button to stop false alarms
2. Design
This model is the HC-SR04 [5]. In order for this particular model to work, the microcontroller will first
generate a 10 uS pulse to the sensors TRIG port. The sensor senses the distance of an obstacle and
return its distance through the sensors ECHO port. The distance, D (given in cm), is proportional to
the pulse width,
(given in us) of the ECHO signal. The formula is given by equation 1 [5].
The pulse width is then given by equation 2.
and
results in a gain of
The second stage has the same form as the first but with the capacitors set to
function is given in equation 6.
. This transfer
The output voltage of the carbon dioxide sensor if given by equation 8 [7] is:
Where Ec is a constant volume, R is the ideal gas constant, F is Faradays constant, P is the carbon
dioxide partial pressure, and T is the ambient temperature in Kelvin.
Assuming that for a small time interval
pressure:
From this we can see that for increasing carbon dioxide concentrations,
will be a negative number.
Which suggest the negative relationship between the carbon dioxide level and the sensors output
voltage.
2.2.6 Temperature Sensor
The temperature sensor outputs a voltage in relationship to the current temperature as shown in
equation 10. This voltage is compared against a reference voltage of 901 mV, corresponding to 27. If
the measured temperature voltage is higher than the reference voltage, the voltage comparator will
signal the microcontroller to start monitoring all the sensors.
The TI LM62 IC temperature circuit outputs a voltage proportional to the temperature and is given by
equation 10 [8].
10
2.3 Simulations
2.3.1 Voice Filter
The purpose of the microphone circuit is to detect the presence of a child in a hot car by using sound.
While the sound amplitude may be indicative of how close the sound source is, it may fail to identify the
closest source under certain circumstances. For example, an ambulance siren nearby might exceed the
max amplitude thresholds defined for the childs voice. The motivation for using a band pass filter for cry
detection comes from the fact that human speech has a frequency band from about 300 Hz to 3 KHz [1].
Therefore, a band pass filter should help reduce some false positives by excluding sounds with energy
outside of this range. In this project, the human frequency range is used as a starting point for our band
pass region. The cutoffs are then varied order to try to minimize the number of false fails from a
database of baby cry and ambient noise sound files. Figure 10 below shows that most of the energy of a
baby cry does fall within the 300 Hz to 3 KHz band.
Figure 10. The figure above shows the frequency spectrum for two different baby cry patterns. Overall, they follow a similar
pattern. Most of the energy is contained in 300 Hz to 3 KHz.
11
The lower and upper 3dB cutoffs were varied and the filter was applied to the database of sounds. For
all of the simulations the, the sounds were normalized to have the same max amplitude. The cutoffs that
minimized the number of false positives were experimentally determined to be 517 Hz for the lower
cutoff and 1.358 kHz for the higher cutoff. Figure 11 and Figure 12 show the time domain filter output
for two different crying inputs. These two simulations show that for both of these cases. There exists a
time where the amplitude exceeds 0.8 V. In contrast, Figure 13 shows that applying the filter to the
sound
loud
rain
results
in
an
output
that
does
not
exceed
0.4
V.
Figure 11. Output of analog filter when the input is a baby cry waveform
Figure 12. Output of the analog filter when the input is a second baby cry waveform
Figure 13. Output of the analog filter when the input is a loud rain waveform
12
Figure 14. The simulated frequency response of the analog band-pass filter
The frequency response of the optimal filter was simulated in MATLABs Simulink. The active analog
band-pass filter was designed to match the simulated frequency response.
2.4 Flowchart
Shown in Figure 15 is a simplified flowchart that demonstrates the firmware embedded in the
microcontroller. The device will stays in the SET_ALARM_OFF state if the temperature is less than
27. If the temperature is above the threshold, the device will enters the loop of checking the carbon
dioxide, sound, and motion sensors. When a sensor triggers the alarm, the device will enter the
ALARM_ON state. It stays in that state as long as the sleep switch is not pressed. When the sleep
button is pressed, all the sensors and alarm will be temporarily turned off for 10 seconds. After that, the
logic flows back to the SET_ALARM_OFF state and checks the temperature again afterward.
13
3. Design Verification
3.1 Microcontroller
Microchips PIC24FV16KA301 microcontroller satisfied all of the functionalities required in this project. It
offers enough input/output ports to communicate with all the peripheral components. Its 12-bits
analog-to-digital converter has enough resolution to digitize the signals from the microphone and
carbon dioxide sensor. It has enough external interrupt ports for the temperature comparator and sleep
switch to trigger the microcontroller. Its 16-bits (expandable to 32-bits) timers offer great flexibility to
generate periodic firmware interrupts. The microcontroller also consumes very little power, so little that
its current consumption during run mode is just 8 uA.
Figure 16. The ultrasonic sensors TRIG (green) and ECHO (Yellow) signals in one detection cycle
14
15
Figure 20. Increase in carbon dioxide level (voltage decreasing) Figure 21. Decrease in carbon dioxide level (voltage increasing)
16
The yellow channel in figure 22 shows the output rising from 900 mV when the temperature sensor is
touched. The green channel in figure 22 shows the rising edge of the comparator once the 901 mV
threshold is exceeded. Hence, verifying the functionality of the temperature circuit.
17
3.8 Alarm
The buzzer alarms only requirement is its loudness. According to the data sheet of the model used in
this device, the minimum sound pressure level at 10 cm away is 85dB. This has been tested using a
smartphones built-in app. The smartphones microphone was sitting 10cm away from the buzzer alarm
while it is on. The measured sound pressure level is 91dB. It matches with the data sheet and meets our
requirement.
18
4. Costs
4.1 Parts
Table 1 Cost of parts
Part Name
Part Number
Price / Unit
Quantity
Ultrasonic Sensor
HC-SR04
$2.95
Microphone
SPM0406HE3H-SB
$2.01
MG-811
$65.00
Temperature Sensor
LM62BIM3
$1.13
Alarm
PB-12N32MP-05AQ
$2.67
Button Switch
PTS645SK43SMTR92 LFS
$0.25
Slide Switch
JS202011SCQN
$0.44
Microcontroller
PIC24FV16KA301-I/SS
$3.07
MOSFET
DMG1012T
$0.31
Voltage Regulator
MCP6561
$0.90
Operational-amplifier IC
NJM2710V-TE1
$2.58
AA batteries
ENERGIZER E91
$5.99
4.2 Labors
Table 2 Cost of labors
Name
Hourly Rate
Total
Jian Gao
$30
150
$11250
Luis Pabon
$30
150
$11250
Total
Labor
$22500.00
Parts
$89.99
Total
$22589.99
19
5. Conclusion
5.1 Accomplishments
This has been a rewarding project because it gives us hands-on experience to work through the process
of product design engineering. From brainstorming to project proposal, from design review to the first
prototype, from project demonstration to the final presentation, our biggest accomplishment is to build
a device that actually works. Not to mention it is a life-saving device.
Project wise, we had accomplished to interface all the sensors to the microcontroller and worked
together to troubleshoot most of the hardware problems. The software is also working smoothly, with
defined state machines and predictable software interrupts, all the sensors are able to work together
without conflicts. The software was also designed to minimize unnecessary power consumption as well.
5.2 Uncertainties
Out of the three detection sensors, it is just the carbon dioxide sensor that performances the best.
Although the ultrasonic sensor works best in a hot cars interior, it turns out to be not very reliable. This
shortcoming is due to the fundamental physics of ultrasound. Because sounds bounce on solid surfaces,
uneven surfaces, such as the cars interior, might cause the sensor to generate false alarms.
The sound detection system in the Baby Detector device also has its flaws. Even with the analog bandpass voice filter integrated into the device, any source of sound within frequencies inside pass-band can
pass through, regardless if it is the babys voice or not. This can also results in unpredictable false alarms
to occur.
The battery life of the device is also a concern. Currently, the carbon dioxide sensor consumes the most
power. However, the battery life can be improved by using a more energy efficient carbon dioxide
sensor and by optimizing the circuits to reduce power. The ultimate goal is for the car manufacturers to
fully integrate this device into their cars, so battery life is no longer a concern.
The last uncertainty of this device is the effectiveness of the alarm. As of now, the buzzer alarm is the
only way to alert people if a baby is in danger. If no one can hear the buzzer alarm, the baby cannot be
saved. An upgrade to the alarm system is needed, such as integrating it to the cars horn, or adding the
GSM feature to the device to alert the parents through text messages.
20
Our circuit utilizes custom design circuits, such as the voice filter, for the purpose of minimizing costs
while improving detection. We will disclose all simulation and test results to be consistent with the
second code of the IEEE Code of Ethics [3].
2) To be honest and realistic in stating claims or estimates based on available data
Our system features several custom designed circuits and methods that to our knowledge, have not
been implemented before. We will continue to improve and document our methods to improve the
understanding of the technology as stated by the fifth code of the IEEE Code of Ethics [3].
5) To improve the understanding of technology its appropriate application, and potential
consequences
The life of a child could potentially depend on this device. Therefore, we will continue to seek
constructive advice to further perfect our system. This follows from the seventh and eighth codes of
the IEEE Code of Ethics [3].
7) To seek, accept, and offer honest criticism of technical work, to acknowledge and correct
errors, and to credit properly the contributions of others
8) To avoid injuring others, their property, reputation, or employment by false or malicious
action
References
[1] Behzad, Munir. Voice Fundamentals Human Speech Frequency, uoverip, *online+ 2012,
http://www.uoverip.com/voice-fundamentals-human-speech-frequency, (Accessed: 20 September
2014)
[2] Filter Wizard | Analog Devices, Analog Devices" [online] 2014, http://www.analog.com/
designtools/en/filterwizard/#/type (Accessed: 20 September 2014).
[3] IEEE Code of Ethics, IEEE [Online]. Available: http://www.ieee.org/about/corporate/governance/
p7-8.html (Accessed: 20 September 2014).
[4] PIC24FV32KA304, Microchip, 2013. [Online] Available: http://ww1.microchip.com/downloads/
en/DeviceDoc/39995d.pdf
[5] SR04, ElecFreaks. [Online] Available: http://users.ece.utexas.edu/~valvano/Datasheets/HCSR04b
.pdf
[6] SPM0406HE3H-SB, Rev. E, Knowles Electronics, 2013. [Online] Available: http://media.digikey.co
m/pdf/Data%20Sheets/Knowles%20Acoustics%20PDFs/SPM0406HE3HSB.pdf
[7] MG811 Sensor, Rev. 1, Futurlec,New York, NY, 2012. [Online] Available: https://www.futurlec.
com/CO2_Sensor.shtml
[8] LM62, Rev. E, Texas Instruments, Dallas, TX, 2013. [Online] Available: http://www.ti.com/lit/ds/
symlink/lm62.pdf
[9] PB-12N32MP-05AQ, Rev. A, Mallory Sonalert Products Inc, Indianapolis, IN. [Online] Available:
http://www.mallory-sonalert.com/specifications/PB-12N32MP-05AQ.pdf
22
Requirement
Microcontroller Requirements
1. Internal ADC module should have the
sampling Nyquist sampling rate of at
least 40 KHz
2. The
microcontroller can output
several pulses:
a. at 10% and 50% duty cycle
b. at 1 s and 2 s periods
Passed?
(Y or N)
Verification
1. Use function generator to slowly sweep
the ADC input with a sinusoid with
frequencies from 0 to 20 KHz.
2. Heat up the temperature sensor and
trigger one of the sensors, in order to
activate the alarm:
a. Listen for a warning alarm with a 1 s
period and 10% duty cycle
b. Listen for an alert alarm with a 2 s period
and a 50% duty cycle
3. Use a multimeter to verify that the
microcontroller output to sensor power
switches circuit has a logic low of < 0.7V
4. Use a multimeter to verify that the
microcontroller output to sensor power
switches circuit has a logic high of > 3 V
6. Setup microcontroller to
constant 5 V for at least 1 (s)
23
output
24
25
Appendix B Abbreviations
Table 5 Abbreviations explained
Abbreviation
Full Name
in
inch
ft
feet
cm
centimeter
second
us
microseconds
Hz
Hertz
ampere
mA
Milli-ampere
volt
mV
millivolt
CO2
carbon dioxide
dB
decibel
ADC
analog-to-digital
PIR
IC
integrated circuit
FFT
MOSFET
op-amp
operational amplifier
26
27