Go Down

Topic: Optoisolator Circuit (Read 2438 times) previous topic - next topic

mitchedwards

Hi guys so I am currently working on a pcb design that will be implemented in an automotive application and am needing to read some 12V inputs which are as follows:
Vehicle speed sensor: 0-12V Pulsed signal
RPM: 0-12V Pulsed Signal
On/Off Toggle Switch
VGT: 0-12V PWM Signal

I am thinking of using this optoisolator (LTV-847) http://www.digikey.ca/product-detail/en/LTV-847/160-1370-5-ND/385840

I was testing using simple voltage dividers but am planning on taking this to production so I need it to be safe and reliable.

I am new to optoisolators so am having a bit of a problem figuring out the circuit required for them.  I need 20mA through the led correct which is I forward correct?

and how would i hookup the transistor side to the atmega328p in order to have it so when the input signal is high the atmega reads high etc?

Here is what I am thinking so far But i do not know how to hook up the transistor side to the atmega chip.

JimboZA

#1
Nov 26, 2014, 07:52 pm Last Edit: Nov 26, 2014, 07:54 pm by JimboZA
Ground the emitters, Collectors to i/o as INPUT_PULLUP. The logic will be "upside down" since the collector-emitter gate will close with the led input high and thus take your i/o pin low, but that's easy to take care of in code.

edit.... each segment looks like the circuit shown here but with the internal pullup instead.
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

mitchedwards

I will be implementing this on my own pcb not on an arduino board or shield.  So what you are saying is i can use the atmega chip's internal pullup resistor instead of using an external resistor connected to the collector as shown in the link you provided?  If i wanted to use a external pull up resistor how would one go about calculating the resistor value for the collector?

Would it be possible to connect the i/o pin to the base as not to invert the signal going to the atmega chip?

Thanks for your fast reply!

JimboZA

I think 10k's a pretty common value for a pullup. Afaik, it's not calculated in the same sense as one would calculate the resistor in series with an led for example.

The base of the transistor is effectively the led anode, so I don't see what you mean about connecting the i/o there, it's the input. The nature of the npn transistor is that it inverts the signal.... I suppose you could invert the signal on the way in, with a 74xx (I forget the number, 7414?) inverter chip so when it gets re-inverted it's the right way up again.
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

Cactusface

Hi,
       Don't like, "upside down logic"  so Collector to POS, 10k to Gnd and emitter, emitter junction to Arduino input pin. signal=1 or pos or HIGH, etc.

Hope it helps.

Mel.
Open your mind! But not too far, your brains might fall out.
Also like Photography, model building and my 300+ Cacti and Succs.

raschemmel

Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Go Up