Tuesday, 31 July 2018

Remotely monitored rat traps. Part 1 - early prototypes


In recent months I've become interested in predator control in our neighbourhood. New Zealand native birds, reptiles and insects evolved in the absence of the mammalian predators which have been subsequently introduced such as rats, feral cats, hedgehogs, possums and especially mustelids (stoats, ferrets and weasels)  In addition to the wider scale efforts and the ambitious 2050 government target, many suburban neighbourhoods have begun backyard trapping. Some with considerable success.  Although there have been individual households in my own neighbourhood that have been trapping for some time, organised efforts are relatively new.

As I've set traps in my own property and those of several neighbours I've been surprised by the satisfaction to be gained from eradicating pests. However it's quite time consuming to properly monitor even just the 9 traps I have now.  As our efforts expand it seems that being able remotely monitor traps would be a great asset. I'd love to only go out and reset the trap when I know it's been sprung. My initial enthusiasm for checking them every day is starting to wear off.


This project has some fairly demanding requirements.

  • Radio range
    Although we, through an expander, have fairly good WiFi coverage in the garden I want to be able to monitor traps over a wider range than just our own property. GSM is too expensive as is Xbee. I've experimented in the past with cheap 433Mhz garage door opener type boards and the more sophisticated nrf24l01 type devices but I haven't been impressed with the range available, especially in the face of obstacles like buildings and vegetation.
    Recently I've become aware of LoRa technology. These have ranges in the kms but low power requirements and are fairly cheap.  As far as I can tell these are legal in NZ, certainly the duty cycle is very, very low.
  • Detecting when the trap is sprung
    When I first started thinking about this project I was imagining some type of electrical connection or magnet/hall effect sensor to know when the trap had been sprung. However these all require some modification to the trap itself and are all a bit fiddly. About the same time I purchased a gas operated resetting A24 trap from the excellent Good Nature company. These have an counter which based on the description is some sort of vibration detector which wakes a MCU and increments a counter. That gave me an idea - perhaps I could do the same with a simple vibration switch attached to the interrupt of a sleeping Arduino of some sort. My first thought was a pizeo sensor like this. However that would need additional components, some sort of comparator and an inverter at least. I then discovered there's an even simpler device - a vibration switch which is just a wire coiled around a central post. The "fast" one seems about perfect, sensitive enough to catch the trap going off but not so sensitive that the wind or just walking by will set it off. 
  • Robustness
    There are two aspects of this. Firstly although the traps are generally in wooden boxes they are exposed to the elements at each end. So the system needs to be well protected against rain, frost, inquisitive rodents and eventually their blood. I'm still not 100% sure how I'll achieve this but some sort of shrink wrapping might be a good way to go. The other aspect is that humane rat traps go off with a considerable amount of force. While the sensor does need to have a firm connection to detect that, it also needs to be constructed fairly robustly to avoid being shaken to bits.
  • Power
    Although I did contemplate having some sort of solar power source that's not likely to be practical given these traps are usually placed undercover, along fences and under trees where rats like to hang out. Having sourced a cheap source of Arduino Min Pro clones I discovered that these are well suited to low power applications.  In particular based on the information in this very useful page.  With the LoRa radio asleep and the power LED soldered off the Arduino it only draws 64 μA when sleeping. In theory that means a 9V battery would last well over a year and four AAs considerably longer. When transmitting the draw is about 100mA but that's only for a few ms and presumably only rarely anyway. Field testing will be needed to establish exactly how long the battery will last. Some additional power savings can be achieved by using a 3.3 V power regulator with a low quiescent current but although I have ordered some of these I'm not planning to use them yet.
  • Cost
    Considering a Victor Rat trap in a wooden tunnel retails for $35 and is about the cheapest rat solution available what would a reasonable price for a monitoring solution? I originally thought about $10 for the sensors (the base station doesn't matter that much since I only need one of those). However the Arduino, remarkably cheap at $3, and the LoRa module at $7 already hit that traget. So perhaps $15 assuming I can make a reasonably sized PCB doesn't seem so bad. In fact the base station won't be that much more expensive since WiFi enabled ESP8266 modules are so cheap

Related Projects

Unsurprisingly I'm not the first to think of this. In fact the original idea came from hearing about this project in Taranaki.  There's not a lot of details but it looks like they are using the Celium product which appears to have a significant range advantage over LoRa although there are no details on cost. I doubt it's cheap.

One LoRa based product is EcoNode.  Again no information on price and it looks like it is tied to one particular type of modified trap.

There is also Trapminder. This based on a GSM cellular modem and solar powered so likely quite expensive per unit.

I'm sure there are others out there....

Overview of System

The plan is to construct something which is represented by the following block diagram:
Note the base station also includes an Arduino Pro Mini. This isn't strictly necessary since in theory it's possible to connect the LoRa module directly to the Wemos D1 Mini but I had some problems making that work and it's only slightly more complex to have the Arduino manage it.

The code is based on three Arduino scripts:
Note there's another private script I use to set the Wifi and Email passwords in the EEPROM of the ESP8266.

The following are photos of the prototypes. The sensor is currently in a domestic plastic storage container which is bolted via some aluminium angle to the bottom of the trap. In this way it's well clear of the mechanism but firmly connected to the trap.  
Sensor Prototype

Receive prototype on breadboard

Receiver prototype

Next Steps

  • Test the prototype in the field. I've been fairly successful in clearing out rats but I may try one of the neighbouring properties
  • Design a PCB for the sensor
  • Build a simple transmitter with an LCD attached to survey the range of the receiver and signal strength around the neighbourhood


  1. I hope DOC and conservation bodies are accessing this blog. Good luck with phase two.

  2. Hi Quentin, very nice work here! We have new in our neighbourhood a programmer from the ZIP program. You will really want to talk them. Have a look at www.zip.org.nz and enjoy! Cheers, Rik

  3. Thanks Rik - that's very interesting. ZIP's findings are interesting, especially their "lone rat" study which might have some utility in suburban environments as well.
    Still running a field test, at least no false positives so far but not more rats caught either. I'm experimenting with a better antenna system I hope will give increased coverage and then I'll try it in some of the neighbors places.


Twilight Photometer Part II - Analysis

This is a followup to the earlier post that described  the construction of a Twilight Photometer. In this one, I'll describe the setup a...