||It has been suggested that Motion detector be merged into this article. (Discuss) Proposed since June 2013.|
Motion detection is the process of detecting a change in position of an object relative to its surroundings or the change in the surroundings relative to an object. Motion detection can be achieved by both mechanical and electronic methods. When motion detection is accomplished by natural organisms, it is called motion perception.
Motion can be detected by:
- Infrared (Passive and active sensors)
- Optics (video and camera systems)
- Radio Frequency Energy (radar, microwave and tomographic motion detection)
- Sound (microphones and acoustic sensors)
- Vibration (triboelectric, seismic, and inertia-switch sensors)
- Magnetism (magnetic sensors and magnetometers)
The most basic form of mechanical motion detection is in the form of a switch or trigger. These motion detection devices are common in our everyday lives. The keys of a typewriter, or even the keys on the keyboards used to type this article employ a mechanical method of detecting motion. Each key is a manual switch that is either off or on. Each letter that appears is a result of motion on that corresponding key and the switch being turned on. This simple binary code concept is at the heart of the digital age, with mechanical switches being replaced by ever shrinking transistors.
The principal methods by which motion can be electronically identified are optical detection and acoustical detection. Infrared light or laser technology may be used for optical detection. Motion detection devices, such as PIR motion detectors, have a sensor that detects a disturbance in the infrared spectrum, such as a person or an animal. Once detected, an electronic signal can activate an alarm or a camera that can capture an image or video of the motioner. 
The chief applications for such detection are (a) detection of unauthorized entry, (b) detection of cessation of occupancy of an area to extinguish lighting and (c) detection of a moving object which triggers a camera to record subsequent events. The motion detector is thus a linchpin of electronic security systems, but is also a valuable tool in preventing the illumination of unoccupied spaces. 
A simple algorithm for motion detection by a fixed camera compares the current image with a reference image and simply counts the number of different pixels. Since images will naturally differ due to factors such as varying lighting, camera flicker, and CCD dark currents, pre-processing is useful to reduce the number of false positive alarms.
More complex algorithms are necessary to detect motion when the camera itself is moving, or when the motion of a specific object must be detected in a field containing other movement which can be ignored. An example might be a painting surrounded by visitors in an art gallery.
Occupancy sensors for lighting control
Motion sensors are often used in indoor spaces to control electric lighting. If no motion is detected, it is assumed that the space is empty, and thus does not need to be lit. Turning off the lights in such circumstances can save substantial amounts of energy. In lighting practice occupancy sensors are sometime also called "presence sensors" or "vacancy sensors". Some occupancy sensors (e.g. LSG's Pixelview, Philips Lumimotion, etc.) also classify the number of occupants, their direction of motion, etc., through image processing. Pixelview is a camera-based occupancy sensor, using a camera that is built into each light fixture.
System design and components
Occupancy sensors for lighting control typically use infrared (IR), ultrasonic, tomographic motion detection, microwave sensors, or camera-based sensors (image processing). The field of view of the sensor must be carefully selected/adjusted so that it responds only to motion in the space served by the controlled lighting. For example, an occupancy sensor controlling lights in an office should not detect motion in the corridor outside the office. Tomographic motion detection systems have the unique benefit of detecting motion through walls and obstructions, yet do not trigger as easily from motion on the outside of the detection area like traditional microwave sensors.
Sensors and their placement are never perfect, therefore most systems incorporate a delay time before switching. This delay time is often user-selectable, but a typical default value is 15 minutes. This means that the sensor must detect no motion for the entire delay time before the lights are switched. Most systems switch lights off at the end of the delay time, but more sophisticated systems with dimming technology reduce lighting slowly to a minimum level (or zero) over several minutes, to minimize the potential disruption in adjacent spaces. If lights are off and an occupant re-enters a space, most current systems switch lights back on when motion is detected. However, systems designed to switch lights off automatically with no occupancy, and that require the occupant to switch lights on when they re-enter are gaining in popularity due to their potential for increased energy savings. These savings accrue because in a spaces with access to daylight the occupant may decide on their return that they no longer require supplemental electric light.