ESP8266/ESP32 rat trap project - need help

My goal is to create a tube - maybe 3" in diameter, 10" long - attached to a shop-vac on one end. At the mid-way point, a sensor (whether IR, capacitive, PIR, ultra-sonic) that detects the presence of a mouse/rat. That would then send (via wifi) a command to my HASSIO, which, using Node-Red, would turn on an ESPhome-flashed Sonoff S31 for 5 seconds. The shopvac, naturally, would be powered via the S31.

Thus, if a rodent gets triggers the sensor, it promptly gets sucked into the shop vac for later dispatch.

I’m good with configuring Node Red, and working with the S31, but I’m not quite sure how to configure the yaml for the esp8266 so that it works with whatever hardware I use as an input signal.

First post. My apologies if I posted in the in the wrong category/forum. Any help would be appreciated.

Credit for the idea: https://www.youtube.com/watch?v=U4zE8MNz5w8

Take a bit of advice from someone who works in pest control here - abandon your automation dream. I have plant moisture sensors that auto-water my house plants. I have complex automations built around historical and predicted precipitation to control exterior irrigation systems. I automate everything around me but your idea will fail.

Your problem is not best solved using HA. First and foremost identify if you are dealing with mice or rats…they are not the same and they behave differently. Second, size your traditional (snap) traps to the target pest. Third, place them in a runway that is active (generally where floor meets wall but perhaps at transition areas) as evidenced by rub marks - they leave sebum (oils, etc) where they travel. Fourth, place the trigger side of your set traps on the travel path as identified in (3). Don’t spend a lot of time worrying about bait and attractants/repellants but rather depend on their muscle memory of travel paths to hit the trigger and be killed.

1 Like

I appreciate your experience and comments. I look forward to the challenge of completing this project with my 11yo son (who’s taken a real shining to coding and 3d printing) as I do actually catching rodents. I am quite certain of my adversary. They are both rats and mice. I’ve placed a camera in the area where they are problematic:

I’ve been using the large rat-sized Victor snap traps - and they have proved successful, but given the location, they’re hard to access to reset.

What make it hard? It’s in the engine compartment of a rear-engine diesel motorhome. The compartment is located under the master bathroom floor - and requires that I remove a heavy, ceramic tile covered hatch. The compartment is considered the exterior of the coach - and so far, I’ve not not any evidence of rodents inside the cabin.

So, my situation is a bit unique. I don’t know if you watched the video from Mousetrap Monday’s YouTube channel - but it’s pretty compelling. What is particularly appealing is that it’s self-resetting.

Besides, even if it doesn’t work to catch rodents, it’s still a fun project for my boy to get some experience.

1 Like

I could find someone used pressure sensor to detect the mouse when it hits the plate. you may find the details in the famous instructables website with the heading shop vac mousetrap. Have you checked that already?

Mice/rats in vehicles is a common problem, destroying wiring harnesses, filters, and anything else they can sink their hanta-infected teeth into.

There are commercial 12v automotive sound/strobe lights on the market to place into a rodent area that have mixed results, and some people claim that just leaving a bright mechanic’s drop light under the vehicle is enough to deter them.

A few people swear by a 5-gallon bucket that’s 1/2 full of water and a plank to lead them up over the rim as the best outdoor trap around vehicles…

I have not but will search now… TY

Mice/rats in vehicles is a common problem, destroying wiring harnesses, filters, and anything else they can sink their hanta-infected teeth into. [/quote]

I know - they got to my mass air flow sensor on my Tundra. Fortunately an easy fix. In the coach, so far, they’ve only used it to store peppers that they plucked from our garden located nearby.

There are commercial 12v automotive sound/strobe lights on the market to place into a rodent area that have mixed results, and some people claim that just leaving a bright mechanic’s drop light under the vehicle is enough to deter them.

Sean Woods (Mouse Trap Monday YouTuber) has reviewed every kind of rodent deterrent… from noise makers and lights, chemical compounds, fabric sheets, soaps, to whatever the latest fad is… They usually sit on top of the deterrent as they eat the nuts and seeds he puts out as bait.

That said, the camera I am using to monitor the activity in the engine bay is a PoE camera that can use a bright white LED or IR. Neither affect them - at all. They don’t care.

A few people swear by a 5-gallon bucket that’s 1/2 full of water and a plank to lead them up over the rim as the best outdoor trap around vehicles…

Walk-the-plank traps - I use those in my barn, and they’re very effective with mice. Rats are too smart and weary. If the ground isn’t solid, they will avoid it. That’s what’s so appealing about the shop vac. The tube is solid, and as soon as the vacuum comes on, it yanks them through the hose and puts them in the shop vac (with water in it). Sean caught 14 rats. It’s oddly satisfying to watch the hose slam around as the rat goes through. Kinda like the fat kid in Willy Wonka…

Back to your question, the sensor is simply a binary one. Probably a gpio one

Pir-sensor on Gpio0 would probably do that job easiest way. Verify that you have safe voltages.

Awesome, thank you.

Your vacuum setup is interesting. In my desperation once I was planning similar setup setup with a electric stapler on a ramp… Those cutie mice had spaghetti dinner with my car wiring, since then I have sensor indicator lights blinking like a christmas tree.

Thanks - yes, that’s what I planned on using as an input - I just have to figure out what the best triggering hardware will be and how best to have it pull the input down (or up).