Program for max Value of AC voltage sensor ??

Hello everyone. I have a problem with the programming code for zmpt101b AC voltage sensor,more precisely. I need to calculate the effective voltage value and for this we need maximum value of the voltage amplitude (sin) but, do not know how to program the code for the maximum value ...sorry for bad grammar i hope you understand my prob.. :confused:

i hope you understand my prob.

It would be a lot easier to understand if you posted a link to the device you are trying to read from.

The highest value is one that is not lower than any previous value that you have read.

PaulS:
It would be a lot easier to understand if you posted a link to the device you are trying to read from.

The highest value is one that is not lower than any previous value that you have read.

Well i have this sensor http://klinikrobot.com/product/electrical-sensor/zmpt101b-ac-voltage-sensor-module
and measure voltage from the autotransformer (experiment),to accurately measure need to adjust the speed of sampling (don't know how) but i know that this speed need to be around 2kHz,and with that i need to find that max value with some if and/or probably for loops (don't know how again) :confused: code is probably not to much complicated but i am not familiar with this kind of programing

Suppose I read you a series of numbers, like 12, 55, 22, 18, 34, and 29. Could you tell which was the largest? Describe, to your teddy bear, exactly how you determined that 34 was not the largest value. The Arduino is just as dumb as your teddy bear, so you need to tell it how to determine whether a value is larger than any previous value.

Something to consider. The largest value EVER? Or, the largest value in the last 24 hours? The last second?

PaulS:
Suppose I read you a series of numbers, like 12, 55, 22, 18, 34, and 29. Could you tell which was the largest? Describe, to your teddy bear, exactly how you determined that 34 was not the largest value. The Arduino is just as dumb as your teddy bear, so you need to tell it how to determine whether a value is larger than any previous value.

Something to consider. The largest value EVER? Or, the largest value in the last 24 hours? The last second?

In one periode so this is 20ms

In one periode so this is 20ms

So, what does this mean that you need to do at the end of the 20 mS interval?

this period is 20ms and i need to find the value of maximum of amplitude this is the top of this wave and because of that i need speed of sampling around 2kHz and code for searching the maximum. Sensor giving me some values of points from this wave and if i put good speed of sampling the probability to find maximum is higher because there will be more point and one of them must be maximum. So i need to read that signal from analog input and read it fast enough to nail the top of wave.

So i need to read that signal from analog input and read it fast enough to nail the top of wave.

So, what have YOU tried?

Discuss - Develop - Design: Measuring AC Voltage Using Arduino: Maximum Voltage Method something like this