I'm really trying to develop a cape since I need to use 7-8 GPIO-Pins of my BBB Green and Black as Output. I'm too afraid to destroy the board somehow, so I was thinking to implement a solution which let me operate my board under safety condition without frying anything.

After reading over the internet I came up with the following solutions:

  1. Here I would use a phototransistor such in the following schematic:

    Picture #1

It is a light modification of this circuit: Raspberry Pi GPIO

the pros are that I don't need to care about the initial voltage state of the GPIO pins after booting the board. The BBB-SRM cleary states that no pin should be driven at boot, otherwise it can destroy the board. Another pro is that I can get a non inverting signal at the emitter of the transistor (maybe I should put another resistor to reduce the current in the collector). The only contra is that I should place and sold many resistors (at least 8) for my circuit. With this schematic I want to drive some circuits which are connected to the BBB.

  1. the other one is simply to use such a non inverting transceiver like the following 74HCT245 In this case I would connect the single GPIO of the BBB directly, without any resistor, to the input of the device.enter image description here The pros are that I don't need any resistor and can connect the gpio directly

I would realize the first schematic because I'm really not sure whether the second one right is or not. If you think that the second one better or the most used is, could you please tell me why? I really want to learn and understand in this process and not just sitting there and doing passively circuit from the net.


I prefer the opto version. It gives better isolation, especially if the 5V supply is separate from the micro board supply. I agree with Marko that the load resistor should be on the collector side of the output transistor. Of course that means the output is inverted. I once needed to use the configuration you show. I made it work, but had to do some changes. This is what I ended up with.

First you need a bigger resistor in the emitter. I used 10K. I also used a 4N32 which has a Darlington pair output. This was needed because the transfer ratio was too low on a normal single transistor output. It didn’t drive even a 10K to logic levels reliably.

The next problem is that sometimes the optos started having some leakage current and the output voltage would start creeping up from 0V when it was not being driven. Often this didn’t happen until it was in the field for a while. The 4N32 brings out the base of the transistor pair to a pin. Putting a 3.3M resistor from that pin to ground solved the leakage issue. Even after all that, I only got it to work reliably with Fairchild 4N32. I sometimes had problems with other brands.

Based on the potential problems, the inverting version with a 10K load resistor between the collector and 5V is a better solution.

| improve this answer | |
  • \$\begingroup\$ Why would you want the load resistor on the collector? This phototransistor does not have a base whose voltage would matter. \$\endgroup\$ – CL. Jan 24 '16 at 9:21
  • \$\begingroup\$ @CL. Interesting question. I would know why should I put the resistor on the collector. Furthermore I have the problem with the inverted logic. \$\endgroup\$ – Dave Jan 24 '16 at 10:56

1st. This is optoisolated input, I would rather use an inverting version with pull up, also the emitor resistor is way to small (IMO), I would use 1.2k to 4.7k, maybe 10k would also work, you need small resistance value if you intend to catch up some pulses. Also an external diode parallel to the LED is a nice feature, to limit the inverse voltage (in case you mistakenly change polarity). The sense of using optoisolated input is when you have different power sources for IO and CPU.

Why don't you copy some already made otpoisolated input board?

| improve this answer | |
  • \$\begingroup\$ Why don't you copy some already made otpoisolated input board? For istance?!? I couldn't find any simple designed circuit that was simply enough to be realized. \$\endgroup\$ – Dave Jan 24 '16 at 10:53

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.