I have a controller that outputs a digital 24V 500mA signal, and I want the arduino to detect when the signal is on.
If the signal is DC and is 24v when the output is ON and 0v when it is OFF then a simple voltage divider that produces a signal range in the range 0v to 5v max will be detectable by the Arduino provided the Arduino GND is connected to the signal GND.
If the signal is AC things are a bit more complex. One option might be to use an opto-isolator that is connected to the AC on one side and to the Arduino on the other. Be sure to check the voltage limits of the opto-isolator. Note that a random digitalRead() of an AC signal might read when the voltage is 0, even though the power is on. You will need to take a series of readings to be sure you catch the higher values.
You could use an opto-isolator with DC also.
Is the MKS the controller that you're talking about? Or is it some form of Arduino?
Do you have the datasheet for the controller?
In principle you can connect an output of something to an Arduino input.
You will have to bring the output voltage down to a safe voltage that your Arduino can handle. Either use a voltage divider or opto isolation using an optocoupler (possibly the safer option).
Is the output an open collector output or not? If it is, you can simply use the internal pull-up resistor if the Arduino pin; this will not provide ppto isolation. Or again use an optocoupler for opto isolation.
Just in case, make sure that your 'digital signal' is indeed a DC signal. Digital in my vocabulary just means that the signal is there or not.
Transformers? A digital 24VAC 500mA signal?
Because transformer only works with changing voltage.
Otherwise if it was 24VDC you could put a diode between an Arduino input pin and the signal to block the 24V, also being sure to connect the signal ground to the Arduino ground.
Set the pin to INPUT_PULLUP in setup, that gives the pin a weak VCC (5V on Uno, 3.3V on Due) on the pin.
So now when the 24V signal is 24V the diode blocks the 24V and the pin sees the HIGH pullup voltage, totally safe.
And when the signal is 0V the pullup voltage drains out through the diode and the pin sees LOW, also safe.
You can't do this with AC signal but you can with DC signal to Arduino, protect a pin with only a diode and some code.
I did a search for MKS GEN 1.3
MKS Gen is a feature rich all-in-one electronics solution for Reprap and other CNC devices.
It features an onboard ATmega2560. Its five motor outputs are powered by Pololu pin compatible stepper drivers.
The board features a developer friendly expansion port supporting giving access the same as Ramps1.4.
MKS Gen is designed to be flexible in the user's power source availability, allowing any power supply from 12V-24V.
Is this the board that makes the signal or the one to read it?
How EXACTLY have you “adjusted” 24V to be 3V. Draw a simple circuit diagram. Details matter.
I'm not exactly clear what you mean when you say signal ground? the controller have a beckhoff module, there's literally just one wire coming out of it
I have no idea what a beckhoff module is but a single wire on its own cannot have a voltage. Voltage is the difference between two things - we generally call one of them GND.
Sorry for not clarifying, the external signal at the source of the controller is 24VDC, and I’ve adjusted it so only 3VDC is inputted to the arduino(MKS) board.
So the arduino(MKS) should be seeing 3VDC when the signal is ON, and 0VDC when signal OFF
3VDC can be connected directly to Arduino input pin. No need for a diode and the pin mode should be INPUT, not INPUT_PULLUP.
The Idea is that the signal wire that’s coming out of my controller(not the MKS board), that give voltage when signal is on, is connected to the arduino(MKS) board directly, so I don’t have to run multiple wires.
Your controller(not the MKS board) has power and ground going to it. That ground and the Arduino ground MUST be connected. And yeah, that assumes that the controller(not MKS board) is not self or magically powered.
If the grounds are not the same then the voltages won’t be right. DC voltage is only the difference between + and - with ground being the -. Two boards can have different ground each and then 0V on one board is the difference as +V to the other — 3V on the other may be 12V to the one and then poof goes the pins that should have shared ground.
You need to learn basic DC electric much better than you have, you didn’t know what ground means. Do you know Ohm’s Law or Kirchoff’s Laws at least well enough to know to look them up? First you have to know the what to look up and then know enough to think it’s worth looking up. Please say that you can learn by looking things up!