0

I have a device with a built in voltage divider and opto-isolator. I need to send a pulse to from the RPi GPIO output to the input pin in the circuit.

The output from the optic-isolator goes to an input pin on a microcontroller in the device (not shown).

How can I bring the input voltage down to a safe level that I can plug in to the GPIO output pins?

What happens if there is a higher voltage (I.e. 4.5V) on the GPIO output pin? When the GPIO output turns on, will current flow in reverse and damage the PI? When it’s off will it sink the 4.5V to 0V?

Thanks, Niko

schematic

simulate this circuit – Schematic created using CircuitLab

  • 1
    The "circuit" is nonsense. I see no " voltage divider". It unclear how this relates to the Pi – Milliways Apr 27 at 1:53
  • Ah your beautiful circuit is a nice locking down Monday jig saw puzzle. Now let me think aloud. (1) The opto-isolator output is not connected to anything, so I guess that is not relevant. (2) The current passing the LED should be 9V / 20k ~= 0.45mA, seems a bit too small. (3) I guess the input terminal is what you want to input to the Rpi GPIO. Please correct me otherwise. (4) Assuming boundary case that the LED voltage is 0.5V or less, so input V ~= 9V x (10k / (10k + 10k) ~=5V (5) So now you need to step down the too strong input 5V signal to about 3V for the weak Rpi. / continue, ... – tlfong01 Apr 27 at 2:29
  • (6) You can use another voltage divider with resistors x, y, to step down 5V to 3V, say 5V x (x / y ) = 3V. (7) The x and y above must be a bit bigger than those of the first divder, so not to "load down/distort" the first divider, I would choose 300k / 500k. (8) The EE guys would usually use CD4050 to do the step down, at the same time protecting the Rpi GPIO from "latching up" and melting down. (9) My almost always dodgy calculations have not been proof read. (10) No guarantee no nothing won't melt down or blow up. Best of luck to you circuit. Cheers. – tlfong01 Apr 27 at 2:29
  • Hi @Niko, So I solved the wrong jig saw puzzle. Let me try again. (1) You need to first read the datasheet of the optoisolator before desiging the circuit. The most popular isolator is EL817C. You might like skim my post below to get a rough picture, (1) EL817C raspberrypi.org/forums/…, (2) Then you can skim my other post on how EL817C is used in also very popular 5V relays: (2) Optoisolated Relay Input raspberrypi.org/forums/…. – tlfong01 Apr 27 at 3:39
  • 1
    I really appreciate the help. I will look in to that NPN 2N2222 you suggested and try it out. – user118881 Apr 27 at 4:56
1

Question

The OP has the following device. He would like to know how can Rpi interface this device.


pullup circuit


Question Analysis

The OP is asking 4 little questions. All 4 questions are OK, except the third question repeated below that causes some confusion.

How can I bring the input voltage down to a safe level that I can plug in to the GPIO output pins?

The OP knows that he needs to do two things:

(1) Send a pulse (switch on/off control signal originated from the 3V3 Rpi GPIO pin) to the input terminal of the device.

(2) Steps down the input pulse voltage to the logical level of 3V3 of the Rpi GPIO pin.

I needed to scratch my little head a bit hard to figure out what went wrong and how to correct it. Actually the OP did nothing wrong, it is only that he is a bit ambitious in the input output direction. I also confused myself in the very beginning because I also mixed up the input/output direction.

Now I think both the OP and me should agree on the following rephrased question.

(1) How to send a pulse from Rpi's 3V3 logic GPIO pin signal to control the device?

(2) How to convert/step up any 3V3 logic level signal to 5V?


Circuit Analysis

The OP points out that there is a voltage divider, dividing down the power source of 9V to roughly middle of 4.5V.

He might not know what I have guessed the following: The input terminal confronts to TTL logic and also Arduino logic, where > 4.2V is High Level.

For Rpi the High Level is only about 3V, not high enough to trigger the device. So the questions boils down to the logical level converter/shifter problem, converting any controller, including Rpi's 3V3 signal level to TTL/Arduino's 5V logic level.

One of the many common solutions is to use 2N2222 in open collector mode, as described below.


Answer

(1) The input terminal is to control the pull down circuit.

(a) If input is 0V, no current flows in LED, then output transistor/diode is disabled.

(b) If input is at around 5V or floating) then current flows in LED and therefore enabled. 

(2) One solution is to use a NPN 2N2222 in “open collector” mode (Rpi GPIO output mode, with 330R connected to 2N2222 base, 2N2222 emitter connected tor ground, and 2N2222 collector connected to input.

pullup


Discussion

/ to continue, ...


References

(1) Transistor as a Switch - Electronics Tutorials

(2) Pull-up Resistors

(3) 2N2222 - Wikipedia

(4) 2N2222/PN2222 General Purpose Transistor Datasheet - FairChild


End of Answer

| improve this answer | |

Your Answer

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