Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Control opto anything (such as optotriac) from +3.3V GPIO MCU?

Spoerle

Junior Member level 2
Joined
Mar 22, 2022
Messages
22
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
292
I have a trivial question at first glance.
Example:
assignment We want to control MOC3083 help GPIO some +3.3V ARM processor and we want the trip to signal the red LED.
My solution MOC3083 have LED Trigger Current 5mA MAX. forward voltage for 5mA and temperature -20C approximately 1.25V (use 1.3V).
RED LED for 5mA have forward voltage 1.7V the effect of the temperature, the manufacturer is melting.
If we connect the diodes to the series at 5mA voltage loss typically 3V and cnnect t directli on MCU GPIO .
The question is that right?
or
I should use a serial connected resistance of 20 to 40 ohm
or
use an external NPN transistor (BC817-40) NMOSFET (BSS138) and from GPIO control the transistor
or
Or somehow complicate it more
Everything will be a question of what is the most reliable solution and already in terms of LEDs in Optotriac, Triac, MCU
Generally Opto-xxx, I have recently dealt with several optocouplers with a defective "illuminated" LED

Thanks
 
Hi,

A sketch, a simple schematic?

Some issues:
* "ARM" is an IP name for a processor core, it has nothing to do with hardware.
* "3.3V" .. I guess this is the supply voltage. Supply voltage is not accurate and not prcise. It will never be 3.300V and it will drift with time, temperature and load current.Imagine the 3.3V supply voltage drops by 10% to less about 3.0V ... your calculated current would change dramatically.
* "3.3V" isn´t the port output voltage. Port output voltage depends on the used hardware (microcontroller, see datasheet) maybe the port setup, on supply voltage, on load current. It also depends if your port has to source or sink the current.

But driving a 3.0V load on a port of a 3.3V supplied device is not a good idea at all. You are too close at the edge, tolerances and drift may easily lead to too low, or too high current.

Klaus
 
OK very fast
Under ARM, let's imagine some Cortex M core with IO at 3.3V, if you want to be more specific, for example STM32Fxxx



m.jpg
 
Hi,

"Cortex M3" also describes a core but not any port output operation.
Cortex M3 an IP sold by ARM. It is bought by a lot of microcontroller manufacturers and implemented in their chips.
So: Different manufacturers, different silicon, different operation modes.

Again you say "3.3V IO" --> read post #2

You need to read the according datasheet regarding output port operation.

if you want to be more specific, for example STM32Fxxx
Indeed it´s not me who needs it to be specific. Your application needs proper informations.
No one of us can tell which STM32Fxxx you use (there may be hundreds) ..and what port setup you use.
As long as we don´t have the informations it´s impossible to give detailed assistance.

****

You did´n name them. I do it the same way. You neither asked a clear question.

* No current limit, likely to kill a device,
* No current limit, D2 won´t work, likely to kill U2
* may work or not, depends on tolerances, voltage problem already mentioned
* No current limit, likely to kill a device,
* No current limit, likely to kill a device,


Klaus
 
Representative ST part (OP did not post part number) :

1699444586373.png


So you can "kind of" get an idea of series R

R = [Voh_min - (Vled_max + MOC3083_LED_max)] / 5 mA

So ST PIN >> R >> LEDred >> MOC3083 would be simple interface. Also for insurance
and parasitic pickup, add R from MOC3083 input to ground to insure when ST micro
starting up, its inputs floating and then when min supply met set as inputs, no false
triggers. Something like 10K.... Note there is a tradeoff as it robs some MOC3083 drive
current, so too low not good, too high because of possible pickup not good.

Note ST part (as shown by table) can operate to 3.6V so careful choice of regulator and
its tolerance can easily handle drive. And note table above is stated for 8 outputs driving,
which is telling user what internal ST supply bus affects look like (indirectly).


Regards, Dana.
 
Last edited:
1699450880792.png



This may be handy to remember.

@ 3.3V range Vol/Iio = 0.4/8mA = 50 ohms max (one CMOS std.)
@ 2.3V range = 0.4/6mA = 67 ohms max.

Red LED 5mm = 2.1V @ 20mA Rs ~ 10 ohms,
White LED 5mm @ 20mA Rs ~ 15 ohms
PN2222A @ 200mA Rce ~ 1ohm
All diodes have a saturated ~ linear resistance, Rs that can be estimated from the power rating. Rs< 0.5/Pmax +/-50%
The main reason why diode Vf voltages vary for the same type, (config, chemistry, colour so much is only due to the tolerance on this Rs bulk resistance.

So you can estimate Vf from changes in the current.

Due to these mfg tolerances, it is unreliable to put all these devices in series here. (2.1V.red+1.2V.ir=3.3V.dd) When the nominal voltages add up to 3.3V you ought to realize the tolerances will cause RED LEDs to blow as you have experienced. If I understand your logic, you want them in series to ensure if the IR LED is ON that the RED LED will be sharing the same current and you wanted a guaranteed indicator that the Triac is ON but then you risk burning out something from excessive tolerances.

Solutions: There are many, but possible failures must be avoided from worst-case tolerance stackup.

One can solve this with LEDs in parallel with separate resistors and choose ultra-efficient LEDs bright enough at 2~3 mA ( rated for 5,000 ~ 10,000 mcd @ 20 mA ) and use 5 mA max for the MOC3083 which has the highest Rs in production (sorted) and thus should be the cheapest. So can you drive the uC @ 3.3V with 3mA + 5mA = 8 mA? Certainly! Even more if not using logic levels.

How much margin should you add to ensure Vdd margins will not exceed the current rating of the LEDs? 25% of 8 mA? Thus target design for 6 mA total using 2 mA for LED and 4 mA for Opto.
The IR LED is 1.2V @ 10mA nom @ 25'C +/-0.1V at temp extremes

Suggestion:

Consider 330 ohms to RED LED, 470 ohms to IR LED both driven by 25 to 50 Ohm CMOS GPIO.

1699457238776.png
 
Thank the heavens Tony picked up on no headroom left in a 3.3V system
once all tolerances considered. Time for me to go back to EE Kindergarten.

So drive the LED with a seperate pin with a R limiter, or same pin with
a simple 2N3904 kind of part, LED in collector with a series R to supply.
Series R in base to pin, design for forced beta of 10, eq Ib = Iled / 10,
and a 10K from base to ground to hold off LED while GPIO in unknown
state on power up.

Regards, Dana.
 
If the topic is about how to control an external module with an optocoupler from some MCU, I will contribute a little to the mill.
From the point of view of simplicity, it is really easiest to connect the diodes in series, perhaps it is more convenient to connect U2. Why?
- The current in the MCU will flow through NMOSFETs and they have better properties than PMOSFETs
- The resistance of the GND path in the MCU tends to be lower than the Vcc path
Yes, today it is perhaps just a tradition and the practical differences can be immeasurable

From the point of view of universality and safety, it is probably the most suitable
U1
benefits
-R1 limits the current by replacing it, and +5V can be used
- the transistor will limit the current through the MCU
- high current
- 3,3V and 5V
If high speed and current up to 24mA is needed I use a separate gate as U4
benefits
-high speed 3ns
3,3 and 5,0V cpmpatible
- current up to 24mA
The last question is whether it is a good idea to connect the diodes in series
For diodes operated close to the maximum current, i.e. at 20mA, it is not, but at 5mA...
v.jpg
 
For diodes operated close to the maximum current, i.e. at 20mA, it is not, but at 5mA...

How could you recommend this knowing the tolerance stackup on Vf with Vdd=3.3 +/- ?.

This only works in the lab with nominal values, unless you buy binned parts with tighter tolerances.

Do you know how to estimate the sensitivity of If vs tolerances of each part? or the yield to achieve 5 mA with 25% ? (it would be very low yield)

If IR Vf = 1.3 to 1.5 V @ 30 mA (MOC308x)
Red Vf= 2.1 to 2.6 V @ 20 mA (C503B-RCN-CW0Z0AA2 7500 mcd 30 deg.)
Vol = 0.25 to 0.5 V @ 10 mA ( uC typ.)
Vdd 3.3 V ? %

Using ideal nominal parts

C503B-RCN-CW0Z0AA2
 
ok let's look at the design from the point of view of tolerances and applicability for opto components
The first thing we need to know is in what temperature range our wiring should work. For LEDs, the lowest temperature is critical, because the forward voltage decreases with temperature at a rate of 2mV/C and the trigger current decreases with temperature.

Let's say that we will make a design for a minimum temperature of -20C and 0 C
MOC3083 nominal trigger current for 25C is worst case 5mA for 0C 1.12*5mA for -20C 1.29*5mA.
MOC3083 nominal forward voltage for 25C is 1.16V etd.
Conclusion for MOC3083
25C VF 1,16V triger current 5mA,
0C VF 1,22V triger current 5,6mA,
-20C VF 1,27V triger current 6,45mA.

For RED LED, finding the values is more complicated
25C 5,00mA 1,70V
0C 5,60mA 1,75V
-20C 6,45mA 1,79V

together MOC3083 + RED LED

25C 5.00mA 1,70V + 1,16V = 2,86V
0C 5.60mA 1,75V + 1,22V = 2,97V
-20C 6.45mA 1,79V + 1,27V = 3,06V

if we consider the supply voltage 3.3V -2% i.e. 3,23V
25C 3,23V - 2,86V = 370mV
0C 3,23V - 2,96V = 269mV
-20C 3,23V . 3,06V = 170mV

As we can see, there is a certain reserve to cover losses on the switching element and resistive losses on the PCB, cabling and connectors.
However, in the case of direct switching of the NMOSFET in the MCU GPIO, it will be quite borderline at -20C, but it would probably still work in most cases, semiconductors have a positive temperature coefficient and optotriacs really reliably switch even at 80% of the trigger current. On the other hand, MOC3083 no longer belongs to temperatures of -20C, in these extreme conditions MOC3081, maybe 82, should be used, the harsher the climate, the harsher the parts, and in Siberia from -40C, only blacksmith work belongs, see the German tankt in 42 and today in Donbass

Or am I overlooking something somewhere?
 
Hi,

Good job.

My worries:
* I miss the impact of the microcontroller port. There will be voltage drop
* one needs to consider worst case, also for tye power supply. I don't think -2% covers: initial accuracy error + noise + drift with time + drift with temperature + drift with load current ... even short negative/positive events matter

In the past I had troubles (fail in the field!) of optocouplers. They dropped their CTR to 30% of the inital CTR within a couple of years (driven with less than nominal current). I know most optocouplers are better in this regard, but surely the all will degrade with time. Even MOCxxxx.

I stand by my recommendation not to use both LEDs in series. (Not to use 3V load in a nominally 3.3V powered system)

Klaus
 
Or am I overlooking something somewhere?'

@ 25'C
If IR Vf = 1.3 to 1.5 V @ 30 mA (MOC308x)
Red Vf= 2.1 to 2.6 V @ 20 mA (
C503B-RCN-CW0Z0AA2 7500 mcd 30 deg.)

In production, you would not choose parts with voltage drops that exceed your worst-case supply voltage even at low currents. But if doing this at home, you can try.

IR LED Vf=1.5V @ 30mA , @ 1mA 20'C, Vt(IR)=1.10V (see datasheet plot)
1699639451367.png

RED LED Vf=2.6V @ 20 mA @ 25'C, Vt(RED) = 1.85
1699638173099.png

Thus what is the worst case If min with Vdd= 3.30V +/-2% and RdsOn=0 at 25'C and added series resistor = 47 ohms?
If = 486 uA avg, 354 uA min 642 uA max using Falstad's model for custom diodes with above specifications from #9
1699639275911.png


Thermal effects with -2mV/'C would be worse at cold temperatures, for which -40 'C in my hometown is normal for as few days in Feb.

Photo diodes are extremely stable in mA/mW but photo transistors and triacs are not stable in production due to the huge variance in hFE.
Anything that affects hFE will directly affect CTR which is evident in any datasheet.

Simulation for peer review

With a holding current of 400 uA typ. triggering might not occur.
I misread the datasheet early and though MOC3083 was least sensitive, but is actually the most sensitive for triggering with the lowest max current required to trigger. ( However it "may" trigger at lower currents, which I expect is load dependent, but unstated here )

1699640265338.png

--- Updated ---

Danadakk listed some nice reliability references on Opto CTR.
In addition to this; I would like to add;

Linear Opto-transistors are highly non-linear for CTR just as transistor hFE reduces to about 10% of the maximum hFE going into saturation and are usually rated for Ic/Ib=10 for hFE's < 200 and Ic/Ib=50 for hFE's > 500.

Thus keep in mind in the future when using common emitter Opto-transistors as isolated switches that the CTR applies only when Vce>=2V or as specified and not as a saturated switch. Fortunately, logic levels do not require Vce to be fully saturated.
 
Last edited:
Thank you all for the responses, I'm struggling with it somehow.
I will ask two other things
1. Interface between optotriac and triac and triac protection.
First of all, although I am primarily designing a PCB for wave-dropping control, i.e. with the MOC3083, I would like the PCB to be universal and can also be used for triac opening angle control with the MOC3053.

The picture shows connections from the datasheets of various MOC optocouplers
for 3083 with switching at 0, number 4 is enough, but for higher interference and 3050 they also recommend 1., which also has an RC filter. Fairchild recommends another C in parallel with R 330 Ohm.
If I correctly calculate the worst option, 50mA triac, the losses on the 2x180 resistors will be 450mW, in SMD, 1206 is enough, maybe better 1210 or TH 0.5W.
Film condenser 630V.

Snubbler
39 ohm resistor 2W and cpacitor 10nF X2 plus MOV 275V.
Yes my heater is a resistive load, but I want a universal PCB.
Am I doing something wrong or should I do something differently?

tr.jpg

2. For angle control id need ZCD.
Zero cross detector (only for angle control)
My solution (A slightly modified version from the Internet)
The high voltage is only on the input resistors.
2x 4pcs 1206 100k are drawn, but I don't know if I overdid it and 2x 2pcs 200k wouldn't be enough, 1206 voltage rating is 200V.
Input resistors with C2 form an input filter and with R7 a voltage divider, thanks to which all the components behind the input resistors are sufficient for a voltage up to 50V including C2.
D1 and D2 of the BAV99 is a rectifier that charges C3 (SMD ceramic)
The voltage from the capacitor then through R1, Q1 and D3 lights up the LED in the optron and generates an 750us pulse.
The ZCD consumption is about 60mW and the 750us pulse is almost symmetrical around 0, that is, the leading edge precedes 0 by a 350us (315 during simulation).

Did I miss something, am I wrong or can it be done better?

ZCD.png


Once again, thank you all for your responses and help
 

LaTeX Commands Quick-Menu:

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top