Attenuating large voltage signal to Arduino friendly

I feel I should know how to do this but my mind is a bit cloudy...

I have a 0-24V square wave that I need to condition into a 0-5V signal for the Arduino. I didn't want to use a voltage regulator or a normal op amp to do it because I'm concerned about the 0V. Many amps and amp-based ICs can't actually hit 0V and while that may not prevent the Arduino from registering a low, I want to play things safe and get a real 0V when the input is 0 and also I don't want to chop the signal but rather attenuate it. I have a feeling I'm going to need to know how to do that anyway in case I need to similarly condition an analog signal.

An amplifier with a split supply should in theory have no problem with 0 or 5V right? Thing is, both my supply and my incoming signal are 24V high so I'd need a small arduino board (for convenience) with an amp on it that's split supply AND can cover this range AND maybe also has the onboard IC to turn a single ended supply into a double-ended one. They have those... what do you call them... split capacitor supply chips or something like that where they use some tuned circuit to turn +V into +/-V ?

Anyway this is 1 thought and probably doesn't exist in a single package but there is probably another way to do what I'm trying to do that isn't so complicated. Just wondering what the conventional wisdom is on the topic?

I would just think about using a common opto-coupler. That also gets you isolation. Roll your own or just buy an off the shelf unit module. They cost about $6.00 USD to $10 USD on Amazon for a 4 channel module. They are popular in PLC applications.

Ron

Optical isolation is the "safest" solution.

If you are sure the voltage never goes over 24V you can use a [u]voltage divider[/u] (2 resistors).

Or, since it's a square wave (digital) and you don't need to measure/sense anything between zero and 24V you can use an [u]over-voltage protection circuit[/u]. Or, you can add a "protection diode" to a voltage divider. (If you build the protection circuit, I'd recommend increasing the current limiting resistor to 1K or more.)

Well, the voltage should be stable as it's coming from a sensor via a DC supply. Oddly the resistive network seems like the best solution even though I'd stay away from that normally because of potential loading issues. But the circuit has nothing in it but a sensor and an arduino so I guess the risk is minimal. It would be nice to know a single ended supply type amplifier though which can tolerate voltages close to 0. That would offer the benefit of isolation at least.

I'm convinced that you are over-complicating it, but if you want to go that route, you can use something like an LM397 comparator. There would still be a voltage divider of some sort, but the impedance would be much higher if you are worried about loading.

Really, I would need many more details about your circuit to give a good answer. As always.

Reply #1 is a good answer.

If you want to MEASURE the voltages, you can just use a divider chain to an analog input. If you want to COUNT or TIME the pulses, then you can use an optocoupler as suggested, or more simply a suitable current limiting resistor with diodes to prevent the input going outside the supply rails.

Gahhhrrrlic:
Well, the voltage should be stable as it's coming from a sensor via a DC supply. Oddly the resistive network seems like the best solution even though I'd stay away from that normally because of potential loading issues. But the circuit has nothing in it but a sensor and an arduino so I guess the risk is minimal. It would be nice to know a single ended supply type amplifier though which can tolerate voltages close to 0. That would offer the benefit of isolation at least.

You don't need an amplifier to attenuate, unless the source is very high impedance (mega-ohms).

Furthermore an amplifier powered from 24V will not be safe to connect to an Arduino pin any more
than its input signal. On powerup/powerdown such an amp may produce transient spikes upto the
supply voltage.

Normally a voltage divider, or voltage clamp (resistor + zener) would be employed to translate a signal
from 24V to 5V.

A regulator would never be appropriate for reducing a signal voltage, and a resistor divider would not be
appropriate to reduce power voltage - signals and power are done differently.

I have a 0-24V square wave that I need to condition into a 0-5V signal for the Arduino

Signal power is 'X-DON'T CARE', which means a voltage divider should be sufficient.

If you want isolation you can use an op amp voltage follower buffer.

R1 = 100k
R2 = 26.262 k (27k parallel 1M ohm)

24V * 26000/(126000)=4.952V