Completely new in the Raspberry Pi community, so please excuse me if this is a total noob question.

Model: Raspberry Pi 4 Model B

Component: Adafruit PIR motion sensor

I am currently following the following a simplified tutorial to hook up a PIR sensor using a 40 pin cobbler plus and breadboard: https://learn.adafruit.com/adafruits-raspberry-pi-lesson-12-sensing-movement/hardware

I have simplified it to exclude the verify the PIR sensor value and then print out "PIR ALARM!" What ends up happening when I run the code is, even when no motion is detected, the pir_sensor value in the code below is returning true.

I have adjusted both the time and sensitivity switches on the PIR sensor, but to no avail. What could I be getting wrong here?

Here is the code:

import time
import board
import digitalio

# set up motion sensor
pir_sensor = digitalio.DigitalInOut(board.D18)
pir_sensor.direction = digitalio.Direction.INPUT

while True:

    if pir_sensor.value:
        print("PIR ALARM!")


And here is my setup with the PIR sensor to my breadboard: board layout PIR sensor

  • 1
    Ah I had the same problem the first time I played PIR stuff, a couple of years ago. I found the problem very interesting and so I started my PBL (Problem Based Learning), googling wildly. I have read over ten tutorials, including Lady Ada in 2013, and the Shanghai scientists and engineers who developed the first generation of PIR. I was very impressed by the very detailed explanation of the physics principles and the engineering design and practice in making the product. I spent perhaps 20 hours experimenting the couple of different versions of PIR and finally solved the problem, to cont.
    – tlfong01
    Apr 30, 2020 at 3:19
  • 1
    I am very slow in using broken English to tell my long PIR story. But I did spend another couple of hours explaining in this and other forums what I found was the cause causing fake alarm and how I verify my hypothesis, using a rice bowl. You might like to search this forum for my rice bowl post. Happy learning. Cheers.
    – tlfong01
    Apr 30, 2020 at 3:25

1 Answer 1


There are too many potential problems with the set up.

First of all you need to confirm your cobbler is correctly attached to the Pi and the breadboard.

Using a volt meter do you read 3V3 between a 3V3 column and a ground column on the breadboard?

Do you read 5V between a 5V column and a ground column on the breadboard?

If so try connecting the pin 18 column to a 3V3 column and then a ground column.

Does your software report the change?

  • It sounds a bit like I need to take a step back and dig a bit more into the fundamentals first. I will perform the suggested testing and report back!
    – KPM
    Apr 30, 2020 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.