Like others who have posted here, I have read several articles about ultrasonic pest deterrents not working. They work initially, and then they get used to them and start to ignore them. Perhaps your varying sound will be different. It might even detect a pest nearby and only act when it does.
Of course, an Arduino can do more, such as moving an actuator Perhaps you can supplement it with a stuffed cat that can turn its head by using a simple servo. It can move in response to a sensor detecting a pest. Add bedding from a real cat, for the smell, and perhaps you will have a stronger deterrent. I suppose owls are another natural predator. Though, I don't know if the rodents know by instinct to avoid those creatures, or have to learn by observation.
But before taking any of the above ideas too seriously, the only way to know if they were to work is to do some scientific experiments. Set up a web cam to video all night. Then, with a motion sensor and Arduino that logs the time when it detects a pest, you know what time to fast-forward to see the actual behavior of the pest with your deterrent.
Next I have written more on a kill approach, which goes outside of the scope of the original posting, so please feel free to ignore it. But, I really have put a good amount of thought into this issue because of an ongoing local problem with rodents. The deterrent stuff is just speculation until it is proven to work. Kill methods are a proven method of dealing with rodents.
My own rodent problem comes up every year when the local farmers plow the fields. After many tests of different types of traps, I ended up with a Victor brand electronic mouse trap for under $20 USD. It kills them with electricity. The biggest advantage over traditional traps is that they never have to be re-set. However, I do have two problems with it. One is that the light that blinks when it has fired. It only flashes very slowly, so I have to stand and watch it for a while to know if it has actually caught something. More than once I realized I had caught one only because of the smell of the decaying mouse.
The 2nd issue, is that I wish it would catch more than one mouse. There is a wind-up trap made by Tomcat that catches multiple mice alive by flipping them into a separate chamber. I would love for that to be made into an electronic kill trap. In other words, zap the mouse and then flip the dead mouse into a separate chamber so it can catch more mice.
Both of the above issues can be solved with an Arduino. I would suggest modifying and existing electronic trap and let the trap do the work it was designed to do. That will also isolate the high-voltage stuff from your Arduino. Then the Arduino can sense when the trap has a mouse by detecting when the existing LED flashes. Then the Arduino can actuate a servo to empty the trap into a container. Finally, the Arduino would need to re-set the trap's electronics. This can be done by just interrupting the battery power to the device.
-Joe Dunfee