Download Smart Alarm Clock

Document related concepts

Phase-locked loop wikipedia , lookup

Crossbar switch wikipedia , lookup

Surge protector wikipedia , lookup

Index of electronics articles wikipedia , lookup

CMOS wikipedia , lookup

Flip-flop (electronics) wikipedia , lookup

Time-to-digital converter wikipedia , lookup

Remote control wikipedia , lookup

Integrating ADC wikipedia , lookup

Power MOSFET wikipedia , lookup

Transistor–transistor logic wikipedia , lookup

Operational amplifier wikipedia , lookup

Two-port network wikipedia , lookup

Radio transmitter design wikipedia , lookup

Power electronics wikipedia , lookup

Electrical ballast wikipedia , lookup

Resistive opto-isolator wikipedia , lookup

Valve audio amplifier technical specification wikipedia , lookup

Schmitt trigger wikipedia , lookup

Valve RF amplifier wikipedia , lookup

Charlieplexing wikipedia , lookup

Current mirror wikipedia , lookup

Switched-mode power supply wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Rectiverter wikipedia , lookup

Opto-isolator wikipedia , lookup

Transcript
Smart Sensory Alarm Clock
Project Design Report
Design Team #7
Brad Morse
Karl Pilz
Josh Runtas
Dr. Nathan Ida
December 4, 2006
Table of Contents
Table of Contents ............................................................................................................... i
List of Figures.................................................................................................................... ii
List of Tables .................................................................................................................... iii
List of Pseudo Code ......................................................................................................... iii
Abstract.............................................................................................................................. 1
Key Design Features:...................................................................................................... 1
Introduction....................................................................................................................... 2
Statement of Need........................................................................................................... 2
Problem Definition: ...................................................................................................... 2
Goal............................................................................................................................. 2
Objectives ................................................................................................................... 2
Constraints .................................................................................................................. 3
Design Requirements .................................................................................................... 4
Hardware Design ............................................................................................................ 10
Keypad .......................................................................................................................... 13
Infrared Temperature Sensor...................................................................................... 17
Force Sensing Resistors (FSR’s)................................................................................. 21
Snooze (Shocking) Button ........................................................................................... 26
Water Squirting Mechanism........................................................................................ 30
Wireless Remote Kill Switch ........................................................................................ 32
Piezoelectric Buzzer ..................................................................................................... 35
Lighting Control........................................................................................................... 37
Coffee Maker................................................................................................................ 41
Supply Power................................................................................................................ 43
Graphic Liquid Crystal Display and Controller ......................................................... 44
Software Design............................................................................................................... 46
Testing Procedures.......................................................................................................... 50
Keypad .......................................................................................................................... 50
Infrared Temperature Sensor...................................................................................... 51
Force Sensing Resistors............................................................................................... 51
Snooze Button .............................................................................................................. 51
Water Squirting Mechanism........................................................................................ 52
Wireless Remote Kill Switch ........................................................................................ 52
Piezoelectric Buzzer ..................................................................................................... 53
Lighting Control........................................................................................................... 53
Coffee Maker................................................................................................................ 54
LCD............................................................................................................................... 54
Financial Budget ............................................................................................................. 55
Project Schedule.............................................................................................................. 57
Design Team Information .............................................................................................. 60
Conclusions and Recommendations.............................................................................. 61
References........................................................................................................................ 62
Appendices....................................................................................................................... 63
i
List of Figures
Figure 1 – Block Diagram................................................................................................. 10
Figure 2 – Flow Chart ....................................................................................................... 11
Figure 3 – Overall System Pspice Circuit Schematic ....................................................... 12
Figure 4 – Keypad Schematic ........................................................................................... 14
Figure 5 – Thermal Sensing Physical Setup ..................................................................... 18
Figure 6 – Metris TN9 ...................................................................................................... 19
Figure 7 – Force Sensing Resistor .................................................................................... 21
Figure 8 – Force Sensing Resistor Physical Setup............................................................ 22
Figure 9 – FSR Force vs. Resistance graph ...................................................................... 23
Figure 10 – FSR Pspice Schematic................................................................................... 24
Figure 11 – FSR Pspice Testing Schematic...................................................................... 25
Figure 12 – Shocking Snooze Button Physical Setup....................................................... 26
Figure 13 – Voltage Divider Calculation.......................................................................... 27
Figure 14 – Shocking Snooze Button Pspice Schematic .................................................. 27
Figure 15 – Water Squirting Mechanism Physical Setup ................................................. 30
Figure 16 – Water Squirting Mechanism Pspice Schematic............................................. 31
Figure 17 – DC Motor Physical Setup.............................................................................. 31
Figure 18 – Wireless Remote Kill Switch Transmitter Pspice Schematic........................ 32
Figure 19 – Wireless Kill Switch Receiver Pspice Schematic ......................................... 33
Figure 20 – Piezoelectric Buzzer and Lighting Control ................................................... 38
Figure 21 – Coffee Maker Pspice Schematic.................................................................... 41
Figure 22 – Graphic LCD Display.................................................................................... 44
Figure 23 – Toshiba T6963C Display Controller Pin Assignments ................................. 45
Figure 24 – Alarm Initialization Flow Chart .................................................................... 49
Figure 25 – Implementation Gantt Chart Breakdown....................................................... 58
Figure 26 – Implementation Gantt Chart Timeline........................................................... 59
ii
List of Tables
Table 1 – Digital Inputs to Microcontroller from Keypad................................................ 15
Table 2 – Estimated Labor Cost........................................................................................ 55
Table 3 – Material Budget Sheet ...................................................................................... 56
Table 4 – Design Team Information................................................................................. 60
List of Pseudo Code
Pseudo Code 1 - Keypad................................................................................................... 16
Pseudo Code 2 – Thermal Sensing ................................................................................... 20
Pseudo Code 3 – Force Sensing Resistor.......................................................................... 25
Pseudo Code 4 – Shocking Snooze Button....................................................................... 29
Pseudo Code 5 – Water Squirting Mechanism ................................................................. 31
Pseudo Code 6 – Wireless Remote Kill Switch................................................................ 34
Pseudo Code 7 – Piezoelectric Buzzer.............................................................................. 36
Pseudo Code 8 – Lighting Control.................................................................................... 40
Pseudo Code 9 – Coffee Maker ........................................................................................ 42
Pseudo Code 10 – PIC Pseudo Code for Initializing Alarm............................................. 48
iii
Abstract
The Smart Sensory Alarm clock stimulates the majority of the human senses to
provide superior reliability in ensuring timely awakening. By gently tantalizing the user
to arise with a simple coffee aroma, then low intensity alerts, heavy sleepers are given
ample opportunities to gradually get out of bed. However if these polite gestures are
ignored, extremely swaying measures will follow to promise success.
Key Design Features:
•
Microprocessor controlled time and alarm keeping
•
Keypad time and alarm input
•
LCD display of time
•
Three progressive alarm stages with variable light and sound
•
Thermal and weight monitoring of human presence in bed
•
Standard snooze button for alarm stage 1 and 2 disable
•
Shocking snooze button upon alarm stage 3, without alarm disable
•
Water squirting mechanism upon alarm stage 3
•
Wireless alarm disconnect switch
•
Unit includes 120V AC plugs for lamp and coffee maker
•
Coffee maker initialization prior to first alarm stage
1
Introduction
Statement of Need
Current alarm clocks are inadequate due to the fact that they are too simple to
disarm and use ineffective and out-dated audible stimulation methods to awake the user.
A more effective device is needed to be designed that will progressively ease the
customer from a deep slumber to a refreshing consciousness.
Problem Definition:
Goal
•
To design an alarm clock that gradually awakens the customer using lights,
sounds and aromas to entice the user to get out of bed before more violent and
persuasive measures are taken.
Objectives
•
Interact with thermal and weight sensors to monitor the bed’s occupancy,
ensuring that the alarm will remain on if a user is still in bed.
•
The system will include three alarm stages that progress from gentle and soothing
-- using fresh coffee aromas and two chances to snooze, to forceful -- using a
shocking snooze button, facial contact from a water squirting mechanism, as well
as intensifying lights and sounds.
•
Easily interact with exiting simple off-the-shelf lamps and coffee makers through
the use of 120V outlets.
2
•
Incorporate a wireless alarm disconnect switch located in a distant location,
ensuring the occupant has to exit the bed.
•
Integrate an easy to use keypad for user alarm and time entry.
Constraints
•
Operate off of a 120V A/C and 9V battery backup.
•
Adhere to wireless range and power consumption of alarm disconnect switch.
•
Accurately and quickly detect if an individual has exited the bed.
•
Entire unit shall fit neatly on any standard nightstand.
3
Design Requirements
Thermal sensor
•
The thermal sensor needs to accurately detect the presence of body
heat (98.6 degrees F) from a distance of 1 to 10 feet.
•
The operating temperature range is between approximately 60 degrees
Fahrenheit and 110 degrees Fahrenheit.
•
The sensor needs to interface with 5 volts D/C and draw minimal
current, roughly 25mA.
•
The speed of detection response must be faster than 3-5 seconds.
•
The accuracy must be at least -+5%.
•
The sensor must minimize I/O pins on the PIC18F452.
Pressure Sensors
•
The pressure sensors must support up to 400 pounds in order to
accommodate the weight of the bed as well as multiple individuals.
•
The sensors must be able to detect a range of pressure up to 100
pounds.
•
The sensors must be flat and durable to install between the bed frame
and box spring.
•
The sensors need to interface with 5 volts D/C and draw minimal
current, roughly 25mA.
•
The sensors must minimize I/O pins on the PIC18F452.
4
LCD Display
•
The display needs to be easy-to-read and display the time in standard
AM/PM format.
•
The display should also display if the alarm has been set.
•
A minimum size display should be 2 inches tall by 5 inches wide.
Keypad Input
•
The unit must include 0 through 9 buttons as well as the following
separate buttons: Alarm Set, Time Set, Enter, AM/PM and Cancel.
•
The keypad must minimize input pins on the PIC18F452.
External Lamp
•
Any standard off-the-shelf desk lamp with 120VAC power input.
•
Should be relatively small to fit on nightstand.
•
A minimum current draw is desired to be less than 2A, and 100W
bulb.
Coffee Maker
•
Any standard off-the-shelf coffee maker with 120VAC power input.
•
Should be relatively small to fit on nightstand.
•
A minimum current draw is desired to be less than 8A.
Microcontroller
•
The central microcontroller needs must include at least 30 I/O pins and
2 analog-to-digital converters.
•
The system only needs limited memory to store whether the alarm is
set as well as the time the alarm is set for.
5
Power Input and Battery Backup
•
The battery backup must be able to power the microcontroller, the
LCD display, the buzzer and the input keypad for 48 hours.
•
The power electronics must be able to provide 3 separate voltage
outputs; 1 5V DC supply to the microcontroller and 2 120V AC
outputs to supply power to the external lamp and coffee maker.
Wireless Disconnect Button
•
Desired range of operation is approximately 10-50 feet.
•
Simple FM frequency can be used with encoding and decoding of a
single bit transmitted signal.
•
Transmitter needs to be battery powered for remote installations.
Snooze Button
•
Standard snooze button operation is required for first 2 stages.
•
Electric shock circuit is applied to snooze button upon alarm stage 3
activation.
•
After alarm stage 3, snooze button will not affect alarm peripherals.
Water Squirting Mechanism
•
Operates by DC motor compressing plunger into squirt gun.
•
Must run off 5V DC.
Overall Size Requirements
•
The complete system should fit comfortably on a 2 feet wide by 2 feet
long nightstand, including the coffee maker, lamp, and alarm.
6
•
The footprint of the alarm should be approximately 8 inches wide by 8
inches long, and the components should be enclosed in a box. Height
should be less than 12 inches tall.
7
Alternative Design Analysis
The original notion of design was to build off of an existing alarm clock and its
architecture. This would have been accomplished by utilizing the existing
microcontroller along with new microcontroller. On the other hand, this was understood
to take too long testing and understanding. Custom programming and a full
understanding of a completely new microcontroller will give more freedom in design.
The option of hardwiring the lamp directly to the alarm clock would give the
added benefit of a simple compact unit with fewer wires. Instead, the though of being
able to use your own favorite lamp or light source will reduce customer cost, and increase
range of use. Similarly, remotely operated mechanical push-button switches to turn on
and off various home equipment such as stereo, coffee makers, and light switches were
considered. It seems incorporating more mechanical design and wireless components
proved to be too time consuming and complex.
The choice of using the existing style input buttons for programming time and
alarm settings was ruled out as well. This method for programming alarm and time is
tedious, and one mistake means having to cycle through the whole 24 hour or 60 minute
cycle again. Using a keypad allows direct time input, am/pm selection, and a cancel
button to erase errors and start over. Using a typical LED display versus a LCD display
was quickly done away with, due to the fact that we may want to display custom
8
messages, and possibly pictures. Although a standard LED is cheaper and easier to
program, a LCD will allow for more flexibility and up the style factor of the final design.
For input sensors monitoring the bed, using a compression load cell as a
force/weight sensor was considered. Load cells found were mainly for industrial use and
are quite expensive. Finding one that was right for our use exceeded $500, more than
double out budget, just on one part. Motion sensors (beam type sensors that are activated
when the beam’s path is disturbed) were also thought about to be set up along the horizon
of the bed. While a body is present, the beams will be broken. Beams connecting will
show body has exited. This idea was shot down because it was redundant with the other
sensors we have chosen. Also, what if there are more than one body in bed and only one
has to get up? This obviously will not work.
Wireless temperature and weight sensors made the list of possible additions, and
wireless sensors would be a nice touch to the system’s overall design, but for prototypical
uses, wired sensors will be less complex and give the same result. Also, a microphone to
record custom wake up messages was spoken of. However, it was deemed not important
for awakening person, but a nice convenience for finished product
9
Hardware Design
System Overview
The Smart Sensory Alarm Clock utilizes a myriad of peripheral devices, all
coming together to produce a superior automated wake up design. Each of the hardware
components is centrally incorporated into a PIC18F452 microcontroller where software
then takes over to control operations. Upon completion, the system will be compact,
sleek, and contain a multitude of functionality. See the Figure 1 for a visual
representation of the block diagram. Figure 2 represents the logical flow of alarm stages
associated with the clock. Figure 3 shows a rough estimate of the final circuit schematic.
Figure 1 – Block Diagram
10
Figure 2 – Flow Chart
11
Figure 3 – Overall System Pspice Circuit Schematic
12
Keypad
Using a keypad for programming the time keeper of the clock as well as the alarm
time setting is fundamental in an alarm clock. Transferring data from the user into the
microcontroller is step number one in using this device, thus the keypad plays a crucial
role. The keypad is to a be 4 row x 4 column (16 key) matrix keypad, GH5015-ND made
by Grayhill. An associated keypad encoder, the EDE1144 from E-Lab Digital
Engineering will multiplex the 8-bit (8-wire) digital signal down to a 4-bit (4-wire)
digital input signal to the microcontroller. The encoder is also beneficial because it
provides contact debouncing and reduced EMI noise by monitoring the keypad with
unchanging signals, then only scanning when a key is pressed.
The entire key press detection cycle takes 50mS. Once a key is pressed, any
additional bounces, or of any other contacts are ignored for 50mS, during which several
signals are output by the EDE1144. The parallel outputs D0 - D3 (Pins 6-9) are latched
with the appropriate key press value. One microsecond later, the Data Valid Output (Pin
17) goes low, indicating that there is valid data on the parallel output pins. Pins 6-9 are
connected to the keypad rows through 330 Ohm resistors to prevent a shorts during the
scan cycle if more than one key is being held at a time. The 4.7K Ohm resistors on pins
10-13 are pull downs to prevent the EDE1144 column inputs from floating or oscillating.
See Figure 4 Keypad Schematic for more detail.
13
Figure 4 – Keypad Schematic
To read data from the EDE1144 in a parallel format the microcontroller will input
from the four data inputs D0, D1, D2, & D3, which also serve as the row drive signal pins
R0, R1, R2, & R3. While the EDE1144 is waiting for a key press, it will hold these lines
at 1111. Once a key is pressed, the data output pins will toggle while the keypad is
scanned so that the EDE1144 can determine which key was pressed. Then, the
appropriate data value corresponding to the correct key pressed will be output onto the
data outputs and the Data Valid pin will go low. This pin will stay low for 50 mS, during
which the Data Output pins will hold the key press data. The key press data will be
sampled during this 50mS window. Since the inputs from the keypad are all digital, no
A/D conversion is necessary, and the expected data input pins on the PIC18F452 are to
be RB4, RB5, RB6, RB7, and RC0 for data validate. The necessary buttons to be
implemented will be the digits 0-9, Enter (EN), Clear (CL), AM, PM, Time and Alarm.
14
Table 1 shows the corresponding 4-bit digital inputs expected by the microcontroller
from the encoder.
0 = 0000
1 = 0001
2 = 0010
3 = 0011
4 = 0100
5 = 0101
6 = 0110
7 = 0111
8 = 1000
9 = 1001
CL = 1010
EN = 1011
AM = 1100
PM = 1101
Time = 1110
Alarm = 1111
Table 1 – Digital Inputs to Microcontroller from Keypad
15
The corresponding pseudo code for the proper sequence of time and alarm coding
into the microcontroller can be seen below, in Pseudo Code 1
Case 0: PIC sees no Input from keypad
Option 1 - 12:00 am
Option 2 - Custom message, “please set time” or “no alarm set”
Case 1: PIC detects Alarm_set button pressed
PIC expects 5 following key presses to store in memory:
= X4 X3 : X2 X1
Then AM or PM button
Case 1: 3 numeric keys pressed, No “AM” or “PM” pressed
Time format only uses 3 digits, X4 = null, assume “AM”
Result = Alarm_set = X3 : X2 X1 AM
Case 2: 3 numeric keys pressed, “AM” or “PM” pressed
Time format only uses 3 digits, X4 = null,
Result = Alarm_set = X3 : X2 X1 PM
Case 3: 4 numeric keys pressed, No “AM” or “PM” pressed
Time format uses 4 digits
Result = Alarm_set = X4 X3 : X2 X1 AM
Case 4: 4 numeric keys pressed, “AM” or “PM” pressed
Result1 = Alarm_set = X4 X3 : X2 X1 AM
Result2 = Alarm_set = X4 X3 : X2 X1 PM
Case 2: PIC detects Time_set button pressed
PIC expects 5 following key presses to store in memory:
= X4 X3 : X2 X1
Then AM or PM button
Case 1: 3 numeric keys pressed, No “AM” or “PM” pressed
Time format only uses 3 digits, X4 = null, assume “AM”
Result = Time_set = X3 : X2 X1 AM
Case 2: 4 numeric keys pressed, No “AM” or “PM” pressed
Time format uses 4 digits
Result = Time_set = X4 X3 : X2 X1 AM
Case 3: 4 numeric keys pressed, “AM” or “PM” pressed
Result1 = Time_set = X4 X3 : X2 X1 AM
Result2 = Time_set = X4 X3 : X2 X1 PM
Pseudo Code 1 - Keypad
16
Infrared Temperature Sensor
In order to ensure a subject has exited the bed, hardware must be implemented to
“view” the sleeping area. The first sensor to accomplish this is the Metris TN9 Infrared
Thermometer Module. The main reason for choosing this device is the fact that it is the
cheapest and smallest non-contact temperature detector available. As added bonuses, it is
highly sensitive as well as accurate, and produces minimal noise while using very little
power. This 3-wire SPI serial output device comes only in a standard IC package that
integrates all necessary hardware onto a single chip for simple connection to any standard
microcontroller.
Detecting the human body temperature will consist of aiming the sensor at the
upper body area, in particular, the head. It is understood that the infrared temperature
sensing reads surface temperatures, and therefore will not read through blankets or
clothing. The best method for obtaining factual temperature readings will be through
direct skin measurements. The warmest place on the human body is the head naturally.
Due to the spot size ratio of the device being 1:1, an object 1 foot away will be seen by
the sensor as 1 foot diameter circle since the field of view grows as a diverging cone the
further the distance becomes. The temperature reading will only be accurate if 100% of
that area is filled with measurable material. In most cases, this will not be true, so it is
expected to have reduced accuracy. The expected distance from the sensor to the object
of detection is approximately 3 feet, so a 3 foot diameter circle will be measured. The
human head’s side surface area of detection, including a small portion of the neck will at
most generally be around 1 foot diameter. The expected maximum accuracy at 3 feet is
17
then 1/3 of its potential, or 33%. Obviously, the closer the sensor is, the more accurate
the temperature reading. The range of permissible temperatures is -27 degrees Fahrenheit
to 482 degrees Fahrenheit. The human body temperature is approximately 98.6 degrees
Fahrenheit and is within the range. This leads to the fact that amplification may be
necessary upon testing the circuit. Figure 5 depicts the physical setup of the sensor.
Figure 5 – Thermal Sensing Physical Setup
The standard 3-wire SPI output will be interpreted by the PIC18F452 as an analog
input signal, and will therefore need to undergo A/D conversion inside the PIC. Since
there is only one direction of information flow, only SCK (Serial Data Clock, pin 3),
MISO (Master Input/Slave Output, pin 4), and /CS (Chip Select, pin 1) are required usage
pins as shown in Figure 6. Eight bits of analog serial information will be sent out upon a
data read during one clock phase. The desired protocol combination of SCK phase and
18
polarity with respect to the data is chosen to be SCK rising-edge transfer with SCK
transitions in the middle of bit timing, which is clock polarity (CPOL)=0 and clock phase
(CPHA)=0.
Figure 6 – Metris TN9
During the time when a person is not in bed, the temperature sensor will register
this fact by remaining below a specified threshold, to be determined through testing. It is
desired to recognize the fact that no one is present in bed, and therefore the alarms will
not activate, even if they are set to go off at a specified time. This proves beneficial for
instances when people set their alarm the night before, and don’t end up being in their
bed at the time of the expected alarm setting. This can occur if the person gets up earlier
than the alarm, or if it was set unintentionally. This logic is set to eliminate the
unattended alarm scenario, where no one would be available to turn off the remote
disconnect switch. The pseudo code is shown below in Pseudo Code 2.
19
Case 1: Voltage below Threshold, Body detected in bed
If (Alarm Stage 3 = On)
All Alarms remain on until Remote Disconnect = On
Case 2: Voltage above Threshold, Body NOT detected in bed
NO alarms activate, even if Alarm time = Time of day
Timer monitors bed for 30 min (ensures no cheating)
Reset for next alarm setting
Pseudo Code 2 – Thermal Sensing
20
Force Sensing Resistors (FSR’s)
There are obvious pitfalls and ways around of using the thermal detection method
alone. For this reason, a combination of thermal sensing and force (weight) sensing will
ensure all angles are covered. Using four analog Force Sensing Resistors from Phigets
USA placed on each corner of the bed between the box spring and the frame will
accurately monitor the bed. These thin, flat, inexpensive sensors are perfect for this
application. Being only 0.008 inches thick and 0.75 inches wide, they provide
unparalleled placement abilities. See Figure 7 and Figure 8 for details.
0.75”
2.375”
Figure 7 – Force Sensing Resistor
21
Figure 8 – Force Sensing Resistor Physical Setup
These variable resistors will be powered by 5V DC and the UA741 op-amp will
be powered by a +-9V power supply. As the force increases on the resistor, the resistance
goes down, increasing the output current of the circuit, as shown in Figure 9. The
position of the weight distribution over the bed will not matter because the summing opamp circuit will utilize the largest change in resistance. It can be extrapolated that a
resistance of approximately 100k ohms corresponds to a preliminary force reading of
approximately 25g (about 0.5lbs). At a resistance of 2k ohms, the force reading is
approximately 10kg (about 22 pounds). When included in the overall picture of
operation, 4*22=88lbs of maximum detection distributed over the 4 equal points of
contact sensing. This is ideal for detecting a change in body weight of a human being. It
is understood that the mattress is designed to evenly distribute weight for comfort, and
22
thus will reduce the accuracy of the sensors. However, since it is desired to take a weight
difference, everything is in order.
Figure 9 – FSR Force vs. Resistance graph
In order to accurately detect user presence in the bed, the four resistors will be
places equivalently on each corner of the bed. A simple summing op-amp circuit will
serve to detect when a change in resistance occurs. Figure 10 illustrates a typical circuit
setup. Resistor R18 is used as a current limiting resistor to control the maximum current
supplied into the PIC18F452. The maximum allowable current that the PIC can sink or
source is 25mA, so this is the design constraint.
23
Figure 10 – FSR Pspice Schematic
Figure 11 shows three test case simulations for various weights applied to the
force sensing resistor network. Test case 1 shows that no body is present, and thus the
resistors each read very high resistances (50M ohms each), producing a small output
current of 3.183uA (nearly zero). Test case 2 simulates a minimum resistance scenario
for the first possible “detection” of a body being present. With each of the force sensing
resistors at 50k ohms each, the output current to the PIC will be 4mA. This current value
will set the standard for body detection, when the input current to the PIC is greater than
or equal to 4mA. Test case 3 simulates an approximate input current value of 8.614mA
being sent to the PIC during the case when each of the force sensing resistors reads only
2k ohms a piece. This simulation serves as a maximum weight for determining body
presence.
24
Figure 11 – FSR Pspice Testing Schematic
The force sensing resistor’s output will be interpreted by the PIC18F452 as an
analog input signal, and will therefore need to undergo A/D conversion inside the PIC, as
interpreted through pin RA1. The pseudo code for implementing the force sensing
resistors is shown in Pseudo code 3.
Case 1: Voltage below Threshold, Body detected in bed
If (Alarm Stage 3 = On)
All Alarms remain on until Remote Disconnect = On
Case 2: Voltage above Threshold, Body NOT detected in bed
NO alarms activate, even if Alarm time = Time of day
Timer monitors bed for 30 min (ensures no cheating)
Reset for next alarm setting
Pseudo Code 3 – Force Sensing Resistor
25
Snooze (Shocking) Button
The snooze button particular to this alarm clock will also serve a temporary
special purpose. In standard operation of any normal alarm clock, the snooze button
serves as a quick method for disarming the annoying buzzer during alarm stage. The
Smart Sensory Alarm Clock’s snooze button will also serve this purpose, but only during
the first two alarm stages, allowing the user two separate opportunities to get out of bed.
Upon alarm stage 3 activation, the snooze button will cease to terminate the horrific
effects of alarm stage 3. Instead, it acts as another stimulus to entice the user to get out of
bed. As soon as the user makes contact with the snooze button and the grounded frame
along the perimeter of the snooze button, a small voltage will be applied. This will in
turn cause a slight electric shock to be felt, using the human hand as a resistor completing
the ground connection, and the path of current will be safe, through the hand only.
Figure 12 illustrates the physical setup of the theory of operation.
Figure 12 – Shocking Snooze Button Physical Setup
26
In order to reduce the amount of voltage applied to the snooze button, a voltage divider
network was established. Figure 13 shows a quick calculation of this limiting voltage.
V2 = V1
R1 || RL
1000 || 1000
⇒ V2 = 5
= 1.5V
R1 + R2 || RL
1000 + 750 || 1000
Figure 13 – Voltage Divider Calculation
The final circuit to be implemented can be seen in Figure 14. The heart of the current
driver is the 555 timer, which simulates a PWM signal to pulse the coil. Every time the
inductor is pulsed, a sharp spike in current flows through the simulated hand resistance
R24. The values of R22, R23, and C4 determine the output pulse frequency for the 555
timer.
Figure 14 – Shocking Snooze Button Pspice Schematic
27
Detection of when the snooze button is pressed will be fed into the PIC via pin
RB2, and when necessary, pin RB3 will electrify the snooze circuit. The switching
mechanism that is the heart of the snooze button will have to provide two separate pin
connections upon depression. First, the snooze button operation will need to be insulated
from the shocking circuit, so to not send unnecessary current back into the PIC. The
second pin connection will tie the metallic snooze button into the shock circuitry. Also,
insulation needs to be provided between the outer metallic rim surrounding the snooze
button that provides its ground. The method of operation behind the snooze button is
shown below in Pseudo Code 4.
28
Alarm Stage = off;
Buzzer = off;
Light = off;
When (Time = Alarm set and Alarm Stage = off)
Alarm Stage = low;
Buzzer = low;
Light = low;
While (Snooze pressed = no)
Buzzer = low;
Light = low;
While (Snooze pressed = yes)
Buzzer = off;
Light = 1;
Alarm Timer = 5 min;
Decrement Alarm Timer until it reaches zero;
When (Alarm Timer reaches 0 and Alarm Stage = low)
Alarm Stage = med
Buzzer = med;
Light = med;
While (Snooze pressed = no)
Buzzer = low;
Light = low;
While (Snooze pressed = yes)
Buzzer = off;
Light = med;
Alarm Timer = 5 min;
Decrement Alarm Timer until it reaches zero;
When (Alarm Timer reaches 0 and Alarm Stage = med)
Alarm Stage = high
Buzzer = high;
Light = high;
Shock Activation:
While (Alarm Stage = high)
Output signal to close relay or bjt = Closed;
//armed
Else Output signal to close relay or bjt = Open;
//disarmed
While (Snooze pressed = yes)
Buzzer = 3;
Light = 3;
While (Snooze pressed = no)
Buzzer = 3;
Light = 3;
Pseudo Code 4 – Shocking Snooze Button
29
Water Squirting Mechanism
The last device to initiate force in waking the subject up will be in the form of
contact, in particular, wet contact. For prototypical use, a simple water gun will be
electronically controlled to pump several quick blasts of water at the heavy sleeper. For
best results, the squirter will be aimed directly at the pillow to ensure that the most
annoying body part is hit, the head. Figure 15 shows the physical setup, which is very
similar to the setup for the thermal sensor.
Figure 15 – Water Squirting Mechanism Physical Setup
The circuit of Figure 16 shows the basic 555 timer PWM generation circuit to
pulse the DC motor. Upon activation of PIC pin RC1, the 555 timer will pulse the motor
with 3V DC for approximately 1 second. The motor will transfer the rotational energy
into translational energy via a gear head and connecting rod. One end of the rod will
traverse along a single point towards the edge of the gear’s circle, where the other end of
the rod will be connected to an existing plunger mechanism on the water gun. This will
30
in turn “pump” the water gun several times very quickly, depending on the RPM of the
motor which is to be tested. The corresponding logic can be seen in Pseudo code 5.
Figure 17 also depicts the physical motor to be used and illustrates the gear on the shaft.
Figure 16 – Water Squirting Mechanism Pspice Schematic
While (Alarm Stage = high)
Output signal to close relay or bjt = Closed;
Else Output signal to close relay or bjt = Open;
Pseudo Code 5 – Water Squirting Mechanism
Figure 17 – DC Motor Physical Setup
31
//armed
//disarmed
Wireless Remote Kill Switch
One feature that was thought to be helpful to our design is a wireless remote kill
switch. This switch, if pressed, overrides all other actions in the alarm clock. This
switch is mounted in a room far away from the bedroom of the user. This is to ensure
that significant effort is used by the sleeper to get out of bed and travel a good distance
press the remote kill switch. The farther away the sleeper must travel to hit the switch,
the less likely they are to return to bed.
The Wireless Remote Kill Switch operates on the principle of Radio Frequency
(RF) communication. The signal that is transmitted is sent using a frequency of 433.92
MHz. This is an unregulated frequency and therefore does not interfere with TV and
internet signals which use a regulated frequency. The circuits used for the Transmitter
and Receiver design are given in Figure 18 and Figure 19, respectively.
Figure 18 – Wireless Remote Kill Switch Transmitter Pspice Schematic
32
Figure 19 – Wireless Kill Switch Receiver Pspice Schematic
The circuits employ the use of a basic TWS 434A FM transmitter and a basic
RWS 434 FM receiver. This transmitter/receiver pair are able to transmit over a distance
of 400 feet (outdoors) and 200 feet (indoors). This allows the remote switch to be placed
up to 200 feet away from the alarm clock unit and still be able to function properly. 200
feet is an acceptable distance for the design since few houses are 200 feet on one
dimension.
The transmitter and receiver circuits employ the use of an encoder and decoder,
respectively. The encoder (HT-12E) translates the signal going into the transmitter (from
the user pushing the remote kill switch) into a four bit digital signal. This makes the
signal less susceptible to interference. The decoder (HT12D in the receiver circuit) then
translates this signal back to a simple on/off signal that can be interpreted easily by the
33
PIC. The pseudo code for the Wireless Remote Kill Switch is given below in Pseudo
Code 6.
When Time = Alarm and Snooze = On or Off, or Remote Kill = On
1. Lamp = Off (output 0 V to all lamp relays)
2. Buzzer = Off (drive Buzzer output to 0 mA)
3. Start Timer2 for 15 min to monitor bed for heat on current
alarm setting
4. Reset system for monitoring
Pseudo Code 6 – Wireless Remote Kill Switch
34
Piezoelectric Buzzer
One way the Smart Alarm Clock wakes the sleeper is with the use of a
Piezoelectric buzzer. The uniqueness of this design is that this buzzer is turned on to 3
levels of loudness corresponding to the different stages of the alarm. When the alarm
clock first reaches the preset alarm time, the unit enters Alarm Stage zero. This
corresponds to a low level buzzer and low level lighting. If the snooze button is pressed,
the Alarm Stage is incremented by one, and after a “snooze period,” the alarm begins to
wake the user with a medium level buzzer and medium level lighting. If the snooze
button is pressed again, the Alarm Stage is increments by one again. After another
“snooze period,” the alarm attempts to wake the user with a high intensity buzzer and
high intensity lighting.
These three stages of the alarm make it necessary to have a buzzer that has three
levels of intensity. This is accomplished by having 3 separate outputs from the PIC going
to the buzzer. At each level of Alarm Stage, a different output pin is energized. Each of
these pins have a different voltage divider circuit before reaching the buzzer. The pin
corresponding to the third Alarm Stage does not have a voltage divider circuit at all. This
pin drives the buzzer to the full output voltage of the PIC. The pin corresponding to the
second Alarm Stage has a voltage divider circuit which drops the voltage to the buzzer to
75% of the full voltage. The pin corresponding to the first Alarm Stage has a voltage
divider circuit which reduces the voltage going to the buzzer to 50% of the full output
voltage of the PIC. These different levels of voltage going to the buzzer give different
levels of loudness. Pseudo code for the Piezoelectric buzzer is given below in Pseudo
Code 7.
35
When Time = Alarm setting and Heat sensor < X°
1. “Quick” Buzzer and Lamp
When Time = Alarm setting and Heat sensor > X° and
Snooze = Off and Remote
Kill = Off
2. Buzzer = Low (drive Buzzer output to 12.5 mA)
When Time = Alarm setting and Heat sensor > X° and
Snooze = Off and Remote
Kill = On
1. Buzzer = Off (drive Buzzer output to 0 mA)
When Time = Alarm setting and Heat sensor > X° and
Snooze = On
1. Buzzer = Off (drive Buzzer output to 0 mA)
2. Timer1 = t seconds, Then Goto iii
When Time = Alarm setting and Heat sensor > X° and
Snooze = Off and Remote
Kill = Off
3. Buzzer = Medium (drive Buzzer output to 18.75 mA)
Snooze = Off and Remote Kill
When Time = Alarm setting and Heat sensor > X° and
= On
1. Buzzer = Off (drive Buzzer output to 0 mA)
When Time = Alarm setting and Heat sensor > X° and
Snooze = On
1. Buzzer = Off (drive Buzzer output to 0 mA)
Timer1 = t seconds, Then Goto iv
When Time = Alarm setting and Heat sensor > X° and
Snooze = Off and Remote
Kill = Off
1. Buzzer = High (drive Buzzer output to 25 mA)
When Time = Alarm setting and Heat sensor > X° and
Snooze = Off and Remote
Kill = On
1. Buzzer = Off (drive Buzzer output to 0 mA)
When Time = Alarm setting and Heat sensor > X° and
Snooze = On
1. Buzzer = High (drive Buzzer output to 25 mA)
2. Alternative Designs?? (sound system, shocker, etc)
Snooze = On or Off, or
When Time = Alarm setting and Heat sensor < X° and
Remote Kill = On
5. Buzzer = Off (drive Buzzer output to 0 mA)
6. Start Timer2 for 15 min to monitor bed for heat on current
alarm setting
7. Reset system for monitoring
Pseudo Code 7 – Piezoelectric Buzzer
36
Lighting Control
Another means of waking the user that the Smart Alarm Cock uses is controlled
lighting. The controlled lighting works in much the same way as the buzzer control. As
can be seen from Figure 2, when the alarm clock first reaches the preset alarm time, the
unit enters Alarm Stage zero. This corresponds to a low level lighting. If the snooze
button is pressed, the Alarm Stage is incremented by one, and after a “snooze period,” the
alarm begins to wake the user with medium level lighting. If the snooze button is pressed
again, the Alarm Stage is increments by one again. After another “snooze period,” the
alarm attempts to wake the user with a higher intensity lighting.
These three stages of the alarm make it necessary to have a lighting that has three
levels of intensity. This is accomplished by having 3 separate outputs from the PIC going
to the light. This is similar to the buzzer control, but the goal of the design is to allow the
user to plug any general lamp into the alarm clock unit. This is so that the user does not
have to purchase a separate lamp specifically for the alarm clock. There are two outlets
mounted in the alarm clock unit. These outlets are controlled by electromechanical relays
and voltage divider circuits. To minimize the number of output pins on the PIC, the same
voltage divider circuits are used for the buzzer and lighting control. The difference
comes after the divider circuits. A schematic of the Piezoelectric Buzzer and Lighting
Control is given below in Figure 20.
37
Figure 20 – Piezoelectric Buzzer and Lighting Control
As can be seen from above, the same three output pins are used to control the
three stages of lighting and buzzer volume. For the first Alarm Stage, the output pin
connected to R3 and R4 is energized. This energizes the coil in Relay 1. Relay 1 sends
power to the outlet on the alarm clock unit in which the lamp is connected. In series with
the lamp is another voltage divider circuit. This reduces the voltage to the lamp to 50%
of the full 120VAC. This gives the 50% illumination level as desired for the first alarm
stage. For the second Alarm Stage, the output pin connected to R1 and R2 is energized.
This energizes the coil in Relay 2. Relay 2 also sends power to the outlet on the alarm
clock unit in which the lamp is connected. In series with the lamp is another voltage
divider circuit. This reduces the voltage to the lamp to 75% of the full 120VAC. This
38
gives the 75% illumination level as desired for the first alarm stage. For the third Alarm
Stage, the output pin which has no voltage divider circuit is energized. This energizes the
coil in Relay 3. Relay 3 also sends power to the outlet on the alarm clock unit in which
the lamp is connected. There is no voltage divider circuit in series with the lamp in this
circuit. Therefore the lamp receives the full 120VAC. This gives the 100% illumination
level as desired for the first alarm stage. Pseudo code for Lighting Control is given
below in Pseudo Code 8.
When Time = Alarm setting and Heat sensor < X°
1. No Alarm
2. “Quick” Buzzer and Lamp
When Time = Alarm setting and Heat sensor > X° and
Snooze = Off and Remote
Kill = Off
1. Lamp = Low (output 5 VDC to stage 1 relay)
When Time = Alarm setting and Heat sensor > X° and
Snooze = Off and Remote
Kill = On
1. Lamp = Off (output 0 V to all lamp relays)
When Time = Alarm setting and Heat sensor > X° and
Snooze = On
1. Lamp = Low (output 5 VDC to stage 1 relay)
2. Timer = t seconds, Then Goto iii
When Time = Alarm setting and Heat sensor > X° and
Snooze = Off and Remote
Kill = Off
1. Lamp = Medium (output 5 VDC to stage 2 relay)
Snooze = Off and Remote
When Time = Alarm setting and Heat sensor > X° and
Kill = On
1. Lamp = Off
When Time = Alarm setting and Heat sensor > X° and
Snooze = On
1. Lamp = Medium (output 5 VDC to stage 2 relay)
Timer = t seconds, Then Goto iv
Snooze = Off and Remote
When Time = Alarm setting and Heat sensor > X° and
Kill = Off
1. Lamp = High (output 5 VDC to stage 3 relay)
When Time = Alarm setting and Heat sensor > X° and
Snooze = Off and
Remote Kill = On
1. Lamp = Off
When Time = Alarm setting and Heat sensor > X° and
Snooze = On
1. Lamp = High & Flash (Flash Initiation Sequence = On)
39
Snooze = On or Off, or
When Time = Alarm setting and Heat sensor < X° and
Remote Kill = On
1. Lamp = Off (output 0 V to all lamp relays)
2. Start Timer for 15 min to monitor bed for heat on current
alarm setting
3. Reset system for monitoring
When Flash Initiation Sequence = On,
1. Timer = t seconds
2. If (t = even),
a. Lamp = On (output 5 VDC to stage 3 relay)
3. If (t = odd),
a. Lamp = Off (output 0 V to all lamp relays)
Pseudo Code 8 – Lighting Control
40
Coffee Maker
Another means of waking the user is through the user’s sense of smell. The unit
has another outlet mounted on it where the user can plug in a coffee maker. Any generic
coffee maker can be connected. All the user has to do is plug in their coffee maker and
switch the “on” switch to the on position. The outlet is controlled by the PIC so it will
only be energized when the timing sequence is ready for it to be on. As can be seen from
Figure 2 (Alarm Clock Operation Flow Chart,) 5 minutes before the alarm first goes off,
the unit energizes the Coffee Maker relay coil. A schematic of the Coffee Maker
Operation is given below in Figure 21.
Figure 21 – Coffee Maker Pspice Schematic
5 minutes before the alarm goes off, the Coffee Maker Relay is energized and
begins the brewing process. The coffee maker is turned on 5 minutes before the alarm
goes off to ensure that at the time of the alarm, the aroma of coffee is in the air and is
smelled by the user. This, in theory, brings the user out of sleep in a better attitude
41
because the aroma of coffee is soothing. The Coffee Maker Relay is energized and kept
energized for 10 minutes. After 10 minutes the Coffee Maker Relay is de-energized
because the brewing process should be over by this time. Pseudo code for the Coffee
Maker is given below in Pseudo Code 9.
Snooze = Off and Remote
When Time = Alarm setting and Heat sensor > X° and
Kill = Off
1. Coffee = On (output 5 VDC to Coffee Relay)
When Time = Alarm setting and Heat sensor > X° and
Snooze = Off and Remote
Kill = On
1. Coffee = On (output 5 VDC to Coffee Relay)
Pseudo Code 9 – Coffee Maker
42
Supply Power
The input power to the Smart Alarm Clock is accomplished with two power
cords, both plugged into a wall outlet. One power cord has a wall transformer which
steps the voltage down to the required voltage by the PIC. The other power cord has no
transformer on it. This cord is to supply power to the outlets which power the coffee
maker and lamp. The two cords are necessary because the outlets which need 120 VAC
are mounted on the alarm clock unit. The alarm clock microprocessor needs a DC
voltage. This means that an AC supply and a DC supply are needed in the same unit.
This is why two power cords are needed. The necessary voltages required are 5V DC,
3V DC, and 12V DC.
43
Graphic Liquid Crystal Display and Controller
The design specifications for the Smart Sensory Alarm Clock states that the
display must be larger than five inches by two inches, easy to read, able to display the
time in an AM/PM format and finally display custom messages. In order to do this a it
was determined that a graphic LCD is needed since a character LCD does not meet the
size requirements. With the graphic LCD the time can be displayed very large while at
the same time the alarm stages can be shown on the screen. With this display custom
messages may be displayed to alert the user of an input error or of the upcoming alarm
stage. Since graphical displays are not cheap a display was chosen that the Electrical
Engineering department had in stock. The DMF 5000 series graphic LCD was available
and satisfied all of the design requirements and thus was chosen. See Figure 22 below
for a physical example of this unit.
Figure 22 – Graphic LCD Display
44
In order for the PIC microcontroller to communicate with the graphic LCD a
separate controller is needed. A very common controller that is also available from the
Electrical Engineering department is the Toshiba T6963. Figure 23 below shows a pin
layout for this controller. This controller is interfaced with the microcontroller with the
following twelve connections; eight data lines, a chip enable, write, read and a C/D
command line. With this controller the graphic LCD will satisfy all of the design
requirements.
Figure 23 – Toshiba T6963C Display Controller Pin Assignments
45
Software Design
The main component of the smart alarm clock is the microcontroller. Every piece
of hardware interacts and is controlled by the microcontroller. The first major role of the
microprocessor is control the actual clock operation. In order to do this the
microcontroller will simply use an interrupt service routine with a timer. The timer will
count down and when it reaches zero it will call an interrupt to update the actual time.
Since the alarm clock will only display the time in hours and minutes the timer will be set
to count down and call the interrupt service routine every minute. After each minute
code must be executed so that the time is incremented correctly. Following the interrupt
the program code will check if an alarm time has been set, and if so it will check to see if
the current time set is equal to one of the alarm stages. Once a certain stage is reached
the microcontroller will check the sensor inputs and then determine what actions need to
be taken according to the Figure 2 flow chart. All of the preceding pseudo code segments
presented earlier will be separate functions that the main program will call to make the
appropriate decisions. For the start of the main program the following flowchart, Figure
24 below, will be followed. From this flowchart Pseudo Code 10 shown below was
developed. This will be the code template used whenever the alarm clock has been
powered off for sometime. Since nothing else will work without the correct time being
set, the program code will force the user to input the correct time before any other actions
can take place.
46
* Start of main program
initDisplay() // see figure 1
// Alarm clock is powered up, either for first time or after power outage and
no/dead battery.
// Clock either flashes 12:00 am or displays a message stating that the time needs
to be set.
while ( freshStart = TRUE) {
freshStart = FALSE; // used to control cancel button
clearAllVariables(); // reset all variables
enterTimeMSG()
// Prompt user to enter time
while( wait4Input() ) ;
// wait until a key is pressed
while ( exitTimeset == FALSE ) {
switch ( keyInput){
case CANCEL:
freshStart = TRUE; // reset and start over
break;
case AMPM:
toggle();
break;
// toggle AM / PM of the time being set
case NUMBER:
// accept number input and shift all numbers left
digit3 = digit2;
digit2 = digit1;
digit1 = digit0;
digit0 = keypadInput;
// update display
break;
case ENTER:
// determine if the time entered is valid
if ( validateTime() = TRUE ){
// set the time;
exitTimeset = TRUE; // exit the timesetting loop
// enable interrupts;
} else {
// print an error message;
freshStart = TRUE; // reset and start over
}
break;
default:
47
// ignore alarm set and time set buttons
break;
} // end of switch structure
} // end of TimeSet Loop
} // end of freshStart while loop
Pseudo Code 10 – PIC Pseudo Code for Initializing Alarm
48
Power Supplied
Initialize Display
Clear Variables
Prompt User
Wait for Input
SWITCH STRUCTURE
DEFAULT
AM/PM
NUMBER
ENTER
CANCEL
Toggle AM/PM
Wait( 2 seconds)
Update memory
and display
YES
Show Error MSG
Valid time ?
Set Time and
enable interrupts
Code to handle Alarm
stages, timing as well
as any device I/O.
Figure 24 – Alarm Initialization Flow Chart
49
NO
Testing Procedures
Hardware testing will be completed first to ensure that the components
themselves are functioning correctly independently (without the PIC.) The components
will be powered manually to ensure that the basic operation of the components is as
specified by the manufacturer. The second method of testing will be the testing of the
components when integrated with the PIC. If the components are functioning correctly
independent of the PIC, then malfunction when integrated with the PIC, the problem can
be located in the software rather than in the hardware.
Keypad
Powering up the encoder circuit and integrated keypad with 5V DC while probing
the 4 individual output pins for high and low voltages according to Table 1 (Digital
Inputs to Microcontroller from Keypad) will occur first. Each of the buttons will be
tested for their corresponding digital number assignments and displayed on the digital
oscilloscope channels 1-4. This will determine the exact expected digital inputs to the
PIC. Multiple key press schemes will also be introduced to view how shorts are
interpreted, and the corresponding row currents will be calculated. Once incorporated
into the overall design, testing will resume with software interpretation of the keypad
inputs, and storing each received data into time and alarm memory. Also, timing
diagrams and debounce will become crucial in software code debugging.
50
Infrared Temperature Sensor
Changes in voltage on the data out pin of the temperature sensor will need to be
measured on the analog oscilloscope. From this data, a valid range of expected
temperature changes can be fitted to a corresponding voltage chart. These voltage values
will linearly correspond to temperatures. From this information, a voltage threshold can
be set for interpreting when a body is or isn’t present in the bed. The speed of response
as compared to ambient as well as test temperatures will need to be recorded to ensure
proper operation. The SPI software code will synchronize to the internal clock of the PIC
and proper timing in the software routine will need to be checked.
Force Sensing Resistors
In a similar fashion to the Infrared Temperature Sensor, changes in the output
voltage of the summing resistor network will correspond to changes in weight distributed
across the bed. Simple laboratory measurements will include placing various objects of
known weight on the force sensing resistors while measuring the corresponding change in
output voltage. An excel spreadsheet of the voltage to force values will be generated for
interpretation of a threshold value. Software code can then be programmed with the
calculated threshold value and eventually tested for proper operation.
Snooze Button
Starting with small voltages applied to the shock circuit, output currents will be
measured to ensure hazardous conditions are not met (ie currents of no more than 1mA).
Once the circuit is operating according to reasonable output currents, the software testing
51
will include accurate readings from the snooze button switch to ensure the alarms will
turn off on stage 1 and 2. In addition, during alarm stage 3 only the electric shock circuit
will be active.
Water Squirting Mechanism
The DC motor operations will be the first design to test. Verification of
maximum output voltage applied to the motor will be necessary to make sure overloads
do not burn the motor. The output of the PIC driver voltage needs to be simulated by
applying 5V DC to the motor driver circuit. Output voltages will be measured before
application to the motor. Once successful electrical testing is complete, the mechanical
testing begins. Conditions need to verify proper measures are taken to secure the system
from generated torques, and precautions need to be taken to avoid contact of water with
any part of the electrical circuitry. If time conditions render necessary, a pre-designed
motorized water pump system may be required, and thus this mechanical system will be
tested last.
Wireless Remote Kill Switch
The remote kill switch can be tested independently of the system by applying
power to the transmitter and receiver, pushing the kill switch button (see Figure 18 –
Wireless Remote Kill Switch – Transmitter Circuit) and monitoring the voltage of pin D0
(see Figure 19 – Wireless Remote Kill Switch – Receiver Circuit.) If for each time the
kill switch button is pressed, a voltage is measured at pin D0, then the wireless system is
functioning properly. The remote kill switch can be tested while integrated with the
52
system by pushing the kill switch button during every possible moment during the alarm
cycle and seeing if the buzzer and lighting turn off. If this is the case, the Wireless
Remote Kill Switch is functioning properly. After the remote kill switch is pressed, the
sensors monitoring the bed are monitoring the bed for 30 minutes. If during this time, the
sensors detect the presence of a body, the lamp and buzzer should come back on at full
strength.
Piezoelectric Buzzer
The buzzer can be tested independently of the system by simply applying
different DC voltages to the buzzer. Since the different stages of the alarm system will
be applying 5 volts, 3.75 volts, and 2.5 volts, these are the voltages which will be used. If
the volume of the buzzer differs when different voltages are applied, the buzzer is
functioning correctly.
Lighting Control
Lighting control can be tested independently by setting up the voltage dividers
that are used in the actual implementation (see Figure 20 – Piezoelectric Buzzer and
Lighting Control.) The voltage dividers can then be connected directly to the 120 VAC,
creating the same circuit as in Figure 21, but without the controlling relay. If the light
level is different using each voltage divider, the lamp and circuitry are functioning
correctly.
53
Coffee Maker
The coffee maker can be tested independently by simply plugging it into the wall.
If the coffee maker begins to brew when switched on, it is functioning properly. The
coffee maker can be tested while integrated with the system by plugging it into the outlets
mounted on the alarm clock unit. If the coffee maker begins to brew 5 minutes before the
alarm is set to go off, it is functioning properly. The outlet should also be de-energized
10 minutes after being energized.
LCD
Powering up the LCD for testing will occur after all of the peripherals have been
tested. The software code for initializing the LCD will need to be tested first, initially to
display a cursor on the screen. After successful completion of this task, the time will be
set to display. Entering information from all of the peripherals will then resume.
54
Financial Budget
The team financial budget has been set by the Electrical Engineering Department.
The hourly rate per team member is $10.00 and the total cost is determined for a 15 week
semester. The final cost for labor can be seen in Table 2. The Electrical and Engineering
Department also set a budget for the materials for this project which is $100 per team
member. Table 3 below shows the material cost for this project. In the table, where there
is no cost associated with an item, that shows that the item was donated by a team
member. The abbreviation “tbd” stands for To Be Determined.
Design
Team
Member
Brad Morse
Karl Pilz
Josh Runtas
Hourly
Rate
$10.00
$10.00
$10.00
Hours/Week
Weeks/Semester
Estimated
Cost
15
15
15
$1500
$1500
$1500
$4,500
10
10
10
Total Labor Cost:
Table 2 – Estimated Labor Cost
55
Qty.
1
1
1
4
4
1
3
1
1
1
4
1
4
4
1
2
4
1
1
1
1
1
1
2
1
4
1
1
1
Part Num.
GH5015-ND
EDE1144
Comp-XTAL-4Mhz
CFR-12JB-4K7
330EBK-ND
JS1A-5V
HY1Z-5V
4-Bit-TWS
PS1420P02AT
TN9 IR
91002
SC00535
CFR-12JB-10K
CFR-12JB-1K0
NE555D
2N3904_D10Z
UA741CD
C1005X8R1E103K
PIC18F452-E/L
Description
4x4 Matrix Keypad
Keypad Encoder
4Mhz Crystal Oscillator
4.7k ohm resistor
330 ohm resistor
Power Relay 10A SPST 5VDC PC MNT
Relay Telecom SPDT 1A 5VDC PC MNT
Transmitter, Receiver, and encoders TWSA-4-Bit-Pack
Buzzer Piezo 2KHZ 14MM PC Mount
Infrared thermometer module
Force sensing resistors
3V DC motor for water squirter
10k resistor
1k resistor
Shock coil
CMOS 555 Timer
Q2N3904 NPN Transistor
120V AC lamp
120V AC coffee maker
Water gun
120vAC to 5vDC wall wart
9V backup battery
Mattress and box frame
General 120V AC Wall Outlets
Ua741 op amp
0.01uF Capacitors
LCD and driver
PIC18F452 microcontroller
Metallic snooze button switch mechanism
Box enclosure
Table 3 – Material Budget Sheet
56
Unit
Cost
$27.81
7.00
1.00
0.05
0.05
1.15
2.89
19.50
0.58
27.00
6.60
5.99
0.05
0.05
0
0.10
0.03
0
0
0
0
0
0
0
0.40
0.17
0
7.95
tbd
tbd
Total
Total
Cost
$27.81
7.00
1.00
0.21
0.21
1.15
8.67
19.50
0.58
27.00
26.40
5.99
0.21
0.21
0
0.20
0.12
0
0
0
0
0
0
0
0.40
0.68
0
7.95
$135.28
Project Schedule
The Smart Sensory Alarm Clock design team constructed a timeline that will keep
them on task to reach their ultimate goal of completing this project. This implementation
will take place during the Spring 2006 semester. The following figures, Figure 22 and
Figure 23, are detailed Gantt Charts of how this project is going to be accomplished.
57
Figure 25 – Implementation Gantt Chart Breakdown
58
Figure 26 – Implementation Gantt Chart Timeline
59
Design Team Information
Name
Brad Morse
Karl Pilz
Josh Runtas
Address
406 Sumner St
Apt A3
4391 Cottage
Grove Rd
PO box 934
Akron OH 44309
Phone
330-212-3327
Email
[email protected]
330-268-4876
[email protected]
330-219-2134
[email protected]
Table 4 – Design Team Information
60
Major
Electrical
Engineer
Electrical
Engineer
Computer
Engineer
Conclusions and Recommendations
The overall design of the Smart Alarm Clock System contains numerous
peripheral devices that will all come together to stimulate cognitive learning for the user.
Design recommendations for future alarm clock projects would include choosing fewer
elements to implement. The amount of time required for each individual part is limited
due to focusing on other areas of interest. Also, when a problem arises with a particular
part, that part is usually put on hold to work on another component, making it difficult to
focus on the overall design.
In conclusion, the final product will replace out-dated alarm clocks by stimulating
the senses in an automated fashion. Depending on whether the user still occupies the bed
or not determines the reaction from the alarm clock. Gentle stages will entice the user to
wake up promptly, where the later stages will make them think twice the next day. Much
of the physical construction this project will be done in early January and February of
2007, leaving approximately 3 months for final testing. The team is confident in the
concepts and designs described in this report, and are anxiously awaiting the construction
phase.
61
References
1. Peatman, John B. Embedded Design with the PIC18F452 Microcontroller.
Prentice Hall. (2003)
62
Appendices
The following are the datasheets used in the design of the Smart Sensory Alarm Clock.
The following datasheets were used and included in the design:
•
Microchip PIC18F8525 Microprocessor Data Sheet (selected pages)
•
Philips Semiconductor SE555 Timer
•
Metris TN9 IR Thermometer Module
•
Phidgets USA Force Sensing Resistor
•
E-Lab Digital Engineering EDE1144 Keypad Encoder IC
•
Science City 3V DC Electric Motor
•
Reynolds Electronics TWS-434/RWS-434 Wireless transceiver combo pack
•
Piezoelectronic Products Buzzer
•
Panasonic JS Power Relay
•
Panasonic HY Relay
•
Toshiba T6963C LCD Driver (selected pages)
•
Optrex DMF 5000 Graphic LCD Display (selected pages)
63
65