I've never done such a thing myself or heard of one, you'd definitely want to check into the legality of such a device before building one. You could use a simple sprinkler valve with a short chamber and short fat barrel. A motion detector, trip switch, etc can power the solenoid to cause the gun to fire. A paper towel would make a good wad, drive it down the barrel, dump in some pepper, and drive another paper towel down on top of it. When a spinkler valve is triggered by the solenoid, it is inefficient which makes a loud honking sound, further increasing the scare factor. It will still be strong enough to blast a nasty cloud of pepper in the air as well. If you prefer to stay away from electronics, you can pilot them with ball valve attached to trip wires as well. Sounds like a fun project.

I'd love to see a video of one in action....