Method for safely interfacing arduino with variable voltage input signals?

Hello,

I am working on a project that collects data from machine tools using an arduino. The issue I have run into is that the machine tools run on a number of different control voltages (5, 12, 24VDC, some even 24VAC, although I could settle for leaving the AC machines out). Is there a simple, reliable circuit that I can use to safely isolate/step these digital signal voltages down so that the arduino can read them? Speed is not an issue - I am just monitoring when relays within the machine turn on and off, not trying to pass any serial data or anything like that, but I don't want to use another set of relays to step down to the 5V because I will not have easy access to the circuitry to change out relays to match the voltage of each machine the project travels between. I have a couple ideas for (no-so-elegant) circuits that might work, but this project is going to have a fairly long life span so it needs to be done right. I feel like a level-shifter IC would be the most straight forward, but I could not find any with voltage ratings high enough on a quick web search. Does anyone with more electronics know-how than this mechanical engineer have any suggestions?

Thanks,
Scott

Actually I would think that opto-isolators would be the best component to use to interface your shop equipment digital signals to your arduino. That would solve both the voltage differences and also not have a requirement a common ground connection from the arduino to all the different equipment, which could be a formidable problem in itself in some cases.

Lefty

I would use a series resistor of about 1K feeding a bridge rectifier which feeds an opto isolator. This will work for all those inputs. When fed with 24VAC there will be periods of a few milliseconds when the voltage crosses zero and the signal isn't detected, so in the Arduino software you will have to ignore short 'off' periods.

Hi Lefty,

Opto-isolators were on my radar as a possibility, but I'm not sure of a good way to current-limit the input to protect the diode given the wide range of input voltages. I had thought about using a resistor in series with the input and a Zener diode in parallel with the isolator to regulate the voltage, but I believe that would limit me to DC only.

Thanks,
Scott

scottdrums89:
Hi Lefty,

Opto-isolators were on my radar as a possibility, but I'm not sure of a good way to current-limit the input to protect the diode given the wide range of input voltages. I had thought about using a resistor in series with the input and a Zener diode in parallel with the isolator to regulate the voltage, but I believe that would limit me to DC only.

Thanks,
Scott

No, your on the right path. It's just that every circuit you wish to monitor has to be evaluated as to the best way to interface the diode input of the opto. Without seeing each equipment's circuitry detail I can only state "where there is a will there is a way". :wink:

Lefty

For this kind of projects, you don't want to share the ground - you will never know what you may pick up from the ground.

So you should think about isolation.

Digital signals can be easily isolated via optocoupler. Analog signals are tougher. If you, however, use a V-F converter, that can be done fairly easily and it is simple for the arduino to count frequency, or you can use a F-V converter to get back the analog signal.

It also provides the option to isolate via signal transformers.

@ dhenry:, I don't know what you've been smoking But Please, Don't pass it around... That was one of the weirdest answers I've ever seen you post yet...
Yes it could probably be done that way but a plain relay is the simplest answer to all his concerns. Cheap, low tech and Very reliable.

Bob

Use an opamp that works with ac and then find the appropriate resistor to limit the current to 90% of what is spec'd for at the highest voltage + maybe 5-10% you will have to check the opamp datasheet to make sure it will still work properly at the lower currents, and remember in most situations simplest is best,

An Op-Amp VS a Relay is simpler?
How?...

Use an opamp that works with ac and then find the appropriate resistor to limit the current to 90% of what is spec'd for at the highest voltage + maybe 5-10% you will have to check the opamp datasheet to make sure it will still work properly at the lower currents, and remember in most situations simplest is best,

Since the OP stated

"I am just monitoring when relays within the machine turn on and off"

... why not just use the switched power form the "relay's" to control a relay... Perfect isolation as the relay is a set of discrete and "Floating" switch contacts. Ideal I should think.

Bob

Opto isolators are smaller and cheaper than relays, also you can use exactly the same circuit to work with all the voltage sources that the OP mentioned. See my reply #2.

There's a guy here who has a tag line about theory and practice...
This is one of those cases where there is a disconnect between theory and practice.
Yes an Opto-Isolator would work and work well... in a nice safe transient free environment.
However the transients present In the OP's situation might well be fatal to the Led's.
I built an Opto-isolated sensor board for a Center Pivot Irrigation Controller some years back
and I used P2500 series opto's (Panasonic) for the interface to the controller.
It lasted for 2 minutes before spikes from the Motors (440VAC 3 Phase @ 1 KW) destroyed all the connected
isolators. The switching transients) destroyed the LED's in all the devices connected.
The cure was to remove the opto's and replace them with ldr's and NE2 lamps.
This was the main reason for my suggestion about relay's and Yes the opto's were well protected
with Zeners and diodes for over voltage and negative going spikes as well.
Unfortunately this was one of the times I chose to ignore my employers thoughts about transients...
I made the mistake of just current and spike limiting the inputs and I had no real good idea of how hostile that environments can be.
I found out, thus my relay suggestion.

Bob

Hello all,

Sorry for not getting back to this sooner - had limited internet access while traveling for Thanksgiving.

I was staying away from relays due to the fact that I will not have access to the electronics (being used off-site) as it is being moved from machine to machine in order to change out the relay to match each machine's control voltage. I'm trying to go for a simple, fairly idiot-proof design since I'm not going to be the one making the final connections, so I would like to avoid having multiple inputs for various voltage ranges (with each connected to a corresponding relay) and leaving it in the hand of the installer to decide which is the correct one.

-Scott

Whilst I have no reason to disbelieve Docedison's tale, optoisolators should be suitable for the task in nearly all conditions, unless you have really huge transients. If you do have large transients, then it should be possible to protect the opto isolator from them, although zener diodes may be too slow for this purpose and TVS devices may be more suitable. The solution I proposed in reply #2 will work for all those voltages and is also insensitive to polarity.

Hi dc42,

I agree with you that a bridge rectifier and optoisolater are likely the best components for my situation, or, at the very least, a good place to start. The one thing I'm hanging up on a bit is how to regulate the current through and/or voltage across the LED. Would you suggest using both a zener (for regulation) and a TVS diode (for protection) in parallel with the LED? Something else?

-Scott

Opto isolators work over a wide range of input currents, so the 1K series resistor I suggested will work for the whole voltage range you are interested in. Most opto isolators have max forward current of 60mA, so 1K is good up to 60V absolute max peak voltage. If there is a danger of transients greater than this, then I suggest splitting the series resistor in two and using a 20V or 24V TVS diode at the mid point.