I want to connect a PIR Sensor and an LCD touchscreen to my Raspberry Pi B+. However, it seems that they both use the same pins on the GPIO, which makes me unable to connect them both directly. What would I need to be able to connect both to my Raspberry Pi?

  • Hello and welcome. Could you please provide a link to a technical datasheet of that LCD screen. Figuring things out from that amazon product page ist not the easiest way.
    – Ghanima
    Dec 20, 2015 at 17:57

1 Answer 1


The simple way to go here, is to change the GPIO pin used for the PIR sensor. As long as the display does not need ALL the GPIO pins that seems quite easy (note that I am not sure yet, how the display is connected, other than what the product page reads (Transmits data through SPI (clock maximum speed: 128 Mhz)).

Changing the input pin for the PIR sensor requires nothing else than fixing the script to the according pin number, the variable they call sensor:

sensor = 4

GPIO.setup(sensor, GPIO.IN, GPIO.PUD_DOWN)

From the picture of the LCD's product description it would seem that the GPIO pins 5, 6, 12, 13, 26, and 16, 19, 20, 21 (which double with some special functions) are not covered by the connector of the LCD. So have your pick.

Unfortunately however the 5V rail is completely covered by the connector. So there are a few options here to get to that pin:

  • breakout boards, header replicator, or cobbler; e.g. here, just look for something that could connect to the LCD module while still replicating the pins for a second use; (limited space in the given case might be an issue though)
  • soldering a wire either directly to the pin of the GPIO header of the Pi (preferably bottom side of the board) or to the pin on the LCD's board (top side in this case), make sure to keep the wire isolated as to not provoke any short circuiting; also some experience with the soldering iron would be advisable
  • Thank you! According to the PIR sensor worksheet it looks like one of the cables goes into a 5V pin. However, the screen occupies both 5V pins. How can I resolve this? Thanks! Dec 20, 2015 at 19:18

Your Answer

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

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