Introduction: Tweeting Non-Lethal Mousetrap

This tweeting mousetrap is more of a proof of concept than a finished product. The basic design can be refined to make it easier to use.

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.

Parts used

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.
Linux server.
Working internet connection.
Twitter and OAuth proxy accounts.

Step 1: Contacts to Trigger Tweeting

The contacts are tin foil folded with a wire inserted into them to provide connection to the Arduino or Arduino compatible board. The contacts are simple taped to the end of the moustrap and to the shelf where it is installed. Take care when taping the contacts to not put tape over the lower edge as this is what is needed to make contact with the other contact. The lower fixed contact is connected to ground on the micro board, the moving contact is connected to digital input/output pin 2.

Step 2: Communication Protocol

The simple communication protocol used is called automation protocol, aProtocol or aP for short. It is described at http://www.openkontrol.org/wiki/tiki-index.php . it is a text based protocol with messages being no longer than 12 characters.

Format

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.

Example Commands

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 software consists of a simple sketch, Moustrap.pde and a perl script that runs on a linux server.

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 tweeting mousetrap has been used for a number of nights now, on its first two nights use it caught 2 mice and tweeted the results.

The pictures show the results. Once captured, the mice were released some distance away in a nearby field.

Comments

author
rimar2000 made it!(author)2011-06-12

Very interesting!

About This Instructable

2,588views

3favorites

License:

More by thiseldo:Tweeting Non-Lethal Mousetrap
Add instructable to: