The mousetrap used is a simple and cheap baited tilting tube that traps the mouse without killing it. The problem with having a number of traps set, is that you need to check them on a regular basis to check for any captured mice. Now the tweeting mousetrap will let you know when it has caught something.
The design uses a minimal Arduino clone board and a simple radio module to provide serial data communications with a base station.
Simple moustrap as shown in photographs.
Bait for moustrap - mice seem to like peanut butter.
Tin foil and wires to make contacts.
Arduino, clone or minimal clone.
Batteries and battery holder to power board.
XRF radio module plus shield.
XRF module with FTDI interface for base station.
Working internet connection.
Twitter and OAuth proxy accounts.
Step 1: Contacts to Trigger Tweeting
Step 2: Communication Protocol
The first character is 'a ' which indicates the start of the message.
The second and third characters are the address of the device, in this case I am using 'M1 ' to indicate mousetrap 1.
The rest of the message is the data. This can be a request to read a temperature or a notice that an event has occured such as a light switch has been turned on or a moustrap has been sprung!
If the message is shorter than 12 characters the padding character '-' is used.
The commands used in the tweeting mousetrap are 'aM1TRAPOK--- ' to indicate that the trap has been set and 'aM1TRAPTRIG- 'to indicate that the trap has been sprung.
Step 3: Software
The sketch loops waiting for the contacts to be closed, at this point it is triggered to send the 'aM1TRAPTRIG-' messages repeatedly every minute.
The perl script just opens the comm port and listens for any aProtocol messages. If it receives one from the moustrap then it sends a tweet. This tweet is currently sent using a proxy service as its a simple way to use Twitter with out having to use an OAuth enabled client. In this script the command curl is used to submit the tweet.
Step 4: In Use
The pictures show the results. Once captured, the mice were released some distance away in a nearby field.