-1

Is it possible to sense AC Voltage using analog input for Arduino Uno or can it only read DC?

I mean I've tried connecting an AC voltage source to analog and I'm reading some numbers. However, I don't know if these numbers are actually AC voltage values or something else.

Ultimately I’m trying to find the avg voltage value for a given time duration. I know that analogRead ( ) gives ADC values. However, in my block of code, I have the conversion ratio of 1023/5 to get a good estimate of the voltage. However, I’m not too sure if Arduino analog sensing is suited for AC voltage? I’m using it to sense voltages generated by piezoelectric PVDF film and the frequency is pretty high. All I want is to use avg. voltage value to calculate electrical energy produced by the PVDF film.

  • the Arduino can read voltage at its analog input pin ... it takes time to convert the voltage to a numetic value ... if the voltage changes by a large amount during the conversion, then the result will not be accurate ... it can also change do quickly, that the change will not be detected – jsotola Jun 26 at 0:35
  • 1
    what is the frequency of the signal that you are trying to digitize? – jsotola Jun 26 at 0:38
  • Do you want a RMS value or to record the values of the waveform (eg. peak)? – sa_leinad Jun 26 at 5:09
  • 1
    @jsotola: Re “if the voltage changes by a large amount during the conversion, then the result will not be accurate”: That's not quite true. The ADC uses a sample-and-hold front-end which is actually pretty fast. Once sampled, the input voltage can change without disturbing the ongoing conversion. You get an accurate reading of the input voltage at the time of sampling. Obviously, a rapidly changing signal rises the issues of Nyquist frequency and aliasing, but these are completely unrelated to conversion accuracy. – Edgar Bonet Jun 26 at 7:38
  • You have to be a lot more specif if you want any kind of useful answer. What do you mean by the frequency being “pretty high”? What are the typical amplitude and DC offset? Re “I’m trying to find the avg voltage”: the easiest way to get the average voltage is to put a low-pass filter in front of the ADC. – Edgar Bonet Jun 27 at 9:44
-1

The AC voltage that you are trying to measure is about 50/60Hz depending on where you live. And the maximum effective sampling rate for a regular Arduino ADC is 9615Hz. This means you're not going to experience any aliasing as the sampling rate is well above the 2 * Signal Frequency.

The values that are coming out of analogRead() are raw ADC values which you need to do, further calculation on if you want to have a correct voltage reading.

  • 1
    You have to set the ADC to auto-trigger if you want 9,615 Hz sampling rate. With analogRead() you get at most 8,929 Hz (112 µs/sample). – Edgar Bonet Jun 26 at 11:14
  • Ultimately I’m trying to find the avg voltage value for a given time duration. I know that analogRead ( ) gives ADC values. However, in my block of code, I have the conversion ratio of 1023/5 to get a good estimate of the voltage. However, I’m not too sure if Arduino analog sensing is suited for AC voltage? I’m using it to sense voltages generated by piezoelectric PVDF film and the frequency is pretty high. All I want is to use avg. voltage value to calculate electrical energy produced by the PVDF film. – ARJ Jun 27 at 5:47
  • so it is not mains AC with 50 Hz as the answer assumes – Juraj Jun 27 at 9:22
  • that is correct – ARJ Jun 27 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.