# 3-30V (Sinking/Sourcing) to Arduino Input

Joined Mar 10, 2018
4,057
r=5v-(0.2v+3.6v)/20ma
r=60ohms

so I need 2.0mA through the base of the transistor
OR 200ua/30% = 666uA though the TLP290 input

Rin290 = 3 - (Vledin290) / 666 uA = (3 - 1.4) / 666 uA
=2.4K
Correct

wattage for Rin290 = (30max-1.4)x666uA
=~20mW
No. P = E^2 / R = (30 - 1.4)^2/2400 = .34W

Regards, Dana.

#### jonfarrugia

Joined Feb 19, 2010
71
My wattage is still to high! Even if I set the opto for a 2ma draw at 3v, it goes to 40ma with a 30v supply which would put the resistor to over 1 Watt!

Any other ideas? Maybe I should remove the LED and transistor altogether and just connect the optocoupler directly to the arduino input.

#### jonfarrugia

Joined Feb 19, 2010
71
danadak, there appears to be some error in the way we have been calculating the required current through the TLP290

r=5v-(0.2v+3.6v)/20ma
r=60ohms

so I need 2.0mA through the base of the transistor
OR 200ua/30% = 666uA though the TLP290 input
Should be 2mA/.3 =6.66mA

Rin290 = 3 - (Vledin290) / 6.6 mA = (3 - 1.4) / 6.6 mA
=242 ohm

No. P = E^2 / R = (30 - 1.4)^2/242 = 3.4W

This wont work!

Joined Mar 10, 2018
4,057
I concur, I was a decade off on sat base current needed for 2N3904. Thanks for
rescuing me.

For sure the wide range Vin and need to design for worst case a problem.

The better option is get a higher CTR coupler, or one binned for higher CTR.

I've been working on a circuit that would take a field digital input ranging from 3-30
Can you desfcribe this a little deeper, is it a DC signal or AC ? If latter freq ?

Regards, Dana.

Last edited:

#### jonfarrugia

Joined Feb 19, 2010
71
What opto coupler do you suggest? I need it in smd format. I'm not stuck on the tlp290. I can use anyone.

As for the input signal, it will be a pure DC signal ranging from 3 to 30v.
The plan is to have ten of these circuits on a board. 5 of them will have one side of the field input connected together. The other 5 will also have one side connected together too. This will allow the inputs to be used as either positive signal trigger by placing 0v on the common terminal and 3 to 30 v on any of the other 5 signal inputs. Or You can use negative signals by placing 3 to 30v on the common terminal and then use 0v on any of the 5 inputs.
Just trying to make a digital input board capable of a wide range of signal options.

Joined Mar 10, 2018
4,057
One solution is to build a series current source with the input
to limit the current to 6.6 mA. The power still has to be dropped,
could possibly be a TO224 package or adjustable LDO with a
small heatsink on it.

I will look at the numbers ...

Regards, Dana.

Joined Mar 10, 2018
4,057
Here is a sim that seems to work, two diodes to right the input side are your coupler
input.

Missing is the negative polarity case input, and the diode in series with each LM317 for
reverse polarity.

There are LDO parts out there that can take reverse battery, you could eliminate
the need for series diode at input to the regulators, eg. just use two regulators
in parallel, but back to back, for each polarity case. And as R to set current for
each one. At 2 mA I think you can get away TO92 type packages so very little
Pdiss involved.

The other topic is LDO stability, need for ceramic bypass cap, you will have to
experiment with this.

The 290 LED starting to turn on < 2V, you can find LDOs whose reference
V is lower to move the current curve to left or right.

Regards, Dana.

Last edited:

Joined Mar 10, 2018
4,057
One thing I did not look at. For those LDOs that take battery reversal
at input, can they also take reversal at output. I suspect no, so you will
need diodes to protect the reverse polarity regulator idled.

Regards, Dana..

#### Sensacell

Joined Jun 19, 2012
2,985
Here is another option.

Replace the current limiting resistor with a 2 - terminal current source.

#### Attachments

• 156 KB Views: 7

#### jonfarrugia

Joined Feb 19, 2010
71
Love this option!

#### jonfarrugia

Joined Feb 19, 2010
71
Thanks SensaCell! With the new configuration, I can achieve a higher input voltage if required. With 10ma through the opto-coupler and a 30% transfer I can get 3ma into the base of the transistor. So with 3ma into the base of the transistor, I can get ~30ma through the transistor. If I use a 60ohm resistor on the LED, I should be capable of getting 20ma through it.

Does this look like it will work now?

#### Attachments

• 42.9 KB Views: 8

#### Sensacell

Joined Jun 19, 2012
2,985
The current regulators don't like reverse voltage.

You could add a tiny Schottky bridge rectifier in front of the current regulator, this would also allow for a greater selection of optocouplers as it would no longer need to have back-to-back LED's to work with both polarities.

Joined Mar 10, 2018
4,057
Here is a lower cost solution than LDO. Pick JFET for worst case Idss min. LED turnon seems
to be around 2.5V.

Top curve is Vdrain JFET, next is Jfet drain current, last Jfet power.

Pick JFET to have min Idss of 2 mA, also make sure spread (max) is reasonable
so Jfet power stays low. JFET make sure it has 50V Vbr. Diodes ordinary silicon
should be fine.

Regards, Dana.

Last edited:

Joined Mar 10, 2018
4,057
If you have transients that exceed 30V use a TVS diode Jfet drain to ground.

Or move it inside bridge, eg. across field source. That would protect eveything
downstream. Use a MOV design guide to do selection.

Regards, Dana.

Last edited:

#### jonfarrugia

Joined Feb 19, 2010
71
After all these great suggestions, I'm hoping I came up with a good circuit...

#### Attachments

• 29.4 KB Views: 8

#### Sensacell

Joined Jun 19, 2012
2,985
It's going to take a lot more than 3 V to turn this thing on.

Add up all the voltage drops.

Vled in the opto 1.2V
White LED 3.2V
Bridge rect 1.2 V
The current reg needs about 1.8V to start some current flowing....

7.4 Volts.

You could make things easier on yourself if you keep the White LED current down to a few mA, 20 ma is total overkill for an indicator light.
Stick to the previous circuit, with say 1-3 mA of LED current.

#### jonfarrugia

Joined Feb 19, 2010
71
Ok I see your point. I've added the bridge back in along with the 10ma constant current device to come up with this:

#### Attachments

• 42.6 KB Views: 28

Joined Feb 20, 2016
4,116
the bridge and current diode and opto LED all in series will need a minimum input volts of around 7 V as stated earlier.
You cannot add much in series with the opto input as you want a 3V minimum working voltage. You do need to take the voltage drop of your extra bits into account.

You could try this.
The 270R needs to be a 5Watt one and the back to back 2V Zeners limit the volts to the opto LEDs to about 2.7V max, and the 47R limits the current to around 20mA max. The LED current will be about 5mA at 3V, if I got my calcs right. It is very early morning (or very late night) here so they may be off a bit

EDIT:
Try to test for the minimum current the opto needs to switche in your circuit, then double it for a safety margin. Calculate the resistors then to suit to limit the dissipation when running on 30V.
You may find a single resistor is all you need if it can be scaled to just switch on 3V input, and still be below the max 50mA LED current at 30V. Keep an eye on the dissipation.

For example, a 620R 2Watt series resistor will give around 2mA LED current at 3V, and a bit under the max 50mA at 30V. That may just do the job.

Last edited:

#### jonfarrugia

Joined Feb 19, 2010
71
I was trying to stay away from those large resistors. Since this will be reproduced on a pcb, space is limited.

#### Sensacell

Joined Jun 19, 2012
2,985
Does it have to work with an AC input?

If you can field select the input wiring for the correct polarity, then a single diode in series with the regulator would work nicely.

Then it should start to turn on 3~3.6 V