Introduction: Flatulant Boss Detector

The older I get, the smaller my cubicle gets. In fact, I don't even have a cubicle now. But my boss used to walk in undetected and catch me doing research for some assignment (WWW - to the boss it looked like web surfing) and he would tell me to get to work. I wanted to put a cowbell around him, but I'm sure he wouldn't go for it, so I had to come up with something else. (note - the title should be "Flatulent.")

Step 1: Picked Up This Nifty Noise Maker for About 6 Bucks in the Toy Section of the Food Store.

You can read the package for yourself. It has about 6 different random "tunes." But, the key item is the little RF remote button that comes with it.

Step 2: And I Found This Little Gem in WalMart for About $5.00.

Obviously it turns on a little light (LED) when motion is detected, and the room is dark. (Hmmmmm, I wonder if I could...)

Step 3: Okay. Let's Crack Open the Motion Sensor and Have a Look See...

Well, I labeled everything. The photocell (not shown, but trust me, it's there) is to prevent the light (LED) from coming on during the daytime, and therefore prolongs the battery life.

The Fresnel lens is there to provide a wide field-of view for the motion sensor. Fresnel is pronounced frie-nel, look it up on Wikipedia for more info.

Step 4: Let's Do Some Hackin'

First, you see that PIR motion detector. PIR means "Passive infra-red." Some people call it a "Pyro infra-red." I don't know why. Regardless, we wont hack that. We might need for something later.

Next, we've (well, me...but the royal we) have covered up that photocell I told you about. You see, I want my boss-detector to be active day and night. So, by covering it up, it thinks it's in the dark even when the lights are on. But, we've just pulled the wool over his eyes (actually one eye,) and he/she is now kept in dark.

And you can see that we have installed our own photocell right next to the LED. That little trick lets us know when the LED comes on because motion had been detected. Of course we could have ran a wire from the LED to achieve the same purpose, but where's the fun in that. The fun thing about hacking is to hack it differently than other hackers, as in the other electrical engineers. And that makes your hack a true original.

Step 5: The Photocell Circuit.

The photocell, such as you can buy at Radio Shack, has a resistance of about 50k ohms with no light exposure, and about 5k ohms or less when exposed to a bright light. So, if we use a resistor in series with the photocell, which is just a resistor, and tie them to a voltage source and ground, then we have a voltage divider. From there, tapping in between the two resistors provides a voltage signal which goes high or low, and can be used to trigger a device. In this case the motion detector uses 3xAA batteries, which is 4.5 volts. And this is how the circuit is wired to provide the signal needed to drive some other electronics. With the LED off, the circuit signal is about 1.7 volts, with the LED on, the signal rises to about 3.5 volts, which is enough to trigger a micro-controller

Step 6: Hacking the Remote Control Whoopee Button.

There's a button, which means somewhere there two pins, that when close-circuited, causes the whoopee cushion to do it's thing. The pins are fairly obvious, so I didn't show that part. But, I drilled a little hole and ran a pair of wires to the button pins. And, using a 5v reed relay from Radio Shack, I can connect the two pins by energizing the reed relay.

Step 7: Now for the Tricky Part.

It's not really that tricky if you know a little about electronics, but the deal is that you need to use the trigger signal to activate the system. You can use a one-shot timer, or a comparator, or a 555 timer, but, for me, the easiest thing is to use an 8-pin micro-controller. I used a PIC Micro 12F675. With that, I could trigger on input change of a pin, and flash a red LED. Also, if 5 people walk in I don't want the thing going crazy for 15 seconds, so I put in a 30 second delay so I could hit a kill switch and shut it off. So, I'll just fast-fwd and show the end result of the contraption. Note, I covered the LED so that the ex-boss would not see a light turn on every time he barged into my humble 1/4 of a cubicle.

This pic is the end product. I'll leave the electronics as an exercise for the student.

Here's the code for the PIC Micro 12F675:

;*****************************************************************************
; File name: Flatulant_Boss
; Processor: 12F675
; Author: Alan Mollick (alanmollick.com)
; Mode: Interrupt on GP2 change
;
; ~ GPIO REGISTERS ~
; GP0 = INPUT -- n/c
; GP1 = OUTPUT -- relay
; GP2 = INPUT -- High = motion detected
; GP3 = INPUT -- n/c
; GP4 = OUTPUT -- Red LED
;*****************************************************************************
list p=12F675 ; list directive to define processor
#include <p12f675.inc> ; processor specific variable definitions
errorlevel -302 ; suppress message 302 from list file
CONFIG _CP_OFF & _CPD_OFF & _BODEN_OFF & _MCLRE_OFF & _WDT_OFF & _PWRTE_ON & _INTRC_OSC_NOCLKOUT

; ~ Variables ~
w_temp EQU 0x20 ; variable used for context saving
status_temp EQU 0x21 ; variable used for context saving
hiB EQU 0x21 ; MSByte
lowB EQU 0x22 ; LSByte
temp EQU 0x23
spare EQU 0x24
temp1 EQU 0x25 ; trigger interrupt flag
temp2 EQU 0x26
delay EQU 0x27 ; delay time
pins EQU 0x28 ; pin state
spare1 EQU 0x29
spare2 EQU 0x2a
count EQU 0x2b ; loop count
count1 EQU 0x2c ; outer loop count
count2 EQU 0x2d ; outer loop count
d1 EQU 0x2e ; delay counter
d2 EQU 0x2f ; delay counter
d3 EQU 0x30 ; delay counter
d4 EQU 0x31 ; delay counter
;**********************************************************************

RESET_VECTOR ORG 0x000 ; processor reset vector
goto main ; go to beginning of program
INT_VECTOR ORG 0x004 ; interrupt vector location
movwf w_temp ; save off current W register contents
movf STATUS,w ; move status register into W register
movwf status_temp ; save off contents of STATUS register

; isr code
call motion_detect ; send alarm signals

banksel INTCON
bcf INTCON,INTF ; clear GP2/INT flag

movf status_temp,w ; retrieve copy of STATUS register
movwf STATUS ;restore pre-isr STATUS register contents
swapf w_temp,f
swapf w_temp,w ; restore pre-isr W register contents
retfie ; return from interrupt
;****************************************************************

main: ; main program

; these first 4 instructions are not required if the internal oscillator is not used
call 0x3FF ; retrieve factory calibration value
bsf STATUS,RP0 ; set file register bank to 1
movwf OSCCAL ; update register with factory cal value
bcf STATUS,RP0 ; set file register bank to 0

;***********************************
;* Initialization *
;***********************************
; GP0= not used, GP1=relay output, GP2=input (motion detect),
; GP3=input for cntrl/emergency cutoff, GP4=output to LED indicator,
; GP5= not used

; set up direction of I/O pins
banksel TRISIO
movlw b'00000101'
; xx------ not implemented
; --0----- 0=output, GP5=n/c
; ---0---- 0=output, GP4=LED
; ----x--- not used, GP3, Dedicated to MCLR
; -----1-- 1=input, GP2 motion detected
; ------0- 0=output, GP1 = solenoid valve
; -------1 1=input GP0=A/D
movwf TRISIO

; set up A/D converter
banksel ANSEL
movlw b'00010000'
; x------- not implemented
; -001---- 001=Focs/8 Conversion Clock
; ----0--- 0=digital I/O, GP4, Fosc/4 clockout for debug purposes.
; -----0-- 0=digital I/O, GP2
; ------0- 0=digital I/O, GP1, relay/etc
; -------0 0=digital I/O, 1=analog GP0
movwf ANSEL

banksel ADCON0
movlw b'00000000'
; 0------- 1=right justified result
; -0------ 0=Vdd is voltage reference
; --xx---- not implemented
; ----00-- 00=select channel 0 (GP0)
; ------0- 0=A/D conversion not started
; -------0 0=A/D converter module is off
movwf ADCON0

; initialize output pins
init
banksel GPIO
movlw b'00000000'
movwf GPIO

; initialize interrupts
banksel INTCON
movlw b'00000000'
; 0------- 0=global interrupts disabled
; -0------ 1=enable peripheral interrupts
; --0----- 0=disable TMR0 overflow interrupt
; ---1---- 1=enable GP2/INT external interrupt
; ----0--- 0=disable GPIO port change interrupt
; -----0-- 0=no on TMR0 overflow
; ------0- 1=
; -------0 0=no GPIO port change
movwf INTCON

; initialize interrupt on pin change GP2
banksel IOC
movlw b'00000100'
; x------- not implemented
; -x------ not implemented
; --0----- 0=disable GP5
; ---0---- 0=disable GP4
; ----0--- 0=disable GP3
; -----1-- 1=enable GP2/INTR *****
; ------0- 0=disable GP1
; -------0 0=disable GP0
movwf IOC

banksel PIE1
movlw b'00000000'
; 0------- 0=disable EE write complete interrupt
; -0------ 0=disable A/D converter interrupt
; --xx---- not implemented
; ----0--- 0=comparator interrupt disabled
; -----xx- not implemented
; -------0 1=enable TMR1 overflow interrupt
movwf PIE1

banksel PIR1
movlw b'00000000'
; 0------- 0=no EE write complete
; -0------ 0=no A/D conversion complete
; --xx---- not implemented
; ----0--- 0=no comparator interrupt
; -----xx- not implemented
; -------0 0=no TMR1 overflow
movwf PIR1

;**********************************************************
; GP1=output to relay
; GP4=output to LED
;**********************************************************

banksel INTCON
bsf INTCON,INTE ; enable GP2 interrupt
bsf INTCON,GIE

Main_Loop:
; if GP2=1 then output alarm signals on GP1, GP4 via interrupt

sleep
nop
goto Main_Loop

;**********************************************************
; Motion Detection Interrupt Handler
;
; GP1=output to relay, GP4=output to LED
;**********************************************************
motion_detect:
bsf GPIO,1 ; energize relay for 100 msec
call pause_100ms
bcf GPIO,1 ; de-activate relay

bsf GPIO,4 ; activate LED for 0.5 sec.
call pause_500ms
bcf GPIO,4
return

;**********************************************************
; online Delay Code Generator
; http://massmind.org/techref/piclist/codegen/delay.htm
;**********************************************************

pause_100msec:
; Delay = 0.1 seconds
; Clock frequency = 4 MHz

movlw 0x1F ;99998 cycles
movwf d1
movlw 0x4F
movwf d2
Delay_100
decfsz d1, f
goto $+2
decfsz d2, f
goto Delay_100
goto $+1 ;2 cycles
return

pause_500msec:
; Delay = 0.5 seconds
; Clock frequency = 4 MHz
movlw 0x03 ;499994 cycles
movwf d1
movlw 0x18
movwf d2
movlw 0x02
movwf d3
Delay_500
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto Delay_500

goto $+1 ;6 cycles
goto $+1
goto $+1
return

pause_1sec
; Delay = 1 seconds
; Clock frequency = 4 MHz

movlw 0x08 ;999997 cycles
movwf d1
movlw 0x2F
movwf d2
movlw 0x03
movwf d3
Delay_1sec
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto Delay_1sec
goto $+1 ;3 cycles
nop
return

;*****************************************************************************

Step 8: Final Words.

This pic is one way to conceal everything.

Note - by using a micro-controller, the number of variations on this instructable are unlimited. You can place the speaker so it the sound emanates from behind your boss. Or, you can tie it into the company PA system. You can even have the system ping your computer and have a work related page pop up in 1/10 of a second so that any time that your ex-boss, or anybody else walks into your perimeter, there's always a spreadsheet, or technical document that you should be working on. And 24/7...anybody walking into your cubicle, or out of it, can say that you have your nose to the grindstone every second of the day. That makes you a high valued employee. You are a goddam workaholic.

Also, you don't really need the Fresnel lens. In fact, for boss-detection, it's better to remove it otherwise people inside your cubicle moving around will set it off. You can take the Fresnel lens off and put a 1 inch piece of PVC tubing (1/2 inch diameter from Home Depot) on the PIR detector and that will give you a very narrow field of view, such as directly at you doorway (assuming you have a door) but the sensor works just as well. It's range is about 5-10 feet without the Fresnel lens. You can also remove the PIR detector and using 3 wires, you can place the detector anywhere to make it concealed.

You can even buy a sound module for 6 bucks, and record your own sounds. You can use the international signal for "boss is approaching" which is clearing your throat. And you can change it every morning. Or record the sound of you typing feverishly, etc.

Here's a sound effect I made from that whoopee cushion, and ran it into my computer, edited it with Audacity, and used it for an Easy Button hack that I might put up one day.
http://www.pneumagic.com/instructables/flatulantbossdetector/woopee-cushion-EZ-button.mp3


Step 9: A Variation

Here's another boss detector based on the same concept. Also, somebody wanted a video, so I'll put up a video for this soon. The detector for this one is obviously a Robo Sapien mated to a motion detector from Home Depot. When motion is detected, the robot sends an IR signal to the bird cage where there is a hidden 38khz detector. The bird mechanism has several options. All options are individually selectable, but with everything turned on, the bird starts spinning, chirping, with a blinking LED. Also I added a superbright red LED mounted underneath that flashes 4 times so that you know somebody is coming without all the racket. This one also has a 30 second time delay, and you can disable the whole thing simply by lifting the pencil. The pencil has a magnet on the end which, when inserted into the bird feeder, enables the circuitry by way of a small magnetic reed relay. The only real difference in this system is that I didn't use the photocell trick. There's a quad op-amp in the motion detector, and I just tapped off the output pin of the final stage. I bought several of these bird things at a drug store because they were on sale for 5 bucks each. Then I added stones and vegetation in order to hide the IR detector, and made a little box out of cherry wood and varnished it to hide the extra AA battery I needed. The thing runs on 2 AA batteries, and is sound activated. I made it less sensitive to sound, and needed the extra battery because the 38khz detector I used needed at least 4.5 volts, which means 3 batteries. The motion detector was made to plug into a wall outlet, so I cut the big stuff off the circuit board and now it runs off of a 9v battery installed where the light bulb was located.

Here's a link to a video of this.

video