Building a Smart Mousetrap with PIC12F683 and Infrared Technology
In this innovative mousetrap design, the core component is the PIC12F683 microcontroller, which orchestrates the entire system. Key to its functionality is an infrared transmissive optical sensor, meticulously modulated at a frequency of 38 kHz. This modulation ensures immunity to ambient light interference. The PIC, serving as the brain of the mousetrap, generates the 38 kHz signal at port GP2, which is seamlessly connected to the IR LED. The infrared receiver utilized here is a specific type commonly employed in remote controls, designed to exclusively respond to 38 kHz signals. It dutifully communicates the presence of an infrared signal back to the PIC via port GP1. Upon the interruption of the IR light beam, the PIC swiftly takes action, deactivating the relay through port GP4 and FET T1. This, in turn, triggers the closing mechanism of the mousetrap door.
Mice-Friendly Mousetrap with Transmissive Optical Sensor
Within the confines of a small wooden box, you’ll find a transmissive optical sensor discreetly nestled. This wooden haven also houses a tempting morsel of food. As a mouse traverses the path and interrupts the light beam on its quest for the delectable treat, a captivating sequence unfolds. The door, usually held open by a disassembled relay coil, springs into action, promptly shutting behind the unsuspecting guest. Simultaneously, an LED commences a flashing spectacle. To ensure the mouse’s comfort, a piece of glass or transparent plastic adorns the box’s top, eliminating the need to venture into darkness. Once a mouse is apprehended, it can be compassionately released far from your dwelling.
Mousetrap Reset: Ready for the Next Capture
To prepare the mousetrap for its next potential visitor, a simple press of the reset button is all that’s needed. The ingenious author behind this device has successfully caught dozens of mice with its help.
PICBASIC Pro Program for Download
The program driving this intelligent mousetrap is thoughtfully written in PICBASIC Pro. This code is freely available for download from the Elektor website, residing in archive file # 100308-11.zip.
Exploring the PIC12F683’s Program Space
The PIC12F683 boasts a 13-bit program counter, allowing it to address an 8k x 14 program memory space. However, in practice, only the first 2k x 14 (0000h-07FFh) is physically implemented for the PIC12F683. Attempts to access locations beyond these boundaries result in a wraparound within the initial 2K x 14 space. Notably, the Reset vector is positioned at 0000h, while the interrupt vector resides at 0004h.