Project in progress

Mouse-O-Leum (Multiple Live Catch) Mouse Trap © CC BY-SA

This Arduino-based mouse trap fits on small buckets and will catch small and large mice with the same reliability.

  • 2,940 views
  • 7 comments
  • 13 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
×1
Infrared Obstacle Avoidance Sensor For Arduino
×1
Solenoid - 5V (Small)
×1
TowerPro MG996R 10kg Servo 10kg / 0.20sec / 55g
It can be any servo but it has to be able to lift the trap door...
×1
Fairchild semiconductor fqu13n06ltu image 75px
Power MOSFET N-Channel
this is needed to drive the solenoid.
×1
5V 1 channel Level Trigger Optocoupler Relais Module for Arduino
I used this to notify my domotica system when catching a mouse
×1

About this project

UPDATE 2018-10-18

The improved version of the trap is almost ready! Older and wiser mice could still escape the first design. Now I made a proper design with TWO trapdoors. TIP: If you have a Fablab in your neighborhood, you can make this trap relatively easily with a CNC machine or laser cutter!

Now I use two small and cheap SG90 servo's:

UPDATE 2018-10-07

We caught 12 mice the last week with the trap but one smarter older mouse managed to escape several times when the trapdoor was activated. SO... now I'm working on a better version of the trap with a second door. I will use now 2 cheap 5 euro mini servos, no more solenoid. I will make the drawing available so you can use those to lasercut the case or use a CNC machine (like me) to make the acrylic case. Overall I'm very happy with the trap because I could not catch mice with other live traps. Our mice are not as willing as the mice you can see on youtube video's to enter traps...

Why an Arduino-based mouse trap?

Well, we have chickens so mice are feasting on the feed and it is hard to avoid having mice because they can jump and climb very well.

We decided we want to catch the mice alive so I first bought some good trip trap mouse traps and set them. To see what was happening, I recorded the area with some old analog cameras. To my frustration the mice did not come near the traps! They sniff a bit but entering them? No!

Then I saw one mouse happily jumping into a small tray with chicken feed.

First attempt without the Arduino

That made me come up with the first home made trap. When jumping into it, they would fall down.

But to my amazement some very tiny mice jumped in and nothing happened! I did catch one larger mouse but I needed more reliability and catch very light and more heavy mice. Mice do learn fast so you need to catch them at the first attempt...

The first attempt without electronics... FAIL

(Some other camera footage will follow soon.)

FAIL!

The Arduino-powered mouse trap

So then I made the Arduino-based trap... This is a hastily assembled trap so the final version will be neater.

Why did a use a solenoid? The servo would move fast enough but when the trap door was closed and I put some weight on the door, the servo began making noise because it wanted to keep it's position.

This noise would scare the mice away!

By positioning the servo the way I did is not ideal. Because of the leverage the servo arm gets a relative large amount of pressure. Another way of positioning the servo would solve this problem but I am not a mechanical engineer...

Because I did not know how to solve this, I added a solenoid which does make a lot of noise but then it's to late for the mouse to escape. They jump when the solenoid is activated but then fall into the gap as you can see in the 3rd video below...

3 mice entering the trap, 1 managed to escape!!

Build process will follow

Code

Mouse-O-Leum code 1.0C/C++
//    __  __                              ____         _                              
//   |  \/  |                            / __ \       | |                             
//   | \  / | ___  _   _ ___  ___ ______| |  | |______| |     ___ _   _ _ __ ___      
//   | |\/| |/ _ \| | | / __|/ _ \______| |  | |______| |    / _ \ | | | '_ ` _ \     
//   | |  | | (_) | |_| \__ \  __/      | |__| |      | |___|  __/ |_| | | | | | |    
//   |_|  |_|\___/ \__,_|___/\___|       \____/       |______\___|\__,_|_| |_| |_|    
//                    _ _   _       _        _ _                       _       _      
//                   | | | (_)     | |      | (_)                     | |     | |     
//    _ __ ___  _   _| | |_ _ _ __ | | ___  | |___   _____    ___ __ _| |_ ___| |__   
//   | '_ ` _ \| | | | | __| | '_ \| |/ _ \ | | \ \ / / _ \  / __/ _` | __/ __| '_ \  
//   | | | | | | |_| | | |_| | |_) | |  __/ | | |\ V /  __/ | (_| (_| | || (__| | | | 
//   |_| |_| |_|\__,_|_|\__|_| .__/|_|\___| |_|_| \_/ \___|  \___\__,_|\__\___|_| |_| 
//                           | |      | |                                             
//    _ __ ___   ___  _   _ _|_| ___  | |_ _ __ __ _ _ __                             
//   | '_ ` _ \ / _ \| | | / __|/ _ \ | __| '__/ _` | '_ \                            
//   | | | | | | (_) | |_| \__ \  __/ | |_| | | (_| | |_) |                           
//   |_| |_| |_|\___/ \__,_|___/\___|  \__|_|  \__,_| .__/                            
//                                                  | |                               
//                                                  |_|                               


// free to copy! by Erik de Ruiter
// 2018-10-02 - Version 1.0



//  ########  ######## ######## #### ##    ## ######## 
//  ##     ## ##       ##        ##  ###   ## ##       
//  ##     ## ##       ##        ##  ####  ## ##       
//  ##     ## ######   ######    ##  ## ## ## ######   
//  ##     ## ##       ##        ##  ##  #### ##       
//  ##     ## ##       ##        ##  ##   ### ##       
//  ########  ######## ##       #### ##    ## ######## 


// servo timing data, different for every servo!
// value for servo type:
//                    0 degrees   180 degrees
// Fitec FS5106B:     850         2390
// 0 degrees:
int servoDownTimingMs = 850;
// ~100 degrees:
int closeTrapDoorTimingMs = 2000;
// 180 degrees: (not used, just for reference)
int servo180 = 2390;

// define variables
bool closeTrapDoor;
bool mouseDetected;
unsigned long timer1 = 0;

#define SOLENOID 2
#define SERVO 3
#define IR 4
#define RELAY 5
#define LED 6
#define ARDUINOLED 13

//   ######  ######## ######## ##     ## ########  
//  ##    ## ##          ##    ##     ## ##     ## 
//  ##       ##          ##    ##     ## ##     ## 
//   ######  ######      ##    ##     ## ########  
//        ## ##          ##    ##     ## ##        
//  ##    ## ##          ##    ##     ## ##        
//   ######  ########    ##     #######  ##        
void setup()
{
    // define the Arduino port for input or output
    pinMode(IR, INPUT);
    pinMode(SOLENOID, OUTPUT);
    pinMode(SERVO, OUTPUT);
    pinMode(ARDUINOLED, OUTPUT);
    pinMode(RELAY, OUTPUT);
    pinMode(LED, OUTPUT);

    // to be sure, set the servo to it's idle position, lowering
    // the servo arm, ready for the solenoid to release the trap door.
    closeTrapDoor = false;
    // deactivate the mouse-in-trap-notification relay
    digitalWrite(RELAY, LOW);
}

//  ##        #######   #######  ########  
//  ##       ##     ## ##     ## ##     ## 
//  ##       ##     ## ##     ## ##     ## 
//  ##       ##     ## ##     ## ########  
//  ##       ##     ## ##     ## ##        
//  ##       ##     ## ##     ## ##        
//  ########  #######   #######  ##        
void loop()
{
    // the servo needs CONTINUOUS pulses to keep its position
    // so be careful not to use a delay function in the loop 
    setServo();

    // check the infrared sensor. if a mouse walks between the IR transmitter
    // and receiver, a signal is sent.
    checkForMouse();

    if (mouseDetected == true)
    {
        // YAHOOOOO! The mouse will not be happy because the trapdoor
        // is being activated!
        unlockTrapDoor();

        // now we have to do several things in sequence WHILE SENDING THE SERVO
        // positioning data in the loop (setServo()) so we CANNOT use a normal delay funtion!
        if (millis() - timer1 >= 300)
        {
            // after the trap door is opened by the unLockTrapDoor function
            // we close it by the servo after 300Ms
            closeTrapDoor = true;
        }
        if (millis() - timer1 >= 800)
        {
            // after 500ms (800-300) we lock the trap door using the solenoid
            lockTrapDoor();
        }
        if (millis() - timer1 >= 900)
        {
            // now we can lower the servo arm again, ready for the next event
            closeTrapDoor = false;
        }
        if (millis() - timer1 >= 1000)
        {
            // activate the relay so we get a notofication using for example
            // a domotica system.
            digitalWrite(RELAY, LOW);
        }
        if (millis() - timer1 >= 1500)
        {
            // deactivate the relay and reset the mouseDetected variable so we can now
            // look for the next mouse to appear.
            digitalWrite(RELAY, HIGH);
            mouseDetected = false;
        }
    }
    else
    {
        // reset the timer and we keep doing so until a mouse is so stupid
        // to enter our trap...
        timer1 = millis();
    }
}

//  ######## ##     ## ##    ##  ######  ######## ####  #######  ##    ##  ######  
//  ##       ##     ## ###   ## ##    ##    ##     ##  ##     ## ###   ## ##    ## 
//  ##       ##     ## ####  ## ##          ##     ##  ##     ## ####  ## ##       
//  ######   ##     ## ## ## ## ##          ##     ##  ##     ## ## ## ##  ######  
//  ##       ##     ## ##  #### ##          ##     ##  ##     ## ##  ####       ## 
//  ##       ##     ## ##   ### ##    ##    ##     ##  ##     ## ##   ### ##    ## 
//  ##        #######  ##    ##  ######     ##    ####  #######  ##    ##  ######  

void checkForMouse()
{
    if (digitalRead(IR) == HIGH)
    {
        // mouse detected by the infrared optical sensor.
        // I use the Arduino on board LED only for testing.
        digitalWrite(ARDUINOLED, HIGH);
        // set the variable so we can give the mouse a little surprise...
        // HAHAHA!
        mouseDetected = true;
    }
    else
    {
        // no mouse detected, BUMMER!
        digitalWrite(ARDUINOLED, LOW);
    }
}

void setServo()
{
    if (closeTrapDoor == true)
    {
        // close the trap door by lifting it up.
        digitalWrite(SERVO, HIGH);
        delayMicroseconds(closeTrapDoorTimingMs);
        digitalWrite(SERVO, LOW);
        delay(20);
    }
    else
    {
        // set servo arm to the lower position, ready for the solenoid
        // to open the trap door.
        digitalWrite(SERVO, HIGH);
        delayMicroseconds(servoDownTimingMs);
        digitalWrite(SERVO, LOW);
        delay(20);
    }
}

void unlockTrapDoor()
{
    // activate the solenoid so the trap door will immediately open / fall down
    digitalWrite(SOLENOID, HIGH);
}

void lockTrapDoor()
{
    // after the trap door is lifted up by the servo, deactivate
    // the solenoid so the trap door is hold in position.
    digitalWrite(SOLENOID, LOW);
}

Comments

Similar projects you might like

Arduino Bluetooth Basic Tutorial

by Mayoogh Girish

  • 456,723 views
  • 44 comments
  • 244 respects

Home Automation Using Raspberry Pi 2 And Windows 10 IoT

Project tutorial by Anurag S. Vasanwala

  • 289,323 views
  • 96 comments
  • 676 respects

Security Access Using RFID Reader

by Aritro Mukherjee

  • 230,286 views
  • 38 comments
  • 239 respects

OpenCat

Project in progress by Team Petoi

  • 198,749 views
  • 155 comments
  • 1,383 respects
Add projectSign up / Login