A motion sensor is a device that detects physical movement on a device or within an environment. It has the…