0

I'm using Pi 3

I have a line that gives 12V. I need to invoke something on Pi, when the line goes High.

As I cannot connect the 12V to GPIO, I thought of using a relay, that will trigger on 12V, and then connect the 3v3 to a GPIO.

This will happen periodically, for almost a second.

I know that the 3v3 will have current that is unused by the Pi, but in this case I cannot always be sure how much thag would be.

Is this safe?

1

Use a voltage divider, or a 10V zener diode. My 10V zeners drop 9.49V, and would in your case yield 2.51V; a HIGH on PI. Optionally use a PNP+NPN pair to close the connection from the 12V line to the Pi when polling the voltage, or there will be a bit of leakage.

0

First you need to implement a De-bounce circuit, it will prevent the mechanical contact that can bounce when they touch together and be read as multiple contacts.

There is no "unused" current, the circuit will draw as much current as it need and the output will deliver it, if it can.

0

It is simple to interface a higher voltage indicator to the Pi, provided they can share a common ground connection.

Using relays is sledgehammer solution which introduces a number of other problems.

The simplest approach uses a voltage divider. Do NOT attempt to produce 3.3V, anything over 2.2V will reliably trigger the Pi (my tests indicate 1.3V is OK).

If the source is not clean DC you can implement various protective measures - either a diode clamp to 3.3V or a total isolation e.g using an optoisolator.

  • No, I'm saying can I just use the 3v3 given by the pi, and supply it to one of its own GPIOs for a second? – Dushyant Bangal Feb 15 '18 at 8:08
  • @DushyantBangal Yes you can. If connecting any low impedance source to a Pi GPIO it is recommended to use a series resistor ~1kΩ. Using a relay is still a sledgehammer approach with potential contact bounce issues. – Milliways Feb 15 '18 at 8:17
  • The thing is, I have the -ve going to a motor in an enclosed casing. So I cannot really get it to a voltage divider without some rewiring. Also, wouldn't voltage divider give out same amount of current and hurt Pi? – Dushyant Bangal Feb 15 '18 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.