“Build a better mousetrap and the world will beat a path to your door,” so goes the saying, but VHS beat Betamax and the world hasn’t been the same since. In any case, you might not get rich building a better mousetrap, but you can certainly create something more humane than the ol’ spring’n’snap, as [nightcustard] demonstrates.
The concept is the same as many humane mousetraps on the market. The mouse is lured into a confined cavity with the use of bait, and once inside, a door closes to keep the mouse inside without injuring it. [nightcustard] achieved this by building a plastic enclosure with plenty of air holes, which is fitted with a spring-loaded door. When a mouse walks through an infra-red break beam sensor, a Raspberry Pi Pico W triggers a solenoid which releases the door, trapping the mouse inside. This design was chosen over a passive mechanical solution, because [nightcustard] noted that mice in the attic were avoiding other humane traps with obvious mechanical trigger mechanisms.
As a bonus, the wireless connectivity of the Pi Pico W allows the trap to send a notification via email when it has fired. Thus, you can wake up in the morning and check your emails to see if you need to go and release a poor beleaguered mouse back into the wild. This is critical, as otherwise, if you forget to check your humane trap… it stops being humane pretty quickly.
If you’re looking for more inspiration to tackle your mouse problems, we can help. We’ve featured other traps of this type before, too. Meanwhile, if you’ve got your own friendly homebrew solutions to pesky pest problems, don’t hesitate to hit up the tipsline.

Overnight is still not good. I have had mice die from stress in less than 4 hours, and switched to snap and break the neck traps. No, not in an open or high traffic area, but a closed off attic, where every other fall a few find a way in.
I am wondering what are they going to do with the live mouse afterwards?
If they are drowning it in water, or using CO2 (recommended “humane” way), to kill it, then a snap and break the neck trap would like be more humane… (quicker and less suffering).
You don’t have to kill things you know. You can always take the outside things that found their way inside and take them back outside a ways away.
Mine went to the furthest corner of the garden, where there are natural cover, and AFAICT there were no returns.
Notes:
Several species of mice are protected were I live.
Rolled oats works well and lasts long in a dry space.
Prefer ‘snap’. Done.
I preferred VHS over Betamax for its 6+ hour tapes for time-shifting.