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.)
Open collector or optocoupler
- teedoubleudee
- Posts: 1116
- Joined: Fri Oct 05, 2018 2:53 pm
- Location: Downham Market
- Contact:
Re: Open collector or optocoupler
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
-
- Posts: 387
- Joined: Fri Oct 05, 2018 6:49 pm
- Contact:
Re: Open collector or optocoupler
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.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.)
Richard
Re: Open collector or optocoupler
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
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
Father, IT Guy, HO/OO Modeler.
-
- Posts: 125
- Joined: Sat Jan 19, 2019 9:23 pm
- Contact:
Re: Open collector or optocoupler
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
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
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
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
Who is online
Users browsing this forum: No registered users and 1 guest