Page 1 of 1

Open collector or optocoupler

Posted: Thu Mar 17, 2022 10:17 pm
by Mike309
I'm looking at using the Heathcote Electronics infrared detector to detect trains and I want to feed the output into a Raspberry Pi. The Heathcote device runs at 12v and the Pi at 5v (as typical for a computer system).

The question is how to interface them - the Heathcote device includes an open collector transistor so plan A is to connect the 0v (ground) lines together, then connect the open collector into one of the inputs and use a 10k resistor to pull this up to 5v when the transistor is off. This seems 'safe' and typical of how an open collector transistor can be used.

But would you risk it? Plan B is to use the open collector to drive the LED half of an optocoupler and then use the output to connect into the lower voltage system

Thoughts...? (And apologies this is question is more electronics than trains!)

(I'll note that I won't be connecting directly to the Pi, instead using an MCP23017 which connects to the I2C bus, but it's still the same problem.)

Re: Open collector or optocoupler

Posted: Fri Mar 18, 2022 7:55 am
by teedoubleudee
Can you drive a relay from O/C to switch a 5 volt supply?

Re: Open collector or optocoupler

Posted: Fri Mar 18, 2022 8:58 am
by Tricky Dicky
Mike309 wrote: Thu Mar 17, 2022 10:17 pm

But would you risk it? Plan B is to use the open collector to drive the LED half of an optocoupler and then use the output to connect into the lower voltage system

Thoughts...? (And apologies this is question is more electronics than trains!)

(I'll note that I won't be connecting directly to the Pi, instead using an MCP23017 which connects to the I2C bus, but it's still the same problem.)
Either would do but for me it is the optocoupler as it allows for complete separation of the two power rails and although it will involve an extra component, optocouplers are not very expensive these days.

Richard

Re: Open collector or optocoupler

Posted: Sun Mar 20, 2022 9:06 am
by Stese
I looked at doing a somewhat similar project using a RPi to interface with a LT train describer device.

The selectors on the unit simply closed a circuit for each choice. I used a 12v supply on the describer side to actuate the coil of a 12v relay, for each circuit on the describer side, and then a circuit using the N.O .contact of the relay, to a pull-down resistor and finally the leg of the MCP23017.

This worked for me, but you migth have reasons not to go this way :)

Re: Open collector or optocoupler

Posted: Fri Mar 25, 2022 6:31 am
by Chuffchuff
Would a Hall effect module and magnet be an alternative?

I am messing about with using an Arduino as a controller

A number of articles on interfacing with a Pi on the net

Rgds

Re: Open collector or optocoupler

Posted: Mon Jun 27, 2022 12:10 am
by AusPete
Plan A would be perfectly safe.
The maximum voltage that could be applied to the raspberry PI input in this case is the 5V supply that the transistor collector pullup resistor is connected to