analogRead output of audrino uno

What will be the output of ADC(analogRead) if i provide a rectified AC voltage(Vmax=5volt) to analog input pin of Audrino? will it be some constant or will it be a vary'ng no with respect to changing voltage with time) ?? please help.

If you are reading a varying voltage you will get different results depending on what the voltage is at the instant that the reading is taken.

It would help if you explain what you want to achieve.

...R

thanks for the replay @robin ...actually i want to check the max. voltage level of an input ac signal at different frequencies. For separating the frequencies i am using a low pass filters and giving the output of the LPF to the audrino via a full wave rectifier. As AC volt. levels change w.r.t time ..i want to know will the AnalogRead()'s output will also change likewise.

Is the voltage going into the analog pin changing wrt time? If so, then the value from analogRead will vary wrt time.

If you rectify the AC signal, it can load a capacitor to the peak voltage of the signal, minus diode forward voltages. The voltage on the capacitor only can increase, like when the AC level increases, but will not decrease when the AC level decreases. I.e. you'll read the peak value of the AC signal (minus diode forward voltages).

Another resistor can be added, that unloads the capacitor according to the R*C time constant, so that its voltage also can decrease with decreasing AC voltage. A higher R will increase the hold time of the last peak value, a lower R will add ripple to the peak value. If you already have a voltage divider before the ADC input, this divider will already unload the cap.

For faster accommodation to decreasing levels you can discharge the cap from a digital output, then wait for the next peak value of the AC signal to load the cap again. Add a small resistor to limit the discharge current to acceptable value (peak 40mA) of the output pin, and a diode or revert the pin into high impedance (input) state after discharging.

BTW a one way rectifier is sufficient for measuring purposes, it only leaks one diode forward voltage, as opposed to two diodes in series in a bridge rectifier. All rectifiers with only diodes suffer from the diode forward voltage, which decreases the input voltage by some value - to be found out depending on the diode type (Ge/Si, Schottky...) and overall circuit. Eventually another diode of the same type can be added between the rectifier and capacitor, so that you can measure the actual forward voltage of the diodes, and add it to the measured value.

Enough theory, so far. Find out yourself, whether the measured value reflects the AC peak voltage sufficiently close for you your purposes.