Introduction: A More Complicated Better Mouse Trap
I live in the Australian bush, a place where almost everything is trying to kill you, but that doesn't mean we have to kill them back.
There is a local rodent...OK, it is a rat...but it is a cool native rat, Rattus Fuscipes not one of those nasty introduced black rats Rattus Rattus (that I won't even dignify by linking to an image). We are very tolerant of native animals in our house, regular visitors include snakes, bats, antechinus, geckos, all sorts of things. But the native rats aren't so welcome as they like to chew stuff.
They especially like food and will chew through anything, including plastic containers and lids to get at it. When we grab a container, it is not at all unusual to find something like the images above.
Step 1: The Problem
For a long time I have used a live trap that works about 50% of the time. The problem with it is that it is mechanical. It relies on the critter entering the trap, pulling on the bait which moves a lever, releasing the door. The next morning they are released, hopefully far enough away that they don't come back.
Did you notice the emphasis on pulling? Check out the images for a schematic of how the trap works
The 50% of the time the trap doesn't work is (I assume) because they push on the bait, securing the door rather than releasing it. Clever, and now well fed, critters.
I love having ideas, making and fixing things and also playing with microcontrollers like Arduino, so I came up with something that hopefully will be the solution.
Step 2: The Solution
This isn't a particularly difficult thing to build, and it would certainly qualify for a prize in an Instructables "Over complicate it" competition, but for now it will have to go into the sensors comp.
In effect, by using the PIR sensor I don't even need to bait the arm of the trap. All that is required is a few tasty morsels scattered in front of the cage to get them interested then an enticing pile inside it so they trigger the sensor.
For What It Is Worth: years of experimenting leads me to the conclusion that the best bait is peanut butter.
- Mechanical rodent live trap - No, not a trap for mechanical rodents. I have had mine for a few years and can't find the same model for sale, but there are similar . things where the principal will work
- Arduino - I am using an Etherten for the prototype, but the final version will be an ATTiny
- PIR SENSOR - a motion detector, they are really cheap on ebay
- Servo - doesn't need to be powerful - also really cheap. I don't think these servos will work :o)
- Breadboard, jumper cables, power supply, bits, pieces, ingenuity
The first thing to do is test your PIR detector. Rather than re-inventing the wheel, here's a tutorial. Obviously the mission is to make sure your Arduino detects motion. As well as the tutorial, you could use the code included in this Instructable as it outputs to the monitor when the PIR sensor is triggered.
If you can't manage it to get this far, then you likely need to go back to Arduino basics otherwise trouble-shooting or understanding the rest of this will be tricky.
Step 3: Get Trapped
Right, we detected some motion with the PIR sensor!
Next let's connect the servo and get it moving via the Arduino IDE. You'll need to ensure the servo library is installed. Does it come as standard with the IDE? I am not sure.
One of the examples from the servo library (file > examples > examples from custom libraries > servo > sweep) is a good place to start. It will simply sweep the servo arm back and forth.
Great! That works too! Now we can assemble our trap tripper.
Remember, this is just a prototype so nothing is permanent at the moment. I used a cable tie to attach the servo to the top of the cage and then some strong thread to connect it to the arm. The hook is nothing more than a paperclip bent to shape. By attaching the servo first, it makes it easier to get the thread length right and adjust it.
I have some insulating material on the bottom of my Arduino, if you don't, be careful not to put yours on the metal cage and cause a short circuit.
Despite having the PIR Sensor set to minimum sensitivity it would still trip the trap if I moved my hand along the outside i.e. when a critter walked past too close. So I wrapped the cage in newspaper as both a shield and also to collect the usual rattish (did you see what I did there?) output when they realise they are stuck.
Notice in the code attached that I have set the final angle of the servo at 135 degrees, your results may vary. I had to tweak it a couple of times to get the start and end positions right. Also, through trial and error I discovered that it needed a 10 second delay at the start before the trap is electronically armed, so you can get your hands out of the way.
Let's try it out
w00t! Watch out rats...
Step 4: Improvements?
A few ideas to improve this
- Connect a ESP8266 wifi module and tweet or photograph or SMS or whatever
- Make the internal LED flash forever after it has been triggered so there is an obvious visual clue
- Release some food so the caught animal is rewarded before being relocated
- Make the house rodent proof - I built it, it will never happen :o)
Creating this project was fun, in fact it took more time to make this Instructable :P
The ultimate point is to treat the poor critters humanely. It isn't their fault that we put a huge banquet in front of them and they take advantage of it. Even if you don't complicate your live trap, at least buy one.
Because I can, this is an entry in the Sensor competition, give it a vote if you feel inclined.
We have a be nice policy.
Please be positive and constructive.