Sonsivri

Electronics => AVR, 8051 Family and ARM Area => Topic started by: localcrack on November 03, 2015, 08:33:27 08:33



Title: Connecting Blue LED to ARM32 3V microcontroller
Post by: localcrack on November 03, 2015, 08:33:27 08:33
I want to connect one moc3021 internal led and one blue led (vf >= 3.35v ) in series + one resistor for current limiting to ARM32 3V microcontroller
The microcontroller pin is not 5V tolerant so is there any failure occur by connecting with my method.
Please check the attached schematic.


Title: Re: Connecting Blue LED to ARM32 3V microcontroller
Post by: UncleBog on November 03, 2015, 09:22:45 09:22
The combined VF of the LEDs is 1.5 + 3.35 = 4.85 V so the 75R resistor will limit IF to 0.15 / 75 = 2 mA. In order to turn on the triac the current in the optocoupler LED needs to exceed 15 mA so you need a lower value resistor. The LED forward voltages will vary a bit so having them in series and having a small voltage left to drop across the resistor makes it difficult to choose a resistor value that will reliably yield 20 mA.

To answer your question; the micro's port will not be driven over 3V3, however have you checked that it can sink 20 mA ?


Title: Re: Connecting Blue LED to ARM32 3V microcontroller
Post by: motox on November 03, 2015, 10:50:22 10:50
Connecting different leds in series doesn’t seem a good idea, because they work at different currents.
Connect individual current limiting resistors on both leds and place them in parallel. Use an external transistor (NPN or N-FET) on the negative side.


Title: Re: Connecting Blue LED to ARM32 3V microcontroller
Post by: localcrack on November 03, 2015, 11:36:42 11:36
I measured VF of MOC3021 LED is 1.07 V and blue led vf = 3.2 v so total 4.27v
by using 75R resistor it will flow approx 9.733ma and its sufficient to drive moc3021 as per it's datasheet.

Now my main concern is that if I connect all these design to 3V tolerant microcontroller pin will it damage the pin ?


Title: Re: Connecting Blue LED to ARM32 3V microcontroller
Post by: UncleBog on November 03, 2015, 12:22:36 12:22
Whilst a particular MOC3021 may turn on with IF = 10 mA the data sheet specifies IF >= 15 mA to guarantee turn on (I've checked TI and Fairchild). The Fairchild version of the data sheet makes this clear with Note 2 below the Transfer Characteristics section. If your design is a 'one off' and your MOC3021 switches on with IF = 10 mA then that should be fine, however if you build a number of similar circuits like this then it's likely that some won't work properly. Also the transfer ratio of opto-couplers reduces with age so it makes sense to add a little IF margin to allow for this.


Title: Re: Connecting Blue LED to ARM32 3V microcontroller
Post by: localcrack on November 03, 2015, 12:32:02 12:32
Ok I will change resistor value to 33R that gives approx 22 ma

and what about microcontroller pin damage issue ?


Title: Re: Connecting Blue LED to ARM32 3V microcontroller
Post by: UncleBog on November 03, 2015, 01:58:22 13:58
As I said in my first reply (#1) the micro' pin won't be driven over-voltage by the LED string but you should check that the pin can sink > 22 mA.

My point regarding variation in VF due to manufacturing spread is still valid though.

For the case where the LED VFs are both low, say 1.2 V and 3.2 V then the voltage across the resistor is 5 - (1.2 + 3.2) = 0.6 V and 33R will set IF at 18 mA, however is both VFs are high, say 1.5 V and 3.35 V then the voltage across the resistor is 0.15 V and IF is 4.5 mA.

You can make IF less dependent on VF by dropping more volts across your current limiting resistor, to do this you'd should consider putting the LEDs (each with a resistor) in parallel as motox suggested. This allows you to set each LED current separately but will increase the overall current requirement such you may need two micro' outputs (if you have spare), or one output and two transistors.


Title: Re: Connecting Blue LED to ARM32 3V microcontroller
Post by: CocaCola on November 03, 2015, 09:59:34 21:59
This allows you to set each LED current separately but will increase the overall current requirement such you may need two micro' outputs (if you have spare), or one output and two transistors.

Why two transistors?  One should suffice unless I'm missing something?


Title: Re: Connecting Blue LED to ARM32 3V microcontroller
Post by: localcrack on November 04, 2015, 05:50:03 05:50
I have simulated circuit in proteus it shows approx 4.36 Volt appear on microcontroller pin and it's higher then pin's max allowed high voltage level so it's not suitable for 3 v tolerant microcontroller pin


Title: Re: Connecting Blue LED to ARM32 3V microcontroller
Post by: UncleBog on November 04, 2015, 06:36:32 06:36
In your schematic you have the MOC3021 triac in your circuit rather than the LED.

CocaCola is right, I should have written 'or one output and a transistor'.



Title: Re: Connecting Blue LED to ARM32 3V microcontroller
Post by: localcrack on November 04, 2015, 06:45:35 06:45
Oh... Sorry...!!!

I have updated in the simulation now it produce 4.24 v at port pin that is till higher for 3V tolerant microcontroller pin


Title: Re: Connecting Blue LED to ARM32 3V microcontroller
Post by: UncleBog on November 04, 2015, 08:13:33 08:13
In your circuit IF is zero so the LED VFs will be very low, hence the 4.24 V you're seeing at the voltmeter, as soon as you draw a small current through the LEDs their VFs will rise sharply and the voltmeter reading will fall. Since your micro' pin is not 5V tolerant I've assumed that it has an internal ESD clamp diode to the 3V3 rail. If added to your circuit this diode will allow sufficient current to flow through the LEDs to increase their VFs and reach equilibrium with the clamp diode at 3V3 (due to the low current the clamp diode VF will also be small). The IF current required to do this is tiny, much less than a uA.

If your micro' pin doesn't have an ESD clamp diode then you could add an external Schottky diode clamp, or a transistor buffer as previously suggested.


Title: Re: Connecting Blue LED to ARM32 3V microcontroller
Post by: vern on November 04, 2015, 02:19:38 14:19
The ARM pin probably has an ESD clamp diode to your VCC 3V, if the output is high there will be a small current flowing through the clamp diode into your VCC.
You can figure it out pretty simple by connecting your optocoupler and your LED to the VCC 3V source with a small diode (like 1N4148).
This way you can check the current that would flow into your ARM pin in the "off" state.
Just check the database for maximum allowed input current.
You should also check if this current is low enough that your optocoupler is really tuning off.
The cleanest solution of course is a transistor with the optocoupler and the led in  parallel with a separate resistor each.


Title: Re: Connecting Blue LED to ARM32 3V microcontroller
Post by: localcrack on November 05, 2015, 10:17:34 10:17
I have simulated circuit by adding 4148 and BAT46 as diode clamp

Now it's voltage is microcontroller's pin MAX allowed voltage range.



Title: Re: Connecting Blue LED to ARM32 3V microcontroller
Post by: vern on November 05, 2015, 09:39:29 21:39
looks good, and the current is so small it won't cause any problems. It will be more though if the circuit gets warm, but I don't see any problems.


Title: Re: Connecting Blue LED to ARM32 3V microcontroller
Post by: Kombinator on November 07, 2015, 11:40:12 11:40
The optimum Res for the scheme is R = 210om. for 8mA.
How strong will light diode ....?


Title: Re: Connecting Blue LED to ARM32 3V microcontroller
Post by: vern on November 07, 2015, 04:32:43 16:32
The data sheet for the MOC3021 shows the trigger input current as typical 8mA, however the maximum is 15mA, therefore the device might not turn on depending on the necessary current.
You should buy the MOC3022 (typ. 5mA, max 10mA)  or MOC3023 (typ. 3mA, max 5mA)
The blue LED will probably be bright enough, depends on the type of diode.


Title: Re: Connecting Blue LED to ARM32 3V microcontroller
Post by: bobcat1 on November 08, 2015, 08:25:20 08:25
Why not simply drive an NPN or MOSFET transistor who will drive the BLUE led and the MOC3021 with the necessary current and voltage?


Title: Re: Connecting Blue LED to ARM32 3V microcontroller
Post by: localcrack on November 09, 2015, 09:57:46 09:57
Why not simply drive an NPN or MOSFET transistor who will drive the BLUE led and the MOC3021 with the necessary current and voltage?

I do not want to use any external transistor. It also makes circuit smallest and very less part count.