Connect +5V (from another source) to digital pin -> Alright?

Dear all,

for start I’m sorry about my English language. I need to connect 24V to Arduino (signal from digital PLC output). Im using voltage changer from 24V to 5V and this voltage I need to connect digital pin. Im will use this two versions:

  1. LED with 200 ohm from +5V and PIN to GND
  2. 10k ohm resistor with same function

Please for better understanding check pictures.

I wanna ask you if this can be a solution for my situation. I cannot use OPC server because I haven’t access to PLC software editing. I just need to get signal when button is pushed and send data to SQL. I created a model at home and it works. But don’t know about real situation at industry.

What you think about solution?
Thank you very much. Have a nice day.

versions are in attachments.

1.png

2.png

I think because of the real possibility of the PLC being powered when the Arduino is not and then possibly damaging the Arduino , I would use opto isolators for the inputs ( and maybe outputs ) to (from) the Arduino .

Sparkfun sell some little boards or you can make your own with the appropriate IC . Google us your friend here.

Potencials in voltage changer are separately. I got pure 5V on output like using opto. Just wanna know if connections to pin are alright :smiley:

Use a voltage divider. Something like 100k and 24k. Don't forget to also connect the PLC GND to the Arduino GND.

Looking at the images: not going to work as there’s no shared ground.

It’s also not a good idea to use pins 0 or 1 on an Uno (this appears to be an Uno) as that’s the serial interface.

It appears that you’re looking at a digital 24V/0V signal. Then a single diode pointing away from the Arduino will do. No risk of parasitic powering, either.
schematic.png
Left circuit: opto isolated. Completely separate circuit.
Right circuit: not isolated; shared ground. Less components, cheaper. Instead of R2 you will normally use the built-in pull-up resistor of course, just added it for illustration. You need a pull-up. The 24V output can only pull the signal low, leaving it floating when high.

wvmarle:
Looking at the images: not going to work as there's no shared ground.

At first thank you for answer :slight_smile: I forgot to shared GND. I have my Arduino about 50 meters away from machines. Every machine has different length of signal cables. So I want to use Voltage regulator 6-30V -> 5VDC.

Chip called: LM2596 just input + - wires and output + -

Thats reason why I don't wanna use voltage divider. Do you still think the opto trans is best solution and what do you think about my solution now? thank you for your time. :slight_smile:

You designed yourself an Arduino killer.

6-30V direct to the pins; 50m of wires in the mix which can act as antenna picking up all kinds of noise. An optocoupler is definitely in order here.

The LM2596 is a buck converter, needs lots of external components and careful PCB design. It's for power circuits, not signals.

Another thing: please start drawing proper schematic diagrams. Not Fritzings.

wvmarle:
6-30V direct to the pins; 50m of wires in the mix which can act as antenna picking up all kinds of noise. An optocoupler is definitely in order here.

I mean 6-30V is input to step-down charger. Ouput is 1-5V with trimr for set-up max. current. I wanna ask if its solution too (ofc with 10k GND resistor).

As I said, a buck converter is for power, not signals. A linear converter would make more sense already, much cheaper and smaller. But it's still the wrong approach.

wvmarle:
As I said, a buck converter is for power, not signals. A linear converter would make more sense already, much cheaper and smaller. But it's still the wrong approach.

Well, thank you for your time. I see it as buck is for constant power and i need 0V or 24V. Thats a reason why i need use opto-trans.

Have a nice day! +rep

Good luck with it! Hope it all works as expected.

Of note: the optocoupler requires your signal source to be able to source about 5 mA of current. The single diode solution I suggested needs the signal source to only sink about 0.5 mA of current. That’s another design requirement you have to keep in mind. If your signal (and wiring - thin signal wires have non-negligible resistance) has no problem with that 5 mA, go for the optocoupler.

Yes. I recounting all parameters like input current with 4k7 ohm resistor to opto chip and compare all parameters with PC817 datasheet (input curr, output maximum current, voltage etc.) and its a solution what i need.

Thank you once again!