Build a Better Mousetrap
They say, “necessity is the mother of invention”. Well, if that’s true then this project is living proof! Mice beware of the Mouse Motel! This project is designed for mice, but could also be adapted to catch larger rodents and animals as well.

History
If you’re easily grossed out, you may not want to read this part (skip ahead to the design section), but this is what got me started on building this project. My family used to live out in the country in Western NY. It was a nice area, and we lived in a small house. Of course, being rural we had mouse problems. Normally we would stick a piece of cheese in a snap-trap and call it good. We had mixed results. Either the mouse would take the cheese and not set off the trap, or they’d get caught, but make a mess out of the area where the trap was set! Worse yet, if we didn’t remember to check the trap, our first indication we caught something was the smell of a decaying mouse.
We used to own a computer shop. When we first moved our shop downtown, we were busy for the first two weeks with getting things set up. We were gone all day, and so we would come home, eat dinner and go to bed. One day (it was a hot one too) we came home and there was this awful smell coming from in the house…the kind that makes you start gagging as soon as it hits you. Upon entering the house, we noticed that there were literally hundreds of flies, something we normally kept under control (I hate flies). My wife suggested that I check the garbage and mouse traps. The last one we checked was one we put in the back of our food cabinet where the water lines travel between rooms, providing the mice with a path between rooms.
As soon as we opened the cabinet we knew we were in trouble. Crawling around our cans and boxes of food were hundreds of maggots! We took a flashlight and looked in the back of the cabinet, and there was the remains of a mouse in the trap crawling with maggots. Suffice it to say, by the time we got done cleaning that mess up we vowed to never have to go through that again! I told my wife I would never again use a snap trap. She said to me, “You’re an engineer. Design a better mousetrap!” Thus, the Better Mousetrap was born.
Designing a Better Mousetrap
I thought about how a mousetrap works, its limitations and ultimately, what we wanted. The result was an over-engineered, overpriced, hastily built project, made from random parts from my parts bins. I designed and built a prototype one day, then built the actual project the next day. The features were based on the factors that led to our situation. First, we didn’t think to check the trap because we were busy, and we simply didn’t notice it until it was too late. Also, we needed to keep the mouse alive so that it wouldn’t decompose and draw flies and / or ants.
We used to have an answering machine that would alert you to new messages by beeping every 10 seconds or so. That way when you come home, if you don’t think to check the machine, you’d still be alerted that there are new messages. I liked this idea and decided to borrow it for this project. We needed to know when a mouse was caught so we could deal with it as soon as possible. We also needed to catch the critter alive, just in case we were gone away for a while. And of course, we didn’t want a mess! Obviously mangling the mouse was out of the question. My wife doesn’t like the idea of killing anything anyway and so a live-catch trap was required. All creatures have their place…just not in our home.
The idea was simple. A small enclosure that the mouse would enter and break an IR beam, like how some alarm systems work. When the beam is broken a door closes, trapping the mouse and alerting us to capture. It sounded so easy. I just needed to prove the theory on my bench before building it.

Here’s how it all came to be…once I got the idea, I threw together this quick prototype (Figure 2) so I could see how involved it would end up being. For simplicity (overkill, really) I am using a 2×16 LCD and the sensors aren’t hooked up. Instead, I am manually triggering the servo to move. The Better Mousetrap uses a BS2-OEM from Parallax, which may seem a bit overkill, especially with the IR beam break sensor, comparator, LCD, buzzer and servo, but I had the extra parts laying around the bench. Wouldn’t Rube Goldberg be proud?
Building a Better Mousetrap
Once I finalized the hardware design it was time to move everything to a more permanent form. The RadioShack solder-ring board shown in Figure 3 is a perfect match for the breadboard I designed the prototype on, so I used it. The power supply is a 6VDC wall adapter I salvaged from an old answering machine. Probably the same one I got the alert idea from. The various components are shown in the photo. I have labeled the important sections.
Figure 4 shows the LCD I used for the final project. Labeled LM575, this 1×15 character display appears to have come from an electric typewriter or word processor. It has icons for typewriter functions, although I did not use them in this project. I acquired this display from a surplus house called BG Micro. While a bit overkill, it was a fun addition to display status of the trap. Only one line was needed for the status messages.
Figure 5 shows the back side of the LCD, I soldered some wires with SIP sockets to the display to make it easy to connect to the SIP header I installed on the control board. These were mainly wire harness assemblies salvaged from old computers I had laying around the shop. The left one is a CD-ROM audio cable and the right one is the front panel connectors for an HP computer. These work well for this type of connection. Even better if both ends have the connectors intact.
The enclosure (Figure 6), a $5.00 box from Radio Shack, has been drilled and the IR LED and Phototransistor have been installed about 2/3 of the way into the box. Next the servo and LCD mounting brackets have been installed on the cover (Figure 7). The wires for the IR LED and Phototransistor are brought to the top. Finally, the control board and LCD were also installed (Figure 8). After connecting all the wires for the sensors, LCD and servo to the control board we’re ready to download the calibration programs to the BASIC Stamp 2 and test everything. At this point a standard servo horn is installed on the servo until you’re ready for calibration.

Use the BASIC Stamp Editor to open BASIC Stamp (BS2) programs. Click the RUN button to download and run a program. Once the program, MOUSETRAP_V1.BS2 has been downloaded, the servo moves to the open position, and the LCD displays the “AWAITING MOUSE!” message (Figure 9). This lets you know the LCD and piezo are working. This is the point where you need to calibrate the servo position and install the acrylic door. This is done by running the two servo calibration programs.
Door Assembly
The door is a piece of acrylic attached to a round servo horn, though you could use a cross / 4-way servo horn. The door, when attached to the servo will cover the entry hole in the closed position, but can open to expose the hole, allowing mice to enter. In my case, I attached the horn to the front of the door to get it closer to the servo.

Figure 10 shows the door attached to the servo. In order to attach the servo horn to the acrylic door, there are holes in the acrylic that line up with holes in the servo horn. There also needs to be a hole in the acrylic around the center of the servo horn for the spline of the horn to go through the acrylic door. You could mount the door to the top of the servo horn, but you would have adjust the position of the servo to make sure the door is <1/16″ from the enclosure.
Door Calibration
There are two programs for the door calibration. One program moves the door to the closed position, while the other moves the door to the open position. Since servo positions vary, follow the instructions in the calibration programs. To begin, remove the standard servo horn from the servo, if installed.
First, run the DOOR_OPEN.BS2 program. This moves the servo to it’s center position. This is when you install the servo horn with the acrylic door attached, as shown in Figure 11. Now run the DOOR_CLOSED.BS2 program. The door should move ~90° counter clockwise away from the entry hole as shown in Figure 12. If the door opens properly, you can now install the servo horn mounting screw.
Door Adjustment
If the door does not open far enough or opens in the wrong direction, remove the servo horn mounting screw and try the following:
If the door does not open far enough, open the DOOR_OPEN program and edit the constant, ServoPos from *** INCOMPLETE ***
If the door opens in the wrong direction, open the DOOR_CLOSE.BS2 and edit the constant, ServoPos from *** INCOMPLETE ***
Ready for Action
The completed system is ready to start catching mice! When the mouse enters the box and breaks the beam, the trap door closes. We put the trap into service and, as it turns out we caught three mice in a row over several days. Peanut butter was the preferred bait, although we did try cheese as well. Mice are mostly nocturnal, so it goes without saying, if you’re using the trap inside, prepare to be woke up during the night when a mouse is caught, unless you’re a heavy sleeper.
Escaped Mouse Flees for Life! Film at Eleven!
Well, it happened; mouse #4 ate his way out of the box by chewing around the edges of the entrance hole until it bored an opening off to one side of the door, which it squeezed through, pushing the trap door aside. Late at night we don’t usually hear the trap unless we get up during the night. By the time I got to it the mouse was gone!

Figure 13 shows the damage that was done. This is partly my own fault since mouse #2 had started chewing, I should have known this was going to be a problem with the plastic case. I had programmed the BS2 to loop toggling the buzzer and LED on / off when a mouse was caught, but I did not refresh the servo, so it was lax once it closed. I figured there was no way a mouse could push that door aside, since they couldn’t get a grip on it. But once mouse #4 chewed through enough of the cabinet it was easy to get leverage and push the door aside.

The solution was to cut out this metal enclosure cover (Figure 14) with a slightly smaller hole than the case originally had and bolt it inside the cabinet. Now let’s see these little guys chew their way out of the cabinet! I also fixed the servo issue by updating the code so that the servo is refreshed while the LED and buzzer are pulsating so that it resists a change in position. It will take Mighty Mouse to break out now!

Figure 15 shows the repaired enclosure. This was completed a few days after the incident. The trap was put back into service and that night we caught mouse #4 again (we’re sure it’s the same mouse). T This time it didn’t get away, though it made an awful racket trying to chew through the metal though. Oh, the sound of teeth on metal is as bad to me as fingernails on a chalkboard is to some others!
Other Live-Catch Mousetraps
As a side-note and for those who pointed it out to me, there is a company, Kness Pest Defense that makes a live catch trap that can even catch multiple mice unattended. It is a simple, yet clever device. However, the device doesn’t alert you to having caught any mice and best I can tell, the only way to know is to try and empty the trap or buy an optional see-through door. They also sell an attachment which drowns the mice, which kind of upset my wife. Remember that one of the design goals is to be alerted in case you forget to check the trap. Another person (who shall go unnamed) did email me and suggest that I install electrodes and electrocute the mouse. Let’s keep in mind that, while I have no love for rodents who invade my personal space, this idea deviates from my goal of keeping the mouse alive so it can be relocated. We also don’t want the mouse to die / decompose in case the trap is left unattended for an extended period of time.
Final Thoughts and Ideas
Since my move to CA, I haven’t had a need for a mousetrap until recently. The last source code I can find for this project is attached in the ZIP file below. Several people have emailed me suggesting that I expand on the idea and make a small network of traps all controlled by a host controller or that I have a remote alarm device. I thought about setting up several traps with an XBee interface so that I could tell which trap caught a mouse by looking at a control panel, either on my phone or PC. Not sure what, if any ideas I will use, but I am planning on making a more permanent version of the trap some day, possibly with a camera that takes a photo of the captured mouse and sends me a text message with it. Perhaps we’ll call it a “critter cam”.
Resources
Build A Better Mousetrap V2 – Project
Build A Better Mousetrap V3 – Project
Build A Better Mousetrap by Chris Savage is licensed under CC BY 4.0










