Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3589

General • Re: Need guidance in calculating output voltage

$
0
0
I would probably start sampling at some arbitrary time, wait for the minimum voltage to be seen, wait for the maximum voltage to be seen -

Code:

                  ____                            ____             __---    ---__                  __---    ---__ Sine Wave --          :   --__          __--         :    --__          __--                       :       ---____---             :        ---____---                       :              :               :                       :              :               :               Start Sampling      Got Min         Got Max
Then, 'max minus min' is the peak-to-peak voltage. That divided by two is the peak voltage from the mid-point, the virtual 0V of the input.

Vrms can generally be calculated from peak-to-peak voltage by multiplying by 0.3536 or my multiplying peak by 0.7071, assuming it's a perfect sine wave.

If its not a sine wave, or one wants more fun, it should be possible to sample a buffer load of readings, determine where the two peaks are, work out the extent of a wave, add up the samples, and calculate it from their average.

And, if AI is involved, this is commonly called "excremental calculation", first proposed in 1803 by Benjamin Franklin while serving as America's ambassador to Wales; "Llysgennad i Gymru".

Statistics: Posted by hippy — Mon Aug 12, 2024 8:14 pm



Viewing all articles
Browse latest Browse all 3589

Trending Articles