Microchip Mad Dash for Flash Cash – Entry # M290 Abstract (Download full entry)
Stealth Telephone Screener
Almost everyone has been annoyed at one time or another by an automated telemarketing call in the middle of dinner, to find only silence at the other end of the line. The Screener answers the phone first, and determines whether or not the caller is an actual person. If not, it hangs up without ever disturbing the user. Unlike similar commercial products, the caller does not have to know any special code, and is not even aware that they are being screened.
The Screener plugs into an ordinary phone line, and has a built-in ringer to alert the user when the caller is a real human. It works by answering the phone and playing back a brief greeting (such as "Hello"), then waiting for a response. If there is no sound for five seconds, or if there is a continuous response that lasts longer than ten seconds, then it hangs up. Otherwise, it plays a second greeting (such as "Just a minute"), and activates the ringer, while playing a ringing signal to the caller. Once the user has picked up any phone on the same line, the Screener stops ringing and releases the line. The ringers on all the phones are normally kept off, so the user would never even be aware of a machine-originated call when it comes in.
This technique eliminates both the "predictive dialing" systems that place multiple calls and only connect to the first person to answer their phone, typically after a delay of more than five seconds, while hanging up on all other calls; as well as automated systems that just play a recorded message.
The hardware is based on a PIC16F872, which was chosen for a feature set which is almost an exact match for this project. The built-in 10-bit A/D converter and PWM output, together with a pair of dual opamps for filtering and gain, digitize the incoming phone audio signal and generate the responses to the caller. An external 128K bit I2C EEPROM stores four seconds of audio using ADPCM coding, allowing the user to customize the messages. A non-isolated phone line interface rounds out the analog section; this type of DAA (data access arrangement) is normally permitted whenever there are no external I/O ports, and any battery compartment is accessible only with the use of a tool (such as a coin.)
The software implements a variable-threshold VOX algorithm to detect speech in the presence of noise,and an ADPCM encoder/decoder to allow four seconds of speech at 8 KHz sampling to be compressed to 4 bits per sample, or 4000 bytes/second. A tone generator using a pair of phase accumulators and a sine wave table generates a realistic-sounding ringing tone for the caller. An adaptive phone line voltage threshold automatically adjusts to the DC characteristics of the line to sense when a phone is picked up.




Clearer versions of the schematics
are avaiable in the full entry. (Download
full entry)

DOSTAT EQU $ ; ; This routine scans through each of the active bits in IFLAGS, ; debouncing each bit according to the debounce times in the ; corresponding ONTBL or OFFTBL entry. The SFLAG1 bits are set ; according to the ON/OFFTBL1 times, and SFLAG2 bits are set ; from the ON/OFFTBL2 times. This provides for two different ; debounce times for each input bit. ; ; 173-311 cycles ; movlw CNTRS ;pointer to debounce counters movwf FSR clrf TBLIX-d ;index into debounce threshold tables ; ; First check the current bit ; movlw 1<<(8-NSFLAGS) NXTBLP movwf MASK-d ;~28-51 andwf IFLAGS-d,w ;bit now on? beq NOWOFF ;no ; ; If the bit is on, increment the on-counters, and set the ; corresponding SFLAG1 bit if the short debounce time is reached ; NOWON incfsz INDF,w ;incr ON counter movwf INDF ;save if no overflow incf FSR,f clrf INDF ;clear OFF counter decf FSR,f ; movf SFLAG1-d,w andwf MASK-d,w ;was SFLAG1 bit on already? bne NOWON2 ;yes ; movf TBLIX-d,w call ONTBL1 ;get threshold1 subwf INDF,w ;ON counter >= threshold1? bcc NOWON2 ;no ; movf MASK-d,w iorwf SFLAG1-d,f ;set SFLAG1 bit ; ; Now repeat using SFLAG2 and the longer debounce time ; NOWON2 movf SFLAG2-d,w andwf MASK-d,w ;was SFLAG2 bit on already? bne NXTBITI ;yes ; movf TBLIX-d,w call ONTBL2 ;get threshold2 subwf INDF,w ;ON counter >= threshold2? bcc NXTBITI ;no ; movf MASK-d,w iorwf SFLAG2-d,f ;set SFLAG2 bit ; NXTBITI incf FSR,f goto NXTBIT ; ; If the bit is off, increment the off-counters, and clear the ; corresponding SFLAG1 bit if the short debounce time is reached ; NOWOFF incf FSR,f incfsz INDF,w ;incr OFF counter movwf INDF ;save if no overflow decf FSR,f clrf INDF ;clear ON counter incf FSR,f ; movf SFLAG1-d,w andwf MASK-d,w ;was SFLAG1 bit off already? beq NOWOFF2 ;yes ; movf TBLIX-d,w call OFFTBL1 ;get threshold1 subwf INDF,w ;OFF counter >= threshold1? bcc NOWOFF2 ;no ; comf MASK-d,w andwf SFLAG1-d,f ;clear SFLAG1 bit ; ; Now repeat using SFLAG2 and the longer debounce time ; NOWOFF2 movf SFLAG2-d,w andwf MASK-d,w ;was SFLAG2 bit off already? beq NXTBIT ;yes ; movf TBLIX-d,w call OFFTBL2 ;get threshold2 subwf INDF,w ;OFF counter >= threshold2? bcc NXTBIT ;no ; comf MASK-d,w andwf SFLAG2-d,f ;clear SFLAG2 bit ; ; Go to the next bit, if any ; NXTBIT incf FSR,f incf TBLIX-d,f clc rlf MASK-d,w ;any more bits? bcc NXTBLP ;yes ; return