# Converting 0-3.3V to 0-24V /Arduino Due

Hello,
In my project I need to convert 8 digital outputs from Arduino Due (so 0 / 3.3V) to 8 digital outputs which will be usable by a PLC, so they have to be 0/24V.
I will be taking the 24VDC power from the PLC to the project so I can use it.
I wanted to do it on a 8-relay module and it is an easy solution but I have to find some other way because the project will be at the laboratory and the relays 'click' is not good there.

I want to do it in the easiest possible way.

The Due pins are pure output pins ?
Can you invert the logic so that a LOW on a Due pin is HIGH on a PLC pin ?
Can you use serial solutions, say a shift register ?
The standard PNP and NPN transistor high side switch will always work.
Opto couplers could also be a solution.

Yes the output from DUE is 0 or 3.3 V and it should be 0 or 24V for PLC.
I even order optocoupler board:

But when i counted the current it will take 120mA where 130mA is max for Due. And i have more htings connected to this output thant this 8 digitals.
What do you mean in "serial solutnions" ?

I know about trnasistors but you mean a circuit that will convert also 3.3V to 24V or will use the 24V ?

I am also looking for some simple and non problematic solution I understand the one with relays etc but transistors... I am not familiar with that

Post a link to that PLC .
Post a link to that opto coupler board (retailer page), however, it does not look ideal and you don't need transitors on it.
Probably the simplest one chip solution is the MIC2981 https://www.mouser.ch/datasheet/2/268/mic2981-1891019.pdf
Forget the serial solutions. Forget inverting the logic. These require some 'expert' knowledge.
Two 4 channel opto couplers ( also need 8 current limiting resistors) would be a simple solution.
The NPN/PNP high side switch would need 16 transistors and 32 resistors.

When I calculate the current I get 9mA per pin, so 36mA total for four opto couplers (when active).
Note the four 220 ohm resistors (221) on the left.
Leo..

PLC is:
http://www.ia.omron.com/products/family/3111/lineup.html
Optocoupler is:

@Wawa
Well I hope that I calculated it wrong then
But now I calculate it again per one pin :
Current = Voltage / Resistance = 3.3V/220Ohm = 0,015A = 15mA
So how do you calculate it that it takes 9mA ?

Unfortunately, there is not schematic for that board. The "datasheet" is for the basic opto coupler module itself (TLP281-4). I can't really say if it is suitable. However, don't let that stop you trying it to see.

I guess he current calculation also respected the LED forward voltage of, according to the datasheet, 1.15 volts. You subtract that from the 3.3 volts for the calculation.

That is "datasheet"

Okay so if it takes 9ma so 72mA.
I am not sure how to measure if it will fit my project or not,
I have 8 leds, matrix keyboard 4x4, ethernet module and DAC module and LCD...

That design will invert the logic. A HIGH from a Due pin will give a LOW on the PLC pin.

I could not work out how much current the PLC pins take, but I imagine this will be less than one hundred micro amps.

Can you show your entire schematic with all the components you have listed then a solution may become clearer.

That is my circuit, with some errors like

1. missing 100Ohm Resistors for Diodes
2. Op Amp is "simplified" because I did not make it yet.
I already think that using relays or TLP281-4 I should better use some other source of power than from Arduino then this source will "take" most of the Amps while Arduino is safe. But in that case I should connect the GND of Arduino and another source ?
schemat1.pdf (154.5 KB)

And also i want to ask if it is a safe option if I
Supply the STEP down converter with 24V and it gives 12V at the output to Power the Arduino Due.
Can I also take the 12V and connect it to the 5V stabilizator to power up the relay module ?

Because if the 1 relay need something like 80mA I guess so if I power the coil from different supply it will take just minimum amount like 2-5mA per relay just to send the "activation": signal ? Tell me if I am wrong or not

I understand now that the optocoupler makes inverted logic but I guess just a "NOT" gate will to the job. But at this point I am starting to think that the relay module powered not from Arduino will take less Amps than the optocoupler mode which must use the Arduino power.

Okay I have another idea, maybe I should use this module TD62783 pdf, TD62783 description, TD62783 datasheets, TD62783 view ::: ALLDATASHEET :::
TD62783 high power driver.

If i put I1-I8 - Inputs from arduino digital outputs
VCC - 24V
GND - GND (connected to the arduino GND )
Will that be enough or it requires some extra resistors etc?
In that circuit will it work like :
IN1 is HIGH (3,3V) so OUT1 is high (24V) ?

It doesn't look like it would invert.  Due puts out high, opto LED conducts, opto XSTR conducts shutting off Qn, PLC sees high at collector of Qn.

No?

Indeed. You are correct. I didn't study it carefully enough. It is a non-inverting circuit. The NPN transistors are conducting by default and forced off to give a logic HIGH.

Source side drivers are ideal for this application. The only problem is these are difficult to get hold of. The one I quoted in post #4 , the MIC2981, is available from Mouser. The TD62783 which you mentioned appears more difficult to get hold of.
I made an error when I described that Opto Coupler board as inverting. It is not.

Instead of the 24 to 12 volt buck converter, I would use a 24 to 5 volt converter. Power all the 5 volt peripherals (Relays, LCD etc.) directly from that. But where does the 24 volts come from ? If that is a boost converter 5 to 24 volts, maybe you could derive your 5 volts there instead.

24V is coming from the PLC so probably from the PLC power supply.
What do you mean that it will be difficult to hold on ?
But okay it doesn't matter for me I can buy the one you suggest.
But is it that easy that in that case:

IN1-IN8 signals from digital outputs from Due 0/3,3V
Vs= 24V
GND = GND (connected to the arduino GND ? )
Then OUT1=OUT8:
OUT1 will be high (24V) when IN1 is high 3,3V ?
No need for extra resistors/capacitors and no problem with high current?

Difficult to get hold of. Meaning: difficult to obtain from a regular supplier. The `MIC2981`, even in DIP format (easier for a prototype board), is still available at Mouser.com. If you see a better one or one which is easier to obtain where you are, then use that instead.

The mic2981 uses positive logic. 3.3 volts (or a bit less) on an input pin gives the high voltage (in your case 24 volts) on the corresponding output pin. It does not need any additional resistors. However, on the output, I might consider using 100k pull down resistors as a precaution against leakage.

So the connection I wrote in the previous post #15 is correct ?

Yes. The pin connections look correct according to the data sheet.

Sebastian, to był mój błąd. Should be (3300-1150) / 220 = 9.8mA. 1.15 V is the voltage drop across the optocoupler LED.

The IR LED inside an opto coupler could drop 1.1 to 1.4volt, depending on forward current.
I used 1.3volt. That leaves about 2volt across the resistor.
(3.3-1.3)/220= 9mA.
Could be 8 or 10, but that doesn't matter.
Leo..