Electronic – A protecting circuit using GPIO of the BeagleBone (Black or Green)

beaglebonebeaglebone blackoutputphototransistortransceiver

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.

Best Answer

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.