0
\$\begingroup\$

I'm applying optocoupler TLP521 to decouple microcontroller Atmega88 (on the left of the schematics) from the power circuit.

I have a problem understanding why the schematics below doesn't work in Multisim. The real board also doesn't work. Desirable behavior: if Key A = open then XMM5 and XMM6 = 0, if Key A = closed then XMM5 and XMM6 = 10-12V. Observed behavior: no matter what the I do with key A the output is always the same XMM5 and XMM6 = ~9V

Doesn't work

After playing around in Multisim a bit, the following schematics work as expected:

Works fine

Questions:

Can you explain why the first schematics doesn't work?

What schematics should I use for such application and how to calculate resistors and other parameters?

Do I need some pull-up or pull-down input resistors?

UPDATE:

Based on all the recommendations I tried the schematics below with a real board and it seems to work as expected:

Working real schematics

However, I don't understand why on the real board I have 0.8-0.9V on the input side if the input isn't connected to anywhere (check the schematics below). What may be the reason?

Strange voltage

\$\endgroup\$
1
  • \$\begingroup\$ perhaps you need a "shunt" resistor, 10k-100k to ground to pull out any residual charge. Basically it will pull everything to ground by leaking current on purpose, if there is no supply connected to that voltage rail. \$\endgroup\$
    – KyranF
    Apr 3, 2014 at 8:45

4 Answers 4

2
\$\begingroup\$

The top circuit won't work due to the 'Collector Dark Current ≈ 100nA' listed in the datasheet page 4/8, top table.

What happens when the LED is completely turned off is that the transistor in the optocoupler 'leaks' a tiny amount of current, effectively pulling its emitter up to the 12V rail. This can happen because there is no load on its emitter that can sink this current and the voltmeters will in this case be ideal. In turn this will pull up Q2 to 12V too.

In the second circuit the leakage current from the optocoupler will be sinked to ground by resistor R7. The voltage built up across R7 will be in the order of 100μA × 10kΩ = 1mV. This 1mV doesn't even come close to the 0.7V required to drive Q1.

And even if the voltage across the resistor was high enough to drive Q1, it is in an emitter follower configuration (Common Collector), practically meaning that the emitter voltage for Q1 is approximately 0.7V lower than its base voltage. Clearly not going to happen.

Only when there is sufficient current flowing through the opto's transistor, it can pull Q2 base up. Your circuit however may benefit from moving the load from emitter-ground to 12V-collector. Also in the latter case it is good practice to add a base resistor in series with Q2 base. Depending on the load this should be in the order of 1kΩ.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks for the great explanation. Please, check the update in the question, the board seems to work except one glitch I don't understand. \$\endgroup\$
    – Konstantin
    Apr 3, 2014 at 8:30
3
\$\begingroup\$

The optocoupler needs a load resistor to ground over which it generates a voltage. The voltage is based on the current it can put out. That first schematic doesn't generate any/enough voltage to turn on the base of the transistor.

\$\endgroup\$
11
  • \$\begingroup\$ Thank you for the reply, do you think that the second schematics is correct? \$\endgroup\$
    – Konstantin
    Apr 3, 2014 at 6:37
  • \$\begingroup\$ @Konstantin not saying it is 'correct', i am saying it is far more likely to work, seeing as the optocoupler can give you a voltage output rather than just sinking small currents into ground instead. The datasheet will tell you the gain, or expected current ratio from one side to the other, and it could be quite low. Basically, you should find out how optocouplers work and see a few reference designs/example schematics of ones that "work" and how, and why, and what sort of voltages/currents do they produce \$\endgroup\$
    – KyranF
    Apr 3, 2014 at 6:44
  • \$\begingroup\$ I'll definitely do it and upvote your answer when I'm able too. However, may be somebody can help me with a specific problem at hand. \$\endgroup\$
    – Konstantin
    Apr 3, 2014 at 7:06
  • \$\begingroup\$ The current gain parameter of the optocoupler gives you the information you need to calculate the load resistor for making the voltage you need. V =IR works in this case. \$\endgroup\$
    – KyranF
    Apr 3, 2014 at 7:23
  • \$\begingroup\$ I had a look at the data sheet, you need quite a lot (15-20mA) in the LED side to start getting good current through the collector of the optocoupler \$\endgroup\$
    – KyranF
    Apr 3, 2014 at 7:33
2
\$\begingroup\$

A voltmeter in a simulator has infinite impedance. A BJT on the other hand (when de-activated) has large but finite impedance. This means that under these circumstances, a BJT's emitter feeding a voltmeter will always register the collector voltage on the voltmeter.

You applied a pull-down resistor (R7) to make the circuit work - I'd suggest you use another 10k resistor on the emitter of Q1.

The resistor value isn't critical and could be as low as 1 kohm or as high as 100 kohm without seriously affecting functionality.

\$\endgroup\$
6
  • \$\begingroup\$ Thank you Andy, I'll try the schematics #2 on the real board in an hour (including your suggestion) and be back \$\endgroup\$
    – Konstantin
    Apr 3, 2014 at 7:36
  • \$\begingroup\$ Please, chech the update, the circuit works in the expected way except one aspect I can't understand. Do you mean that I need 10k in the emitter of Q1 in the addition to the 10k resistor in the collector? What's the purpose of it? \$\endgroup\$
    – Konstantin
    Apr 3, 2014 at 8:31
  • 1
    \$\begingroup\$ Q1 needs an emitter resistor to ground - read what I said in my answer - middle paragraph. The voltage you measure on the diode input is irrelevant when it is not connected to a source of energy that is defined like a resistor up to 5V - your meter cannot be expected to read a sensible value of voltage across a diode/LED. \$\endgroup\$
    – Andy aka
    Apr 3, 2014 at 8:44
  • \$\begingroup\$ I re-checked it with oscilloscope and the result was the same, still see this 0.8-0.9V. Can you explain a bit more why I see it? \$\endgroup\$
    – Konstantin
    Apr 4, 2014 at 5:00
  • \$\begingroup\$ An LED won't generate that voltage. That voltage will appear across the led if you are feeding a small current into it. \$\endgroup\$
    – Andy aka
    Apr 4, 2014 at 7:58
1
\$\begingroup\$

Edit: It looks to me like @Jippie has the right answer. Please consider this an appendix :)


Original post:

The optocoupler is effectivly a BJT, with a photovoltaic material at the base. When the LED shines light on the gate, it creates a current which drives the transistor. When conducting, there is a voltage drop over the optocoupler's junction.

This voltage is dropped again when current passes through R8. The only current flow would be through Q2's base. 1mA of base current through a 1k resistor would equate to a 1V drop. And the base current may be higher than that.

This reduced voltage is seen by both XMM6 and the base of Q2. As XMM6 shows, it is about two volts less than the supply.

Let's look at Q2. It's base is being driven, so current should flow from collector to emitter. The FCX458 has a collector-to-emitter saturation voltage of 0.5V. So, why doesn't XMM5 show 11.5V? It's because there is no place for the current to flow through! XMM6 is a high-impedance load, and MultiSIM might actually treat it as infinite impedance.

So, instead of flowing current, it just charges up the node at XMM6, minus some small base-to-emitter voltage through the BJT.

The way BJTs work can be non-intuitive. In cases where you want to simply switch power on and off, I might suggest looking at FETs instead of BJTs. They don't have a base current, which simplifies the analysis.

\$\endgroup\$
1
  • \$\begingroup\$ Thank you for the reply. No, the switch was open, so it outputs 0 (works as expected). \$\endgroup\$
    – Konstantin
    Apr 3, 2014 at 7:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.