Then we got another dog. He decided that the mat under my desk was his personal toilet. Enough was enough! I had to find a way to deter these dogs from weeing on the mat.
Step 1: The parts
You will need the type of detector that sets off an alarm when a light beam is interrupted. A passive Infrared sensor might work, but it's probably not as reliable and it will drive you crazy when you are using the bathroom.
Dogs typically don't like loud noises, particularly sudden ones. I coupled the intrusion detector with a 130dB piezoelectric siren. A 12V power supply ensured that the alarm would always be ready to deter the dogs.