Sound-Activated Security System Aaron Lebahn and Chris Jenkins Features • • • • Controlled by sound Musical note based "PIN" Humans remember melodies easier Can be used in parallel with traditional key based lock Hardware Block Diagram Operation • • • • • • User presses button to initiate entry LED turns on signifying collection Microphone accepts user whistle HCS12 processes input Correct entry "opens" servo motor Incorrect entry flashes LED Wiring Diagram Software Design • Interrupts triggered by RTI to implement regular sampling rate • Static counter keeps track when appropriate number of samples taken • Low memory requires that number of samples are low (128 or 256 samples) Program Flowchart Overview of FFT • Uses implementation of Cooley-Tukey algorithm modified to work on microprocessor • Twiddle factors hardcoded using a fixed-point format • Fixed point format consists of number shifted by 2^15 • Multiplication temporarily done in 64-bit FFT pseudocode (from Wikipedia) X0,...,N−1 ← ditfft2(x, N, s): DFT of (x0, xs, x2s, ..., x(N-1)s): if N = 1 then X0 ← x0 trivial size-1 DFT base case else X0,...,N/2−1 ← ditfft2(x, N/2, 2s) DFT of (x0, x2s, x4s, ...) XN/2,...,N−1 ← ditfft2(x+s, N/2, 2s) DFT of (xs, xs+2s, xs+4s, ...) for k = 0 to N/2−1 combine DFTs of two halves into full DFT: t ← Xk Xk ← t + exp(−2πi k/N) Xk+N/2 Xk+N/2 ← t − exp(−2πi k/N) Xk+N/2 endfor endif Memory Constraints • • • MC9S12C128 only has 2kB of RAM Limits number of samples we can take Limits amount of memory FFT can use while running. Future Improvements • • • • Allow programmable pass-tune option Alarm / Lockout system LCD user interface Consider using Goertzel's Algorithm Questions? • • • • Queries? Complements? Inquiries? Stumpers?