I would like to try adding buttons and maybe a optical transistor (for IR) to my Pi. I've read several places advising the use of a 1k resistor as a buffer, but is that needed or would the input pin be ok shorted directly to ground or 3.3v? From what I've seen, it should be safe as long as the pin isn't switched to output, but I also don't want to blow up my Pi already :-)

Also, is it possible to use an optical transistor this way?

  • Some clarity... by safe, I mean if pin 7 was configured as input and was shorted to pin 9 with a screw driver, would it cause any damage. As for the optical transistor - I wasn't very clear. I'm thinking of an IR receiver like what is found in a TV/VCR/DVD player. I would like to be able to record the code output by the TV remote and store that for playback (though an LED). Is that even possible?
    – BAReese
    Sep 10, 2013 at 17:41
  • It is never good idea to short any thing. Especially with a screwdriver. Just think of voltages as digital signals of value 1 = +voltage and 0 = 0voltage.. THe +voltage depends on the device. I am not sure about the Pi but safe to think of half way. So at least +1.8v will give you good logic. It does not need to be shorted and better if it is after resistor to protect battery and other stuff.
    – Piotr Kula
    Sep 11, 2013 at 16:00

1 Answer 1


See the recent discussion in:-

GPIO: Why wire button to ground rather than +3.3v?

You don't make it clear what you propose using "optical transistor" for, but if you google you will find lots of examples using opto-isolators.

  • Thanks. I did see that discussion, but couldn't really tell from that whether it was safe to connect directly or if a resistor was necessary. It seems to me that it is possible to connect directly - though the added resistor is recommended for protection.
    – BAReese
    Sep 10, 2013 at 17:26
  • As for the optical transistor, I would like to be able to accept input from a TV remote. Like maybe to send a command to dim the lights when the TV power button is pressed on the remote, for example. I'm not sure how well this would relate to an opto-isolator as it seems those are used more to control another circuit while keeping the two segregated. Maybe I'm misunderstanding them though.
    – BAReese
    Sep 10, 2013 at 17:29
  • If you want to use IR input, then a simple optical transistor is not sufficient. You would need more amplification and clipping. There are dedicated chips for this, but a USB IR sensor would be better. You would have to write code to decode the pulse train either way.
    – Milliways
    Sep 10, 2013 at 23:26

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.