# PIR Motion Sensor Programming

**URL:** <https://forum.arduino.cc/t/pir-motion-sensor-programming/1211499>\
**Category:** General Guidance\
**Created:** [January 15, 2024, 6:23pm UTC](https://forum.arduino.cc/t/pir-motion-sensor-programming/1211499 "2024-01-15T18:23:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![xrkev](https://avatars.discourse-cdn.com/v4/letter/x/ba9def/32.png) [@xrkev](https://forum.arduino.cc/u/xrkev)\
**Post date:** [January 15, 2024, 6:23pm UTC](https://forum.arduino.cc/t/pir-motion-sensor-programming/1211499/1 "2024-01-15T18:23:27Z")

</div>

Using the digitalRead function, I'm trying to detect the state of the PIR motion sensor connected to digital port 3 of my Arduino Uno. It seems to always be delivering a TRUE state, even when there is no motion, which seems to be the root of my code not working. I know there are several other posts about this over the past few years but none seem to provide a solution. This is the source of the test code I (and it seems many others) have used. [PIR Motion Sensor with Arduino - Circuit Magic](https://www.circuitmagic.com/arduino/pir-motion-sensor-with-arduino/)

Thank you!

---

<div class="post-metadata">

**Author:** ![Paul\_KD7HB](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paul_kd7hb/32/1127958_2.png) [@Paul\_KD7HB](https://forum.arduino.cc/u/Paul_KD7HB)\
**Post date:** [January 15, 2024, 6:33pm UTC](https://forum.arduino.cc/t/pir-motion-sensor-programming/1211499/2 "2024-01-15T18:33:06Z")

</div>

Is every tiny bit of your project identical to what was used in the link you provided?

---

<div class="post-metadata">

**Author:** ![wvmarle](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wvmarle/32/1013044_2.png) [@wvmarle](https://forum.arduino.cc/u/wvmarle)\
**Post date:** [January 15, 2024, 6:49pm UTC](https://forum.arduino.cc/t/pir-motion-sensor-programming/1211499/3 "2024-01-15T18:49:20Z")

</div>

PIR sensors are VERY sensitive to all kind of influences - I haven't been able to get mine to work on a long cable (2-3m) while the same sensor worked beautifully on a short cable (10 cm or so).

They're also sensitive to all kinds of movement - i.e. changes in the IR image they see. Shield the sensor with an opaque cover to make sure it doesn't see anything to test it not seeing any movement.

Make sure you have set the pots to short delay times, it can go down to a few seconds, otherwise you may have to wait 5-10 mins before the signal goes low.

---

<div class="post-metadata">

**Author:** ![xrkev](https://avatars.discourse-cdn.com/v4/letter/x/ba9def/32.png) [@xrkev](https://forum.arduino.cc/u/xrkev)\
**Post date:** [January 15, 2024, 9:56pm UTC](https://forum.arduino.cc/t/pir-motion-sensor-programming/1211499/4 "2024-01-15T21:56:57Z")

</div>

Yes, I copied it over exactly. Any advice?

---

<div class="post-metadata">

**Author:** ![Paul\_KD7HB](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paul_kd7hb/32/1127958_2.png) [@Paul\_KD7HB](https://forum.arduino.cc/u/Paul_KD7HB)\
**Post date:** [January 15, 2024, 9:58pm UTC](https://forum.arduino.cc/t/pir-motion-sensor-programming/1211499/5 "2024-01-15T21:58:38Z")

</div>

Then both have some mistake, somewhere.

---

<div class="post-metadata">

**Author:** ![Wawa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wawa/32/1211303_2.png) [@Wawa](https://forum.arduino.cc/u/Wawa)\
**Post date:** [January 15, 2024, 10:10pm UTC](https://forum.arduino.cc/t/pir-motion-sensor-programming/1211499/6 "2024-01-15T22:10:00Z")

</div>

Make sure you turn the "time" pot fully anticlockwise, so the code is the only thing that controls 'on' time. Leave the "sensitivity" pot in the middle.  
Leo..

---

<div class="post-metadata">

**Author:** ![wvmarle](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wvmarle/32/1013044_2.png) [@wvmarle](https://forum.arduino.cc/u/wvmarle)\
**Post date:** [January 15, 2024, 10:47pm UTC](https://forum.arduino.cc/t/pir-motion-sensor-programming/1211499/7 "2024-01-15T22:47:36Z")

</div>

Connect your multimeter to the output of the PIR sensor. Does the signal go down after some time without movement (shield it)?

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 13, 2024, 10:48pm UTC](https://forum.arduino.cc/t/pir-motion-sensor-programming/1211499/8 "2024-07-13T22:48:31Z")

</div>

Closed on July 13, 2024, 10:48pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
