This mousetrap is built around a PIC12F683 and uses an infrared transmissive optical sensor that is modulated at a frequency of 38 kHz so that it isn’t affected by ambient light. The modulation is carried out by the PIC, which generates a 38 kHz signal at port GP2, which is connected to the IR LED. The IR receiver is a type that is usually found for use with remote controls. It reacts only to 38 kHz signals. It reports the presence of an IR signal to the PIC via port GP1. When the IR light beam is broken the PIC turns off the relay via port GP4 and FET T1, which causes the door of the mousetrap to close.
The transmissive optical sensor is housed inside a small wooden box. A small amount of food is placed inside this box. When a mouse walks through the light beam on its way to the food it causes the door to shut it and an LED starts flashing. The door is normally kept open by the coil of a relay that has been taken apart. When the coil is no longer powered the tin door is pushed shut by means of a spring. A piece of glass or transparent plastic should be put on top of the box so that the mouse doesn’t have to enter a dark space. When a mouse has been caught it can be set free again somewhere outside, some distance away from the house.
The reset button has to be pressed to ready the trap for its next victim. The author has managed to catch a few dozen mice with this device.
The program is written in PICBASIC Pro and can be freely downloaded from the Elektor website, it is found in archive file # 100308-11.zip
The PIC12F683 has a 13-bit program counter capable of addressing an 8k x 14 program memory space. Only the first 2k x 14 (0000h-07FFh) for the PIC12F683 is physically implemented. Accessing a location above these boundaries will cause a wraparound within the first 2K x 14 space. The Reset vector is at 0000h and the interrupt vector is at 0004h.