You've probably seen a lot of motion detectors without realizing it. They typically look like small plastic cylinders or hemispheres, and are used to control things like bathroom lights, porch lights, or even burglar alarms.
An example of a PIR motion-detector. The gridded lens houses the sensor itself.
Credit
The cheapest motion detectors, passive-infrared (PIR) sensors work using an interesting principle called pyroelectricity. But before we get to that, let's discuss thermal radiation.
Thermal Radiation
Any object with a nonzero temperature will produce thermal radiation. So long as something has a temperature above 0 Kelvin (-273.15 degrees C), it will radiate away some of its thermal energy in the form of a broad spectrum of electromagnetic waves.
This spectrum covers a wide range of wavelengths of EM waves, but the peak is determined by the temperature of the object. For example, very cold objects radiate away mainly radio or microwaves. Very hot objects can radiate away energy in the form of much higher energy photons like visible light. The red glow you see in your stovetop is just thermal radiation: The temperature of the stove got high enough that a significant amount of the spectrum was in the visible range.
Thermal radiation plots. Notice as we increase the temperature, the plots shift to the left (lower peak wavelength, higher peak frequency, higher peak photon energy) and the overall height increases, indicating increased power output.
Credit
This is actually how the sun produces light. Internal fusion keeps the surface of the star at a somewhat constant temperature, and energy is radiated away from the sun. Since the temperature is very high, a lot of that energy is in the visible spectrum (red through blue), and reaches us.
You can actually easily calculate the peak wavelength of electromagnetic waves being produced by any object using Wien's Law, which states that:
λ ~= 0.0029 / T
... where λ is the wavelength of the peak radiation in meters, and T is the temperature in Kelvin. Plugging a room temperature value of about 300 Kelvin, we can see that the peak emission for the objects around you is:
λ ~= 10 micrometers = 10,000 nanometers.
Visible red light, the longest wavelength electromagnetic wave that we can see, comes in at around 650 nanometers. What this means is that everything around you is glowing simply due to the fact that it has nonzero temperature ... you just can't see the "light", because it is far into the infrared region of the electromagnetic spectrum.
Pyroelectricity
The second concept to go over before we can get to how PIR sensors work is Pyroelectricity.
Certain crystals react electrically to being heated up or cooled down. So-called pyroelectric crystals will build up opposite charges across themselves when their temperature is changed. Heat up a pyroelectric crystal and negative charges will build up on side of the crystal, positive charges on the other.
This means that you can use these crystals to generate some energy from heat, if you have a way to cycle the temperature of the crystal. But more importantly for us, these charges produce a voltage difference and electric field that electronics can pick up when the crystal is heated up.
These are PIR sensors, which as you may have guessed contain their own pyroelectric crystals. More on that shortly.
Credit
Pyroelectric crystals can be used for energy harvesting and have even been used for nuclear fusion (a crystal was heated up, which produced a huge electric field that fired charged atomic nuclei into other atomic nuclei, producing fusion reactions). They are also used in PIR sensors.
How PIR motion detectors work
Now we can finally talk about PIR sensors!
Your typical motion detector contains two tiny pyroelectric crystals hidden inside a sealed capsule. Various shields and the large Fresnel lens seen on the exterior of motion detectors allow infrared light, but not visible light, to reach the crystals.
Thermal radiation can only transfer energy between objects with different temperatures. Since the PIR sensor is at room temperature, all of the far-infrared light we discussed earlier is entering the sensor and hitting the crystals, but the crystals are also radiating an equal amount back out and the net result is no temperature change occurs on the crystals from the surrounding environment.
Pyroelectric sensor on PCB
Credit
But things change when something alive passes by. We as humans are not typically at the same temperature as the surrounding environment. Our bodies are kept at a constant temperature by internal chemical processes, and this temperature is usually higher as the objects around us. That means that a person is radiating away more thermal radiation than a person-sized dummy at room temperature.
So, when a person gets in front of the PIR sensor, the pyroelectric crystals heat up, since they are now receiving excess thermal radiation from a warmer object (the person).
Another PIR motion detector
Credit
To detect motion, the two crystals are hooked up to a very sensitive circuit that detects when the voltage across the crystals is different. Now, imagine a person walks by the sensor. As the person approaches, the thermal glow put off by the individual will start to illuminate the first crystal more than the second crystal, heating it up. Eventually the voltage across the first crystal is significantly different than that across the second crystal. As the person keeps moving, the voltage across the first crystal drops and the voltage across the second crystal grows as the second crystal heats up in the thermal glow of the person.
The net result is a voltage pulse across the two crystals that is detected by the motion detector. The motion detector takes this to mean that something alive has walked in front of the detector, and fires whatever speaker or light it is set to turn on.
Pyroelectric motion detector for microcontroller use
Credit
What this means is that you can't trick a PIR motion detector by throwing something in front of it. Unless that object is warmer than the surrounding room, it simply won't trip the sensor. Now if you were to hold that object for awhile and heat it up to the temperature of your body, you could potentially turn on the sensor from afar.
I suppose you could also avoid a motion detector by putting on new clothes and quickly moving by before the clothes can heat up. But since most of the sensors are there to help you see in a windowless bathroom or on your porch at night, there's no reason to avoid them.
Conclusion
I hope that you agree with me that this is a pretty interesting, unique technology. If there's any interest I might take one of these apart and write about it here, since I have a few cheap PIR sensors lying around that I haven't yet gotten to use.
As usual, please let me know if you have questions, comments or corrections. I'm happy to respond to any questions.
Thanks for reading!
Sources and Additional Reading:
Wien's Displacement Law - HyperPhysics
PIR Motion Sensor - AdaFruit
HC-SR501 PIR Sensor Datasheet