Open collector or optocoupler

Post Reply
Mike309
Posts: 7
Joined: Tue Feb 12, 2019 6:14 pm
Contact:

Open collector or optocoupler

#1

Post 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.)

:geek: Mike.
User avatar
teedoubleudee
Posts: 1043
Joined: Fri Oct 05, 2018 2:53 pm
Location: Downham Market
Contact:

Re: Open collector or optocoupler

#2

Post by teedoubleudee »

Can you drive a relay from O/C to switch a 5 volt supply?
Most people are shocked when they find out how bad I am as an electrician
Tricky Dicky
Posts: 323
Joined: Fri Oct 05, 2018 6:49 pm
Contact:

Re: Open collector or optocoupler

#3

Post 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
User avatar
Stese
Posts: 228
Joined: Thu Oct 04, 2018 9:26 pm
Location: Chester, UK
Contact:

Re: Open collector or optocoupler

#4

Post 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 :)
Husband, Father, IT Guy, HO/OO Modeller.
Chuffchuff
Posts: 123
Joined: Sat Jan 19, 2019 9:23 pm
Contact:

Re: Open collector or optocoupler

#5

Post 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
AusPete
Posts: 3
Joined: Sun Feb 06, 2022 10:00 am
Contact:

Re: Open collector or optocoupler

#6

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests