-1

I'm using an ATmega328P to contol 4 optoisolators via 2n3904 transistors. It works perfectly.

I want to eliminate the transistors if the Arduino can deliver the needed current to control them.

**It is a simple card SSR relay (with 4 outputs ) controlled by atmega328p.
**VCC 5V
**MOC3023 minimum current s 5mA
****Sorry! LEDs are red 3mm

Moc3023 datasheet LEDs datasheet

Four Triac controlled by atmega328p via MOC3023

artCoding
  • 3
  • 2
  • 1
    So what did you find was a safe limit for the GPIO on the ATMega328P and what is your required current in the MOC3023. What is the ATMega328P operating voltage? Please capitalise properly for clarity. Welcome to EE.SE. – Transistor May 19 '20 at 18:15
  • Please add a schematic of your system, and provide a link to the manufacturer's datasheet for the optoisolators. – Elliot Alderson May 19 '20 at 18:25
  • 5 random phase opto-triacs... what are you building, a color organ? It may make sense to do that with directly DC supplied LEDs these days, not lightbulbs. – Chris Stratton May 19 '20 at 18:31
  • Atmega 328p voltage is 5V...and required current in the MOC3023 is 5mA – artCoding May 19 '20 at 18:32
  • So what do you see when you look in the ATmega data sheet? Per pin and total. And what do you figure your total would be? – Chris Stratton May 19 '20 at 19:09
  • 1
    https://electronics.stackexchange.com/questions/67092/how-much-current-can-i-draw-from-the-arduinos-pins – Bruce Abbott May 19 '20 at 19:11
  • I see this topic about current limit of arduino PINs(MAX is 40mA by PIN)...but I want to know if someone use this by experience – artCoding May 20 '20 at 09:03
  • OK, you didn't tell us the whole story. You are also driving LEDs, not just optoisolators. Now we need the datasheet for the LEDs. You also need to tell us the maximum and minimum values for Vcc. And although the absolute maximum current from an Arduino pin must not exceed 40mA, you will not get that much current when driving your circuit. – Elliot Alderson May 20 '20 at 11:35
  • Adding three exclamation marks can not replace the datasheet for the LEDs. How much current do they need? What is their forward voltage? – Elliot Alderson May 20 '20 at 17:02

1 Answers1

0

You need to provide at least 5mA to a 47Ω resistor, the visible LED, and the emitter in the optoisolator. The maximum forward voltage for the LED and optoisolator are specified as 2.2V and 1.15V, respectively, for a total of 3.35V. At 5mA you will also have about 0.25V across the resistor, so the maximum total voltage drop is about 3.6V.

If you are using an Arduino pin to sink current by pulling low then we need to look at the \$V_{OL}\$ specification for the ATmega. If we check the specification for the part, with a 5V supply, we see that it will sink at least 10mA while pulling down the output pin to 0.9V or less. So, it looks like the Arduino can indeed drive the optoisolator and LED. Will the LED be bright enough for you? It's hard to say. The LED manufacturer recommends 16mA to 18mA.

Now, what happens if the forward voltage of the LED and optoisolator are at their minimum values...will we be trying to sink too much current? The ATmega specifies a maximum pin current of 40mA. At 40mA we get about 2V across the resistor. The minimum voltage for the LED is specified as 1.8V but there is no minimum specified for the optoisolator. Let's say it is 1V. So now our total voltage drop is 4.8V, which means that the ATmega would need to be able to pull down to 0.2V will sinking 40mA. That doesn't look possible but the published specifications don't give us all of the information we need.

The bottom line is that it might work. But, the LEDs will not be as bright as if you used the transistor. There would also be some risk of drawing large currents through the ATmega, which will cause it to be warmer and introduce more switching noise on the ground lines. The safe approach is to keep the transistors, but you can try it if you want.

Elliot Alderson
  • 31,192
  • 5
  • 29
  • 67