I have bought this touch screen.

It looks and works great. I wanted to play round making a simple Kivy app with buttons that turn on/off LEDs and relays. But it seems that when the screen is connected (via HDMI and USB, screen has its own PSU), the GPIO pins don't work. The 5V and 3.3V pins work fine and a LED lights up when connected, but switching other pins doesn't work. Nothing happens.

Using this simple script to test:

import RPi.GPIO as GPIO
import time
GPIO.setup(17, GPIO.OUT)
while True:
    print "ON"
    GPIO.output(17, True)
    GPIO.output(17, False)

2 Answers 2


Some of these touchscreens that come with their own images of the OS with the drivers pre-installed don't properly compile the kernels to handle GPIO outputs from python. I had the same problem. I was able to find someone who wrote a touchscreen driver that did not require the pre-installed kernels, thus avoiding the problem. I couldn't tell what the model of the screen was from the link that you provided, so it is likely that my exact solution will not work for you. But see my post below, as it deals with the same problem.

Touchscreen drivers disable GPIO interface in Python

What you will probably find is that you will not be able to make this work unless you can find a way to either re-compile the system kernels with GPIO access, or write your own touchscreen drivers. Now, in the link to the drivers in that post above, the driver's creator does describe exactly how he was able create the drivers, and all the source code is there, so maybe this will be helpful to you.

Since the drivers worked for me, I don't have any further knowledge of the situation, and I don't have any experience with creating system kernels. However, I hope my own experience with these troubles will send you along the right path.

  • That's the problem with buying devices tied to a particular software image. An alternative may be to use one of the libraries which does not depend on the kernel GPIO drivers. E.g. my pigpio.
    – joan
    Commented Oct 5, 2015 at 8:07

You use the setup method to set the mode of a GPIO to be an input or an output.



should be

GPIO.setmode(GPIO.BCM) # Set Broadcom GPIO numbering mode.
GPIO.setup(17, GPIO.OUT) # Set GPIO as an output.


  • Hi, should have explaned more. I have a working script using physical buttons. I now want to replace the buttons with that touch screen using Kivy. Now somehow the pins don't seem to work. Tried different Pi 2's. Without the touchscreen the pins work, with it, they don't. And remember the screen works via USB and a separate PSU. My code already was the same with the "GPIO.setup(17, GPIO.OUT)", just made a typo :-)
    – jojonl
    Commented Oct 2, 2015 at 5:35
  • Did some more testing. I connected a simple 5v relay instead of a LED. Tried different pins 17, 18, 23 and 27... no succes. When I connect it to one of the 3v pins, it works just like the LED :'-(
    – jojonl
    Commented Oct 2, 2015 at 6:06

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.