How Does a PIR Motion Sensor Work?
Share
A PIR motion sensor is the part behind most automatic lights and simple alarms, and Compoden's AI build assistant is a good guide when you add one to your first project. PIR stands for passive infrared, and the sensor reacts to the warmth of a moving person or animal. This article explains the principle, the signal it produces, and how to read motion on an Arduino or ESP32.
The working principle
Every warm object, including a human body, gives off infrared energy as heat. A PIR sensor is called passive because it does not emit anything itself; it only listens for the infrared coming from its surroundings. Inside the sensor is a pyroelectric element split into two halves. When the scene in front is still, both halves receive the same amount of infrared and stay balanced. When a warm body moves across the field of view, one half sees more infrared than the other for a moment, and that imbalance creates a small electrical change. That change is what the sensor reports as motion.
The white dome on top is a plastic Fresnel lens. It splits the view into many small zones so that a moving person crosses from one zone to another, producing the alternating signal the sensor needs. This is why PIR sensors detect movement well but ignore a person standing perfectly still.
How it outputs a signal
A hobby PIR module includes the detection circuit and gives you a clean digital output: the output pin goes HIGH when motion is detected and returns LOW after a set delay. Most modules have two small trimmers, one to set sensitivity or range and one to set how long the output stays HIGH after each trigger. Many also have a jumper to choose whether repeated motion keeps extending the HIGH time or whether each event is treated separately. Because the output is a simple HIGH or LOW, it is easy to read.
How you read it on a microcontroller
Connect VCC and GND to power and ground, then wire the output pin to any digital input on your Arduino or ESP32. Read it with a digital read: HIGH means motion was detected, LOW means the area is quiet. From there you can switch on a light, sound a buzzer, send a message, or log the event. PIR modules usually need a short warm-up period after power-on while they settle to the background infrared level, so it is good practice to wait a little before trusting the first readings.
Common uses
PIR sensors are used in automatic lighting, intruder alarms, visitor counters, and energy-saving controls that switch off a fan or display when a room is empty. They are low power, which makes them well suited to battery projects. Their limits are that they detect motion rather than presence, they can be triggered by pets or sudden heat changes, and they work best within a clear line of sight.
Build it with Compoden's AI
Setting the right sensitivity and delay, and avoiding false triggers, is easier with guidance. Compoden's AI build assistant helps you pick a PIR module, explains the two trimmers and the jumper, and shows how to wire the output to your Arduino or ESP32 with simple starter code. Describe your goal, an automatic light, a doorway alarm, or a presence-based switch, and it recommends parts and settings. Browse the range in our collection and ask the assistant whenever you get stuck.
Build your first motion project now. Browse PIR sensors at Compoden and let the AI build assistant help you tune it.
How does a PIR sensor detect motion? It senses changes in infrared heat. A pyroelectric element split into two halves stays balanced when the scene is still, but a moving warm body briefly unbalances it, and that change is reported as motion through the Fresnel lens that divides the view into zones.
Is a PIR sensor output digital? Yes. A hobby PIR module gives a digital output that goes HIGH on motion and LOW after a set delay, with trimmers to adjust sensitivity and the hold time, so you read it as a simple HIGH or LOW on a microcontroller.
Why does my PIR sensor give false triggers? Sudden heat changes, drafts, pets, sunlight, or placing it near a heat source can cause false triggers. Allow the warm-up period after power-on, lower the sensitivity, and mount it away from vents and direct sun for steadier results.