Build an electronic rattrap

Some time ago i published an instruction manual how to build an electronic rattrap. This has proved to work but while it was made with a pic microprocessor it has no internet connectivity. I thought that would be nice because i am to lazy to inspect the trap on the spot. So i did an experiment with an ESP8266, a servo and an ir sensor. The idea is that when the mouse comes into the detection reach of the sensor, the servo turns.
The software for the ESP is derived from other projects and has some nice features:
- it can get the time from the internet.
- an email is send when a catch took place.
- it has a webpage with actual information.
So now we could make a cage with a door that can be controlled by the servo. The rat enters the cage. When the sensor sees this, the door gets closed. The door can only be opened manual. After this it the trap be armed again by pushing on the tactile switch.
In case of a power failure nothing changes in the state of the trap so an eventual catch can't escape.

What materials amongst others do you need:
- an ESP8266-12E.
- 1 small servo
- a resistor, an led and capacities
- a 12V DC power supply
- a voltage regulator 3.3V
- an infrared sensor.
- an infra red LED
update aug 2017.
I programmed the ESP and built a testenvironment with a breadboard. It works very good!
When i approach the sensor with a finger, the servo turns 180 degrees an an email is send to the configured email address. The webpage shows that a catch took place.
Now i can think of a way to implement this in a cage.
update sep 2017.
It turned out that de sensor doesn't work in daylight outside, it catches too much infra-red from the daylight. This is a well known problem with these sensors so i had to convert it into a licht barrier. This was easy, i desoldered the led and the receiver, and soldered them back with wire in between. Now we can mount the led and receiver in opposite positions. In such way that the receiver can't get much daylight. The board now gives an digital 1 as something blocks the ir on the receiver.
I made a housing for the esp and the servo. The servo can move a pal that releases the cagedoor. I removed the leds on the sensorboard as they would light up all the time for nothing.

I bought a cheap cage from china and mounted the hardware on it. I tested outside in bright sunshine and in full darkness and it works very good.
Now its time to catch some rats...
Last update:
In the first night of duty the trap catched a mouse so it works fine!

main parts
webinterface AP
the cage

For questions you can mail to