A motion sensor is a pretty complicated bit of electronics to make from scratch, especially if it has to be effective at long range and be integrated with an outdoor piece of equipment like a sprinkler. Fortunately, security lights with built-in sensors are cheap to buy and easy to install and can be adapted to trigger a sprinkler instead of switching on a light bulb. This can be really handy for keeping pests such as cats and birds away from the swimming pool or flower bed, providing a humane and effective deterrent.
Install a motion-detecting outdoor lamp according to the installation instructions given by the manufacturer. This needs to be positioned so that the sensor is within range of the area where you want it to detect motion and trigger the sprinkler. It must also be somewhere where you can connect it to electric supply. Many motion-detecting lamps are wall mounted, meaning that you will have to drill into the wall of the garage or house to install it. It doesn't matter where you fix the lamp as long as it can be connected to the power and is close enough to the target area. Test that it switches on the lamp when there is motion in the target area and move it if it does not.
Disconnect the lamp from the power supply or flip the circuit breaker in the main fuse box to cut the power. Remove the light bulb from the lamp and screw the power-socket converter into its place. Take the light socket/power socket converter. This is a simple device, available from most hardware shops, which has a plug socket at the top and a fitting like a light bulb at the bottom. Screwing it into a light bulb socket means that you can use the lamp to power an appliance instead of a light bulb.
Check whether the lamp panels can slide out or need to be popped out. If so, remove the panel, drill at one of the edges of the panel with the hole overlapping the edge. This way you can pop the cable into place on the side of the panel and replace the panel. If this is not possible, you will need to drill a hole in the panel, unscrew and remove the plug from the sprinkler cable, feed the wire through the hole in the panel and reattach the plug before connecting it. Make sure you have a neat hole just large enough for the cable.
Seal around the hole with silicone sealant by running the tip of the tube's nozzle around the gap between the perspex and the cable while squeezing gently on the tube. Plug the sprinkler cable into the converter.
Read and follow the manufacturers instructions about installing the sprinkler, as they will vary slightly from model to model.The sprinkler will need to be attached to the water supply via a hose and positioned so that it can get water to the problem area. It may also need to be fixed or buried in the ground. Connect sprinkler to water supply and the lamp to the electric supply. Turn the lamp timer down to minimum according to instructions of particular model.
Test to see if the system works. When the lamp's motion detector picks up movement it will switch on. Normally this would turn on the light but as it is attached to a sprinkler instead of a light bulb the electricity coming from the lamp activates the sprinkler. Move the lamp or sprinkler if the system is not getting water to the right area or not switching on when you want.