APPENDIX A - BLOCK DIAGRAMS Figures A1 is a block diagram and general design overview of the smoke detector unit. Figure A1 Smoke Detector Unit Smoke Detector Unit Transmitter Tone Generator / Speaker Receiver PIC Microcontroller Smoke Sensor Temperature Sensor A.1 Low Battery Sensor APPENDIX B – FLOW DIAGRAMS Figures B1 is the PIC microcontroller flow diagram. It illustrates the flow of the program code and the priority status of the smoke detector’s alarms. Figure B1 PIC Microcontroller Flow Diagram Temperature Sensor Temperature threshold of 125°F reached? Yes No Receiver RF signal received from another detector’s transmitter? Yes No Smoke Sensor Smoke detected? Yes No Low Battery Sensor Battery measured below 3.5V? Yes No No PIC Microcontroller Temperature sensor, receiver, smoke sensor, or low battery sensor has been set off? Yes Transmitter A.2 Tone Generator / Speaker APPENDIX C - DIAGRAMS Appendix C illustrates diagrams pertaining to the various modules of the smoke detector unit. Figure C1 Smoke Sensor T-Shaped Chamber without Smoke Present Figure C2 Smoke Sensor T-Shaped Chamber with Smoke Present Figure C3 Smoke Sensor Ionization Chamber A.3 APPENDIX D – SCHEMATICS Appendix D illustrates the schematics of all the hardware components and modules—PIC microcontroller, low battery sensor, temperature sensor, smoke sensor, tone generator, transmitter, and receiver. Figure D1 PIC Microcontroller and Low Battery Sensor Schematic R1 46K 01-MCLR 32-Vdd 02-RA0 31-Vss 03-RA1 25-RC6 To 09-CD4052BN #1 From 276-143 04-RA2 24-RC5 To 10-CD4052BN #1 From 18-RMX-900-HP3 05-RA3 23-RC4 To 10-CD4052BN #2 From 02-LM235AH 11-Vdd 12-Vss 13-OSC1 5Vdc To 13-RMX-900-HP3 To 09-TMX-900-HP3 To 12-TMX-900-HP3 15-RC0 16-RC1 17-RC2 PIC16F877A 01-Vcc 02-Out ECS-100AC 6.000MHz 03-GND Figure D2 Temperature Sensor Schematic To PIC Pin 2(RA0/AN0) LM235AH R1 V- V+ To Vcc 1k ADJ R2 10k A.4 Figure D3 Mechanical Schematic of the Smoke Sensor T-Shaped Chamber 1.5 in. 0.6 in. 0.6 in. Figure D4 Smoke Sensor Schematic R1 2.6K V1 5Vdc Infrared Emitter To PIC16F877A(04-RA2) Infrared 276-143 A.5 Figure D5 Tone Generator and Speaker Schematic V+ V- R4 SPEAKER R5 Timer 7 5 4 6 2 8 DSCHG 47k OUT 3 120k 33k R1 CV RST THR TRG R3 GND VCC 1 15k 56k R2 3k LM555 Mux #2 Mux #1 R6 12 14 15 11 1 5 2 4 10 9 6 7 16 X0 X1 X2 X3 X Y 13 3 12 14 15 11 1 5 2 4 Y0 Y1 Y2 Y3 GND 8 4052 3 EN 7 16 C4 CAP 0.1uF 13 A B 6 EN X Y Y0 Y1 Y2 Y3 10 9 A B VEE VDD X0 X1 X2 X3 VEE VDD GND 8 4052 C3 CAP 0.1uF To Vcc C1 From PIC: Pin 23 (RC4/SDI/SDA) CAP 0.01uF From PIC: Pin 25(RC6/TX/CK) C2 From PIC: Pin 24(RC5/SDO) CAP 0.01uF A.6 Figure D6 Transmitter and Receiver Schematic Testing Purposes Only RMX-900-HP3 9-NC 18-DATA 17-Audio. To PIC: Pin 5 (RA3/AN3) 16-VCC C2 14-RSSI 2-GND 13-PDN CAP 0.1uF To PIC: Pin 15 (RC0) 10-CSO R1 ANT2 ANTENNA 11-CS1 10 Ohm C4 12-CS2 Power 1-Ant 3->8 - GND 15-Mode GND CAP 10uF R2 10 Ohm C3 CAP 10uF ANT1 ANTENNA TMX-900-HP3 Power 2-Ant 8-Vcc GND 10-DATA From PIC: Pin 17(RC2) 3-CSO 4-CS1 5-CS2 9-Mode 6-CTS C1 1 - GND 7-PDN From PIC: Pin 16(RC1) CAP 0.1uF To Vcc A.7 APPENDIX E – PIC MICROCONTROLLER CODE Table E1 is the actual PIC microcontroller program and code. Table E1 PIC Microcontroller Code /***************************************************************************** *\ * * * PREPROCESSOR DIRECTIVES * * * \***************************************************************************** */ //#include <18F452.h> #include <16F877A.h> // <-- This is the type of PIC you're using. // Other supported PICs are in: // C:\Program Files\PICC\Devices //#device ICD=TRUE #device *=16 ADC=10 // Use 16-bit pointers, use 10-bit ADC #fuses HS // You may or may not want some of these .... #fuses NOWDT #fuses NOPROTECT #fuses NOLVP #fuses NODEBUG #fuses NOPUT #fuses NOBROWNOUT #use delay(clock=6000000) // What speed clock do you want today? // These require use of Set_Tris_x() #use fast_io(A) #use fast_io(B) #use fast_io(C) //#use fast_io(D) // End Preprocessor Directives // Always a good idea to write clean code, makes changes easy //#include "Include\Compiler.h" //#include "Include\Globals.h" // A/D + Buttons #define MY_TRISA 0b11111111 #define MY_TRISB 0b11111111 #define MY_TRISC 0b00000000 #define MY_TRISD 0b00000000 #define FOREVER 1 A.8 // RX pins #define RX_PD PIN_C0 // out (active low) #define RX_DATA PIN_B0 // in #define RX_CHS0 PIN_D3 // out #define RX_CHS1 PIN_D4 // out #define RX_CHS2 PIN_D5 // out // TX pins //#define TX_CTS PIN_B1 // in #define TX_PD PIN_C1 // out (active low) #define TX_DATA PIN_C2 // out #define TX_CHS0 PIN_D0 // out #define TX_CHS1 PIN_D1 // out #define TX_CHS2 PIN_D2 // out void initADC(void); /***************************************************************************** *\ * * * MAIN ROUTINE * * * \***************************************************************************** */ #pragma zero_ram // Interesting command .... void main( void) { int16 ADC_0; int16 ADC_1; int16 ADC_2; int16 ADC_3; int16 temp; int16 battery; int16 smoke; int16 receiver; ADC_0 = 0; ADC_1 = 0; ADC_2 = 0; ADC_3 = 0; temp = 665; battery = 716.8; smoke = 1007.616; receiver = 40.96; delay_ms(500); // wait for voltages to stablize Set_Tris_A(MY_TRISA); // Port A's I/O Set_Tris_B(MY_TRISB); // Port B's I/O A.9 Set_Tris_C(MY_TRISC); // Port B's I/O Set_Tris_D(MY_TRISD); // Port B's I/O initADC(); output_low(TX_PD); output_low(RX_PD); delay_ms(100); output_high(TX_DATA); output_high(RX_DATA); while(FOREVER) { delay_us(50); set_adc_channel( 0 ); delay_us(10); ADC_0 = read_adc(); delay_us(50000); // Read in the value of the ADC if (ADC_0 > temp) { output_low(PIN_C4); output_low(PIN_C5); output_high(PIN_C6); output_low(RX_PD); delay_ms(100); output_high(TX_PD); delay_ms(100); output_low(TX_DATA); } else { set_adc_channel( 2 ); delay_us(10); ADC_2 = read_adc(); delay_us(50000); // Read in the value of the ADC if (ADC_2 > smoke) { output_high(PIN_C4); output_low(PIN_C5); output_high(PIN_C6); output_low(RX_PD); delay_ms(100); output_high(TX_PD); delay_ms(100); output_low(TX_DATA); } else A.10 { output_low(TX_PD); delay_ms(100); output_high(RX_PD); delay_ms(100); set_adc_channel( 3 ); delay_us(10); ADC_3 = read_adc(); // Read in the value of the ADC delay_us(50000); if ( ADC_3 < receiver ) { output_low(PIN_C4); output_high(PIN_C5); output_low(PIN_C6); } else { output_low(RX_PD); delay_ms(100); set_adc_channel( 1 ); delay_us(100); ADC_1 = read_adc(); // Read in the value of the ADC delay_us(50000); if (ADC_1 < battery) { output_low(PIN_C4); output_low(PIN_C5); output_low(PIN_C6); } else { output_high(PIN_C4); output_high(PIN_C5); output_high(PIN_C6); //output_high(RX_DATA); } } A.11 } } } } // End Main Routine // Purpose: Initializes ADC // Precondition: None // Postcondition: ADC is configured void initADC(void) { setup_adc_ports(ALL_ANALOG); // setup_adc(ADC_CLOCK_INTERNAL); } A.12 APPENDIX F – TEST DATA Appendix F contains various test data from different modules of the smoke detector unit. Figure F1 Smoke Sensor Resistance at 100 ohms R1 = 100 ohms Voltage @ Collector = 4.994V 5.2 5.15 Volts 5.1 5.05 5 4.95 4.9 -0.0003 -0.0002 -0.0001 0 0.0001 0.0002 0.0003 Seconds Figure F2 Smoke Sensor Resistance at 470 ohms R1 = 470 ohms Voltage @ Collector = 4.97V 5.04 5.02 Volts 5 4.98 4.96 4.94 4.92 -0.0006 -0.0004 -0.0002 0 0.0002 0.0004 0.0006 Seconds Figure F3 Smoke Sensor Resistance at 750 ohms R1 = 750 ohms Voltage @ Collector = 4.967V 5.04 5.02 5 Volts 4.98 4.96 4.94 4.92 4.9 4.88 -0.00000003 -0.00000002 -0.00000001 0 Seconds A.13 0.00000001 0.00000002 0.00000003 Figure F4 Smoke Sensor Resistance at 2.6K ohms R1 = 2.6K ohms Voltage @ Collector = 4.88V 4.96 4.94 4.92 Volts 4.9 4.88 4.86 4.84 4.82 4.8 4.78 -0.00000003 -0.00000002 -0.00000001 0 0.00000001 0.00000002 0.00000003 Seconds Figure F5 Smoke Sensor Resistance at 5.1K ohms R1 = 5.1K ohms Voltage @ Collector = 4.77V 4.88 4.86 4.84 Volts 4.82 4.8 4.78 4.76 4.74 4.72 4.7 4.68 -0.00000003 -0.00000002 -0.00000001 0 0.00000001 0.00000002 0.00000003 Seconds Figure F6 Transmitter and Receiver Wireless Range Data RSSI 3 2.5 RSSI 2 1.5 Series1 1 0.5 0 0 10 20 30 40 Distance A.14 50 60 70 APPENDIX G – COST Appendix G delineates the cost of the smoke detector unit and the cost of labor. Table G1 Cost of Parts and Overall Cost of the Smoke Detector Unit Part # Manufacturer Description LM235AH National RMX-900HP3 TMX-900HP3 ANT-916PW-LP PIC16F877A 276-142, 276143 PVC Pipe MN1604B1Z Duracell LM555CM National 74ALS253AN ECE Parts Store CUI ECE Parts Store GC0401K Misc. (resistors, capacitors, etc.) Price Linx Temperature Sensor Receiver Module Needed For Temperature Sensor Receiver Linx Transmitter Transmitter $29.45 Linx Antenna $1.79 Microchip Radio Shack PIC LED and Phototransistor PVC Pipe Receiver / Transmitter PIC Smoke Sensor Smoke Sensor Smoke Detector Tone Generator Tone Generator Speaker Testing Purposes TOTAL $100.64 Home Depot 9V Alkaline Battery Timer 4-to-1 Dual MUX Speaker Resistors Table G2 Cost of Labor Hourly Rate $50 per hour Total Hours 140 hours Number of Persons 2 persons A.15 Total Labor Cost $14,000 $5.49 $43.40 $4.94 $3.29 $2.99 $1.99 $0.64 $0.79 $2.99 $2.88 APPENDIX H – PICTURES Figure H1 shows a photo of the smoke detector unit in its completion and entirety. Figure H1 Final Smoke Detector Unit A.16 REFERENCES [1] M. Brain, “How Smoke Detectors Work,” June 1995, http://home.howstuffworks.com/smoke.ht m. A.17