Open collector or optocoupler
Posted: Thu Mar 17, 2022 10:17 pm
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.)
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.)