I was having a problem with wild doves eating my girls feed. This solved the problem.
This is where I got info to build it - https://www.backyardchickens.com/a/building-a-treadle-chicken-feeder
I haven't had problem with mice and rats so I don't know if it will deter them.