# Send signal to gpio when 8V power drops

I want to be able to detect when a 8V signal goes low and send a signal to a raspberry pi over GPIO. A java app will be listening on the GPIO pins for any changes.

I would check if the voltage drops via the pi directly, but I need to check 10 signals and do not want the pi (and 3v LDO voltage regulators) absorbing 3v per signal constantly while dissipating the other 5v. Dissipating 50v and absorbing another 30v will probably produce enough heat to melt the pi without some major cooling.

I have seen examples using optocouplers or NPN transistors, but need to get the output signal to within the pi's tolerances of between 2.0v and 3.3v.

• What are these voltages you are talking about? Volts are not "dissipated", power is. What are you trying to do? – Eugene Sh. Aug 4 '15 at 20:34
• I'm sorry but your understanding of voltage, GPIO input resistance, current, and heat/dissipation is wrong. – KyranF Aug 4 '15 at 20:53
• You cannot plug in many (or even one) 8V signal directly into an unbuffered GPIO pin, this is true. But it is not because the gpio pins dissipate the difference as heat. – crasic Aug 4 '15 at 22:05
• What you need is a combination of 10 voltage level converters and resulting in a simple logic HIGH/LOW on the GPIO, which you can deal with in software. Are you able to do any breadboarding? Will you be making a PCB from the results of your testing? Can you get a supply of resistors, capacitors, diodes, and NPN BJT Transistors? – KyranF Aug 4 '15 at 23:42

## 2 Answers

Voltage divider:

simulate this circuit – Schematic created using CircuitLab

The actual resistor values do not really matter that much, as long as $\frac{R1}{R2}$ remains $\frac{3}{5}$. The 8V connection is connected to GND through $R1+R2$, so this shouldn't be too small; but if you select them too large, the pull on the GPIO might be too weak. R3 is optional, it just reduces the current flow further.

For this to work, the GPIO may not have a pull-up or pull-down configured.

Just configure the gpio pin with a pullup in software, then connect it to the open collector or open drain of a transistor or opto-coupler. The pi will then provide the proper voltage through the pullup. See the gpio documentation, you will use a python statement such as:

gpio.setup(chan,gpio.IN,pull_up_down=gpio.PUD_UP)


You still need to design the circuit that feeds the base or gate or input led of the opto-coupler. Such a circuit will turn on the transistor or coupler somewhere between 0 and 8 volts. You must decide how accurate the transition must be and at what threshold voltage, but it sounds like you have some resources for that.

• Just to expand on this, the emphasis on "You still need to design the circuit" which interfaces the 8V to the GPIO; probably using a low-side discrete transistor based circuit, where the GPIO and it's internal pull-up are the "high side" part of that circuit. – KyranF Aug 5 '15 at 0:19