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?
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 = 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