0

Very new to GPIO and wiring circuits so I'm hoping someone can clarify whether what I'm doing is going to be safe for the Pi.

In my original question I was looking for the way to get my 12V supply down to a nice voltage for GPIO. After learning about voltage dividers I got a working breadboard layout connected to 4 button/LED combinations using resistors and each mini-circuit got down to 2.34V - safe for GPIO input.

I'm just using GPIO button to check for a closed button - not powering anything thru GPIO

In theory only one button will only ever get pressed at once - but my question/worry is what happens if more than one button gets pressed at same time,- each one supplying 2.34V to separate GPIO inputs? Will the Pi be safe?

My circuit on falstad looks like this - with one switch closed (showing 2.3V)

The 4 center outputs will go to separate GPIO pins on the Raspberry Pi

EDIT: UPDATED CIRCUIT TO SHOW PI CONNECTIONS

Updated Pi Circuit Connections

3
  • The "circuit"above makes no sense. I assume you are connecting to GPIO pins.
    – Milliways
    Mar 5, 2022 at 6:48
  • Yes. I said "The 4 center outputs will go to separate GPIO pins on the Raspberry Pi"
    – dbmitch
    Mar 5, 2022 at 7:05
  • I added a label to the GPIO nodes in that falstad circuit
    – dbmitch
    Mar 5, 2022 at 7:19

3 Answers 3

1

There is no possible mechanism in which the pressing of 1 or 4 buttons could conceivably change the voltage on the dividers unless you have multiple buttons connected to the GPIO.

2

Your circuit is good but I am not comfortable with 2.3V as an input, I would change the 10K resistors to about 6.8K bringing the input voltage to just over 3V. That will give you a solid logic 1. I do this with 24VDC and use a similar arrangement but I also add about a 27K to 50K resistor in series from the voltage divider to the port pin. This gives me the voltage I need and does not drive the processor with damaging current if its supply fails and the 24V remains on. This also gives me protection if the bottom resistor opens for some reason, the higher voltage will forward bias the protection diode but not with enough current to damage anything.

5
  • So no issues with multiple 3V inputs into GPIO at once? What happens when that extra resistor is inline and 24V gets to it? I'll see what combinations of resistors I have around the house
    – dbmitch
    Mar 5, 2022 at 6:34
  • 1
    See Voltage Specifications Any voltage below 0.9V will be LOW Any voltage above 1.6V will be HIGH I design for an input > 2.3V (which is midway between VIH and VCC) for maximum noise threshold.
    – Milliways
    Mar 5, 2022 at 6:50
  • Is 2.34 enough over the 2.3 to be reliable HIGH then?
    – dbmitch
    Mar 5, 2022 at 7:04
  • How do you read that table to show 0.9V and 1.6V are the Low/High cutoffs? I see them mention 1.8/2.7/3.3. I'm not sure how to interpret it. Or are you taking the max input low voltage (0.9) and the max input high voltage (1.6)?
    – dbmitch
    Mar 5, 2022 at 7:18
  • @dbmitch the Pi all use VDD of 3.3V. The SOC can use multiple voltages but this is not relevant for the Pi.
    – Milliways
    Mar 5, 2022 at 7:52
1

Your circuit is OK. Each voltage divider is independent from the others, so there's no possible interference between them if you press several buttons. Note that you don't need to connect 4 GND pins, one would be enough, and more wires means more room for mistakes. I would have also set your voltage dividers to a value close to 3.3V, unless you expect your power supply to deliver > 17V under some circumstances.

As a side note, I see you have drawn the circuit diagram in a simulator. Go ahead and run the simulation, then toggle the switches to check the combinations you have in mind. The simulator can plot the voltages on each GPIO in a scope, and you'll clearly see the voltage levels are OK at all times.

1
  • Thanks Dmitry - I was just going to ask about the separate grounds - saved me one more beginner question! Much appreciated. Makes sense about reducing the confusion too - I can barely see anything now once I put them in a box. I keep wondering if I should look at some kind of to convert breadboard to PCB software. This is getting very hard to test.
    – dbmitch
    Mar 7, 2022 at 18: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.