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
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
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
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
Figure D2 Temperature Sensor Schematic
Figure D3 Mechanical Schematic of the Smoke Sensor T-Shaped Chamber
Figure D4 Smoke Sensor Schematic
Figure D5 Tone Generator and Speaker Schematic
Figure D6 Transmitter and Receiver Schematic
APPENDIX E – PIC MICROCONTROLLER CODE
Table E1 is the actual PIC microcontroller program and code.
Table E1 PIC Microcontroller Code
/******************************************************************************\
* *
* P R E P R O C E S S O R D I R E C T I V E S *
* *
\******************************************************************************/
//#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
// 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);
/******************************************************************************\
* *
* M A I N R O U T I N E *
* *
\******************************************************************************/
#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
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(); // Read in the value of the ADC
delay_us(50000);
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(); // Read in the value of the ADC
delay_us(50000);
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
{
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);
}
}
}
}
}
}
// 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);
}
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
Figure F2 Smoke Sensor Resistance at 470 ohms
Figure F3 Smoke Sensor Resistance at 750 ohms
Figure F4 Smoke Sensor Resistance at 2.6K ohms
Figure F5 Smoke Sensor Resistance at 5.1K ohms
Figure F6 Transmitter and ReceiverWirelessRange Data
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 / Module Needed For / PriceLM235AH / National / Temperature Sensor / Temperature Sensor / $5.49
RMX-900-HP3 / Linx / Receiver / Receiver / $43.40
TMX-900-HP3 / Linx / Transmitter / Transmitter / $29.45
ANT-916-PW-LP / Linx / Antenna / Receiver / Transmitter / $1.79
PIC16F877A / Microchip / PIC / PIC / $4.94
276-142, 276-143 / Radio Shack / LED and Phototransistor / Smoke Sensor / $3.29
PVC Pipe / Home Depot / PVC Pipe / Smoke Sensor / $2.99
MN1604B1Z / Duracell / 9V Alkaline Battery / Smoke Detector / $1.99
LM555CM / National / Timer / Tone Generator / $0.64
74ALS253AN / ECE Parts Store / 4-to-1 Dual MUX / Tone Generator / $0.79
GC0401K / CUI / Speaker / Speaker / $2.99
Misc. (resistors, capacitors, etc.) / ECE Parts Store / Resistors / Testing Purposes / $2.88
TOTAL / $100.64
Table G2 Cost of Labor
Hourly Rate / Total Hours / Number of Persons / Total Labor Cost$50 per hour / 140 hours / 2 persons / $14,000
APPENDIX H – PICTURES
Figure H1 shows a photo of the smoke detector unit in its completion and entirety.
Figure H1 Final Smoke Detector Unit
REFERENCES
[1]M. Brain, “How Smoke Detectors Work,” June 1995,
m.
1
A.