1

I have a Raspberry Pi 2 Model B and I am wondering if there is a pre-made solution, if I have to make it myself, or if it isn't an issue. For my project, the GPIO pins will be in constant use as inputs to check whether there is a signal or not, and the circuit that sends signals to the GPIOs can still send signals to the pi while it is off as it is not ran off of the pi. The circuit is a 6.3 VAC signal being converted to roughly 3.3 VDC following the diagram below.

schematic

simulate this circuit – Schematic created using CircuitLab

There are multiple AC sources but they have a common ground (not the pi). I have 20 inputs to the GPIO, each either ~3v3 (but not over) or 0. I am planning to order a custom PCB so I can edit as needed.

6
  • 1
    You won't hurt the pins if the Pi is off, so long as the output of the other device does not send a signal that's higher than the voltage the Pi GPIO can handle.
    – stevieb
    Jan 30, 2020 at 19:00
  • Ok, thank you. I thought that it would be an issue.
    – SwampyX
    Jan 30, 2020 at 19:40
  • @stevieb that‘s not true, applying voltage to a gpio while the cpu has no supply voltage is not a good idea! The input signal will pull the pi‘s 3V3 rail high via the esd protection diodes which means the gpio has to provide the entire current for the pi which will probably destroy that gpio. At least the current has to be limited
    – Sim Son
    Jan 30, 2020 at 20:21
  • @SimSon how do you suggest I protect the pi, then. Do I just limit the current on the input?
    – SwampyX
    Jan 30, 2020 at 21:45
  • That circuit will put 3.36V on the Pi (possibly more if the source is lightly loaded). This is unnecessary and risky.
    – Milliways
    Jan 31, 2020 at 3:22

2 Answers 2

1

Generally, the voltage applied to a CPU’s gpio must not exceed the actual supply voltage. If the supply rail is below the voltage at a gpio, the gpio‘s esd protection diode (see figure below) is conductive and pulls the supply rail high. The pi will try to operate at this voltage and sink a reasonable amount of current.

pi‘s esd protection diodes

As those diodes are not meant to be operated with continuous current they will most probably get destroyed, which results either in this gpio remaining high (diode shorted, gpio useless) or a destroyed esd protection (diode opened, next esd event might kill the gpio).

The options I see:

  1. isolate all inputs from the external device using optocoupplers (this is not going to work with open-drain logic like i2c)
  2. disconnect the external device with mosfets, use the pi‘s supply voltage to switch
  3. (if possible) solve it in software on the external device: measure the pi‘s supply voltage and deactivate communication respectively
  4. choose a different approach for your initial task (maybe you can explain the scenario a bit more precise)
5
  • Ok. The external source isn't a device, and I will improve clarity on the post.
    – SwampyX
    Jan 30, 2020 at 23:39
  • Also, I will use optocouplers. It seems like the simplest setup for what I intend to make.
    – SwampyX
    Jan 31, 2020 at 1:17
  • Since we are only interested in the voltage, but not in the current of the input (since the GPIOs are voltage-driven), I would assume that this is not a problem if the current is limited enough, i.e. by using resistors 10 or 100 times larger than the ones suggested above.
    – PMF
    Jan 31, 2020 at 8:55
  • @PMF there is no voltage without current as you have to charge up the gate capacity. The resistance determines the signal‘s rise time and you don‘t really want to make it too high, especially for open drain lines.
    – Sim Son
    Jan 31, 2020 at 15:02
  • Yea, but MosFet controlled input pins require very small currents only.
    – PMF
    Feb 1, 2020 at 12:11
0

There is no need to do anything in most cases!

NOTE it is INADVISABLE to connect foreign 3.3V to the Pi (or any other electronic device). Provided the input voltage exceeds the threshold by a reasonable margin it will register as HIGH - I normally design for 2.2V.

If the external circuitry is connected by long wires and/or in a noisy environment it may be prudent to provide shielding or measures to limit induced transients or noise.

Use of low impedance pullup and a series resistor increases noise immunity and provides protection.

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.