I have an input coming from a car. It goes from 0V to roughly 18V at max. I was hoping to build a simple voltage divider using about 500k and 2M (arduino seeing the voltage across the 500k which is about 3.7V at max which would be plenty for analog reading). But there is one problem. There is roughly 25V of AC riding on that DC and I don't know what frequency. All I have is a basic multimeter. What should I do? Should I block the AC or use a diode somehow or does the arduino have something built in that can help me with this?

Thanks! (:

I tried to find a schematic of the arduino UNO or MEGA (I HAVE BOTH) but it looks like this site is down?

If you have just a 1M resistor you could get away with using the internal protection diodes and directly hook it up to your source, now this is just technically and no one really like to do this, your best off with using external clipping diodes to protect from >5v and <0vThere will also be resistors involved and the values and wattage of the external diodes will vary depending on your needed frequency response

Not sure if I completely understand either of you. 1M not 1M diodes not diodes. What should I do? Are you saying limiting the current bellow 1mA will be good enough to run the source straight into the arduino using a voltage divider? And you are saying that 1M is limiting it too much? So I should use like a 5k and a 20k for the volatge divider?

Okay. My original question is answered. The core will be protected. That is good in case I screw something up. an AC waveform can ride on a DC level. If you combine 5V DC and 20V AC you will have an AC waveform with the 0V point at 5V. It basically just shifts the waveform up. Although I can't see the waveform I can measure both DC and AC current using a multimeter.

Ah missed that analog read part, you want to read that full 18v spectrum? And don't trust your meter, dc and ac voltage reading aren't perfect especially if both are present at the same time, it could be just pulsating dc not ac or a more complex waveform, you really need to oscope it to know what you are dealing with, you could be trying to solve a nonexistent problem, either way a voltage dividerlike he suggested would be fine, and if you are unsure a 5.1zener used correctly will ensure the voltage after the divider is between 0 and +5vBasically the zener cathode (+ or banded end) will go to the input, cathode to ground and you will be protectedThis would be after your voltage divider

When you write "AC protection" most people think of mains voltage (110-240V depending where you live). No, the Arduino has no protection against mains AC. It will simply emit a little cloud of magic blue smoke, possibly accompanied by a loud "pop".

You meant to ask if an AC signal (where the peak voltage is below 5.5V) on an input pin will damage it. No, no damage at all. It does not matter if it is a mixture of DC and AC. The problem is, can you get a usefull measurement?

On a digital pin, you will se the pin input change between HIGH and LOW at the frequency of the AC signal. If the signal is irregular it will switch just as irregularly, but be more often HIGH than LOW (due to how the digital input threshold is done.). On an analog pin you might expect the "DC average" over the time the port samples, but the way it does that, if the AC signal is in the tens-hundred-Khz range, you get essentialy a random value.

As others have said, if you want the DC component of your mixed signal put a capacitor in series and a resistor to ground, after your voltage divider, and you get some reasonable value for the DC part. Look up RC filters for usefull values. (The multimeter basically does this when you switch to AC measurement)

If the frequency of the AC is low enough you can measure the length of the AC periode on a digital port. If it is real slow, you can sample often and get the wave form.

I have an input coming from a car. It goes from 0V to roughly 18V at max. I was hoping to build a simple voltage divider using about 500k and 2M (arduino seeing the voltage across the 500k which is about 3.7V at max which would be plenty for analog reading). But there is one problem. There is roughly 25V of AC riding on that DC and I don't know what frequency. All I have is a basic multimeter. What should I do? Should I block the AC or use a diode somehow or does the arduino have something built in that can help me with this?

You can do exactly as you have said, but also add a capacitor between the Arduino pin and ground to filter out the AC. The value of the capacitor you need depends on the lowest frequency of the AC.

You will lose some of the accuracy of the ADC if you use such high value resistors. On the other hand, if you reduce them too much then the current may be too large for the pin protection does if the voltage exceeds its normal range. I suggest 100K and 400K, or 50K and 200K.

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Is it possible for the meter to falsely read DC when it is really AC? I found a wiring diagram online and it says the wire I am measuring is AC. Perhaps they didn't note that it was an offset AC signal or perhaps my multimeter is giving me false DC readings because the frequency is so low/high?

Also, Should I just trial and error with the capacitor sizes since I don't know the frequency of the AC signal? If so, where should I start? I'm guessing a good starting place would be a standard 60Hz.

I've got a 200k and a 47k on a breadboard right now. Am I doing a low pass filter to block everything above say 40Hz?