We live on a small island with a large population of rats. Since we’re opposed to capital punishment of uninvited guests, even furry ones, we try to catch them with live traps when they sneak inside. After years of failed attempts with store-bought traps, we realized we had to make a trap as clever as the rats.
Rather than an enclosed cage, which they seem to avoid, we used a suspended basket that leaves an unobstructed view at rat eye level. The cage is suspended by two neodymium magnets. When an infrared proximity sensor detects a rat below, it triggers two electromagnets that repel the suspension magnets, dropping the cage over the rat.
Over several years (and rats), the trap has gradually improved. The sensitivity is recalibrated every 10 minutes in software running on an Arduino. An RGB LED indicates trap status, a buzzer sounds the alarm when something gets caught, and a handle makes it easy to carry.