Interfacing a 12V (output) device

I have a digital pressure switch device that has a PNP transistor output. Bu tthe device is powered by 12V. It's a 12V battery which will actually be more like 12-14V fully charged. So the PNP output will be close to that. I need to test this output for on-off with my Arduino Mega. I assume I can't interface it directly and need it to be 5V. What's the best way to get that output to my Arduino Mega for reading/testing it's state?

Device output looks like this:

Capture

Hello getgray

Check the ussage of an optocoupler.

2 Likes

Vcc = black wire, ground symbol = blue wire.
New-Project(1)

4 Likes

An optocoupler - because we dont know what else is happening with the ground.

3 Likes

The ground of the Arduino is attached to the battery, and the ground of that pneumatic switch is too. Everything on the device shares the battery ground except some 24VDC converter used with an unrelated component and swithed with a relay (built in optocoupler for that one). Does that make the voltage divider OK?

I'd like to make this interface something I can make really small and in-line. Simpler the better. I probably have the resistors.

I understand the concept of the optocoupler but I'm fuzzy on the circuit needed. I happen to have some of these left over from a project I did many yeas ago:
https://www.mouser.com/datasheet/2/308/1/FOD814_D-1809419.pdf

Any help with the circuit I'd need to interface it? I think I'd need a resistor to current limit (t maybe 5ma) on the 12V side, the 5V side I'm not clear on.

schemeit-Project

3 Likes

Thank you for that. How does one select the value for the 15k resistor in particular? And pick the right current on the source side to fully saturate? I get controlling the current with the 2.7.

At 12V and 2.7k, I'll have about 4mA on the 12V side. The 15k @ 5V will allow about 0.3mA but I'm not looking for current there, only to make the output go high or low. I guess what I'm fuzzy on is how to know I've got enough current through the 12V side to (saturate?) switch the output side fully on. Probably right there in the datasheet, just not sure where to look.

On the LOW true version, the opto transistor collector current will only be about 0.3mA, so a LED current of 4mA should be plenty to saturate the phototransistor. When the transistor is not conducting (Vcc OFF), the 15k pullup resistor holds the input pin HIGH. When Vcc is ON, the transistor is conducting and pulls the input pin near GND (TRUE), about 0.3mA flows through the pullup resistor.
In the HIGH true version, the opposite happens. When the transistor is not ON, the 15k pulldown resistor holds the input LOW, with the transistor is ON it connects the input to +5V (TRUE), again, about 0.3mA flows through the 15k resistor. No current flows into the very high impedance input pin.
I tried the circuit with a Toshiba PC817 and seemed to work well, YMMV.
Check the CTR (current transfer ratio) ratings, current out for current in.

1 Like

Thank you again.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.