I have 6 optocoupler which all input is connected in parallel to Arduino GPIO.
But what transistor I will be using ?
I have 6 optocoupler which all input is connected in parallel to Arduino GPIO.
But what transistor I will be using ?
What current?
The first datasheet I found shows that the PC817 will work well with an input current between 0.5mA and 10mA. Pick 1mA as a good middle ground. So then you need 6mA out of the Arduino pin. (Most) Arduino pins are good for 20mA, so you're well within the capabilities of one pin, with no transistor required.
ok 1 ma, but what is the value of resistor?
LED Vf is 1.2V so (5-1.2)/.006=630 ohms. So use 510, 560 or 620 if you have one.
Ok Thanks..
Do you understand current transfer ratio? 1mA in and you'll see perhaps 500µA output maximum.
Use 20mA for the optocoupler like everyone does and you're less likely to suffer issues. You can drive
two (maybe three) optocouplers in series from 5V to reduce power consumption, the forward voltage is only 1.5V or so.
With an opto LED Vf of ~1.2volt, you can connect three LEDs in series (with one CL resistor) on a 5volt Arduino.
With two strings, you can push up to 10mA through each string directly from one Arduino pin.
If 10mA is needed depends on what you're switching with the opto transistor.
Generally speaking you design for 1:1 or 2:1, same or twice the LED current of the transistor.
See CTR (current transfer ratio) in the datasheet.
Leo..
okie, a series of optocoupler but what is the value of CL resistor ?
i will use 2 pins from arduino, each pin driving 3 optocoupler ?
i try:
(5v - (1.25 * 3)) / .020 = 62.5 ohms ?
I will repeat myself.
Do you NEED to push 20mA through the LEDs?
How much current are you switching with the opto transistor.
Leo..
I dont know how much current, I need to connect this to arduino pin output...
But what is the value of CL resistor?
mikechale:
I dont know how much current, I need to connect this to arduino pin output...
What do you mean with that. Do you want to short an output pin with the opto transistor?
mikechale:
But what is the value of CL resistor?
Between 68ohm and 10,000 ohm.
Leo..
If we consider a minimum CTR of 0.5, then you can expect at least 500µA from the opto-coupler with 1 mA to the LED. If this is located - as it of course should be - immediately adjacent to the Arduino input (let's get that straight) where it connects the input to ground and you set pinMode to INPUT_PULLUP on that pin, there will be no concern regarding stray capacitance or leakage and since the internal pull-up of approximately 47k requires only 100µA to be positively pulled down, this will work just fine.
No need to fuss about with connecting opto-couplers in series.
WattsThat:
LED Vf is 1.2V so (5-1.2)/.006=630 ohms. So use 510, 560 or 620 if you have one.
Nope! Got that confused, didn't you?
There are six resistors and if you want 1 mA each, each resistor will be 3800 Ohms (3k9). But we can actually afford 20 mA from the Arduino output, so put about 3 mA into each opto-coupler and we can use 1k2 resistors. Then even grumpy MarkT should be content and you could even use 4k7 pull-ups on the opto-coupler outputs to the downstream Arduinox.
Hang on I was pointing out that 1mA into an opto-coupler without knowing what the load was is asking for trouble. 15--20mA is the de-facto standard drive for optocouplers across the industry, go do some research.
Trying to help people avoid pitfalls is not grumpiness - correcting obviously flawed/incomplete advice is not grumpiness.
MarkT:
Trying to help people avoid pitfalls is not grumpiness - correcting obviously flawed/incomplete advice is not grumpiness.
So then. I was not being grumpy in this case!