Can I use an Op-Amp for this?

I am taking a voltage measurement with an analog pin that might in some cases go significantly higher than 5VDC. If I buffer the signal with a single supply Op Amp at unity gain, then when the voltage goes over 5VDC the Op Amp still only puts out a maximum of 5VDC and I can then just treat 5VDC readings as out of range?

Is that how it works? Is there a better way?

Couple resistors voltage divider would solve a problem.

Very few chips can tolerate inputs more than 0.5V beyond the supply rails - including op-amps, so you haven't solved the problem, just passed it on.

Basically you need to reduce the voltage either via a resistor divider or using the right op-amp circuit (one where the input isn't directly connected to the op-amps input - the standard inverting amp circuit with fractional gain for instance). Resistor divider is the easiest option.

It's already on a voltage divider. The voltage I'm actually measuring is 500VDC. I want to scale 500V to 5V to get the resolution I want, but I expect to see voltage surges to 1KV or a little more. That would put 10V coming out of the voltage divider and fry my chip. I would like some way to just limit that to 5V since I don't really care about the measurements above 500V in the circuit.

Is there a way to protect that so it doesn't go over 5VDC when the voltage surges?

This is funny, you are third person posting almost the same question today.

Delta_G:
It's already on a voltage divider. The voltage I'm actually measuring is 500VDC. I want to scale 500V to 5V to get the resolution I want, but I expect to see voltage surges to 1KV or a little more. That would put 10V coming out of the voltage divider and fry my chip. I would like some way to just limit that to 5V since I don't really care about the measurements above 500V in the circuit.

Is there a way to protect that so it doesn't go over 5VDC when the voltage surges?

Look into overvoltage protection like TVS diodes, varistors, and/or zeners. Your problem isn't that different from static (ESD) protection.

I guess the next question is, if I use an external protection like a zener, then can I still put the op amp there so that if anything goes wrong the op amp fries instead of my atmega?

You have to consider a trade-off. Even microprocessor become more protected with each layer in front of it, there is always a price to pay:

  • complexity, cost;
  • increasing capacitance at the input and consequently worse speed of response( for protection based on passive elements );
  • worse temperature characteristic (zener and schottky diode has reverse current widely varying with T);
    OPA is good as analog front-end, but good OPA cost not much less than MCU. If you designing device with high grade safety standards, (oil, gas, mining , nuclear etc industry), it make sense to design with double- triple redundancy, installing 2 or 3 MCU, than worry much about one , that could fail anyway even it's extra protected from analog side.

Just use a voltage divider, with the resistor chosen so that even with the maximum surge voltage you expect, the current into the Arduino pin will not exceed about 1mA. The atmega mcu has built-in protection diodes that will protect the input against overvoltage provided that the current is limited to a low enough value (a few mA).

For example, use 1M ohm from the pin to the input, and 10K from the pin to ground. This gives you 500/101 = 4.95V at the analog input pin for 500V input, and at 1000v input the current into the pin is only 0.5mA.

You won't easily find a resistor with a voltage rating of 1KV, so you'll probably have to use several resistors in series.

If you're paranoid about damaging the mcu, you can add a Schottly diode with anode connected to input pin and cathode connected to +5v. This will conduct the current before the built-in protection diode kicks in.

Definitely use several resistors in series - then if one fails closed-circuit you won't blow up anything...