1.7k likes | 5.92k Views
Smart Alarm Clock. By: Paul Lee Arthur Wu Jordan Yamamoto. Table of Contents. Objectives Hardware Software Testing/Data Troubleshooting Project Timeline Cost Analysis Future Considerations Sales Pitch Acknowledgments. Objectives.
E N D
Smart Alarm Clock By: Paul Lee Arthur Wu Jordan Yamamoto
Table of Contents • Objectives • Hardware • Software • Testing/Data • Troubleshooting • Project Timeline • Cost Analysis • Future Considerations • Sales Pitch • Acknowledgments
Objectives • Punctuality: make appointments and class on time and start off the day in good order • Oversleeping Prevention: break bad habit of falling back to sleep • Convenience: People only have to set alarm, and the sensors will take care of everything else. People will be rest assured that the smart alarm clock will wake them up. • Cost: Productivity in companies can improve when people come to work on time, and more is accomplished over the day. Students will learn more in a classroom setting than their beds.
Hardware • PIC 16F877 • Flexiforce pressure sensors • MTS102 Thermal Sensor • Genie Optical Safety Sensor • Amplifiers • BCD-to-LED decoders • 4 Seven Segment displays • Piezo Buzzer • 4.00000 MHz Oscillator
PIC 16F877 • 40 pin microcontroller • Ports A,B,C,D,E • On-board 8 channels of A/D converters • Oscillator input • The Smart Alarm Clock’s Microcontroller
PIC • Each Port has 8 bits, either input or output • Port A • Sensor inputs • Port B • Time display (minutes) • Port C • Time display (hours) • Port E • Output buzzer
PIC • PIC • Each sensor outputs to PIC’s A/D converter • Each sensor output = 8 bits of data • PIC takes sensor input and compares to 0 • Clock output goes to BCD-to-LED decoders • Decoders output times to 7 segment displays • One output pin sent to piezo buzzer
Flexiforce Sensors • 3 located at the head, shoulders, and butt • Creates a variable resistance • Only the tip is sensitive to pressure • Sewn to surface of bed • Piece of firm paper with glued on resistor used to focus pressure on sensing tip • D/A threshold value set to 0V
MTS 102 Thermal Transistor and Temperature Circuit • 10mV differential output for each degree C • Output measured across transistor
Assembly • Thermal Sensor • Duct taped to the top of the cot • Placed under location where shoulders are so body heat always detected • D/A threshold value set to be 0 V
Genie Optical Safety Sensor • Creates current change if line of sight blocked • Voltage across 550 ohm resistor used to convert the current to a measurable voltage
Assembly • Optical Sensor • Test tube clamp used to attach to cot • Sensors set up to scan diagonally across the bed • With a 550 ohm resistor, 2.26 V differential detected • Threshold value set to be 0 V
Other parts • 7-Segment Display • Piezo Buzzer • Oscillator • BCD-to-LED 7448
Software • Programmed PIC in C++ • Initially had limited knowledge • Controls clock time, alarm time, A/D for sensors, criteria testing for alarm output, buzzer
Time Display I • Used port B (8 pins) to control four 7 Seg LED • Four pins control two BCD-to-LED (7448) • Required mapping • First hex corresponds to MSB • Gets sent to MSB BCD-to-LED • Second hex corresponds to LSB • Gets sent to LSB BCD-to-LED
Time Display II • Example: if 08 is desired for output, sends 0000 to MSB and 1000 to LSB • 7448 chip turns on respective segments to display correct digit • subroutine “display” to see check MSB and calls respective BCD-to-LED mapping BYTE CONST LED_MAP0[10] = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09}; //0.. void display_mins0(char c) { … port_b=LED_MAP0[c-'0']; }
ADC I • port A for sensors • Sensor’s analog signal converted to a digital value for comparison • 8 bit value for ADC reading • 5 channels • Read analog input at each channel • If greater than threshold (0V), sensor is ACTIVE • Else, sensor is INACTIVE
ADC II • Check sensors each iteration (every second) • Must pass 3 of 5 tests to turn on alarm set_adc_channel( 0 ); delay_us(10); value = Read_ADC(); if(value>0) culmination++; else culmination = culmination; delay_us(10); if(culmination >= 3) sensor = 1; else if(culmination == 0) sensor = 2; else sensor = 0;
Alarm Check • When clock cycles through, alarm case is checked • t1, t2, t3, t4 are compared to set alarm time • Pos1, pos2, pos3, pos4: characters that are mapped to be displayed • If 3 of 5 sensors are active & t1-t4 match alarm time, buzzer turns on if (min == 18){ pos1='8'; pos2='1'; t1 = 8; t2 = 1;} if ((t4==a4)&&(t3==a3)&&(t2==a2)&&(t1==a1)&&(sensor==1)){ output_high(PIN_E0);} else if(sensor==2) { output_low(PIN_E0);}
Testing: Pressure • Conditioned sensors by stepping on them • Ensures output will be repeatable within 2.5% • Laid on cot to calibrate resulting output voltages • Variable resistance changed to ensure threshold will be broken if active • Amplified output to increase voltage difference between Active/Inactive states
Measurements: Pressure • HEAD • Max 4 V • Min -312.5 mV • SHOULDER • Max 5.9 V • Min -616 mV • BUTT • Max 5.8 V • Min -440 mV • Conclusion • Expected Linear Response
Pressure Sensor Data • Top: person present • Bottom: person absent • SNR (head): = [4-(-0.3125)]/[.213] = 20.2 • Output somewhat erratic
Testing: Thermal • Amplified difference between room temp and active temp • Laid on cot to calibrate resulting output voltages • Variable resistance changed to ensure threshold will be broken if active • Discovered best placement of sensor • Underside vs top • Timed response to abrupt temperature changes
Measurement: Thermal • Room Temp: -0.9 V • Max: 1.4 V • Time • 28 sec to rise above threshold of 0 V • 63 sec to hit peak 0.52 V • 23 sec to fall back below threshold
Thermal Sensor Data • Top: person present • Bottom: person absent • SNR: = [.52-(-.9)]/[.0313] = 45.4 • Sluggish to react, but very reliable output
Testing: Optical • Tested various resistances to obtain greatest voltage difference • 550 ohms • Blocked beam to calibrate resulting output voltages • Variable resistance changed to ensure threshold will be broken if active Volt (V) Resistance (ohms)
Measurement: Optical • No Interference • -1.0 V • Interference • 4.25 V
Optical Sensor Data • Top: person present • Bottom: person absent • SNR: = [4.25-(-1)]/[.250] = 21 • Highly reliable output
Troubleshooting • PIC • Clock code • Is difficult to get the time exactly right with wait_ms() command • A/D converters • Difficulty encountered in utilizing multiple input bits at once • Keypad • Difficulty encountered in getting the KBD example code to successfully interface with our PIC
Troubleshooting • Multiple defective pressure sensors, and each has a slightly different response • Have to be sure pressure sensors are not melted from soldering • A method had to be devised to turn the current to a measurable voltage • PIC accidentally fried at 7V and another at 12V • Placement of sensors • LED mapping using PIC • Learning A/D code
Future Considerations • Wireless sensors • Circuit on PCB • Use of actual bed instead of cot • More accurate timing of clock counter • Easy interface to input alarm times • More aesthetic product (no duct tape in actual product)
Sales Pitch • “Never be late again with the smart alarm clock” • Ideal gift for someone who oversleeps • Appealing to busy college students and workers • Little hassle to set-up; sensors will take care of the alarm • Product guaranteed to make you leave your bed • Waking up has never been easier
Acknowledgements • Professor Swenson, Mo, and Marty, our favorite professors and TAs • Amit ECE 411 TA • Jim Wehmer and all the other part shop staff • Machine Shop • www.datasheetarchive.com