Harmonic value and Total Harmonic Measurement THD Using Micro-controller (Arduino)
I am working on Project of AC power Analyzer Using Micro-controller (Arduino) , in which i need to Measure RMS Voltage , RMS Current , Active power, Reactive power , Power Factor and Harmonic value of 1st to 10Th Odd Harmonic and Last THD.
at present status I am Abel to measure RMS Voltage , RMS Current , Active power, Reactive power , Power Factor.
But i dont Know How To measure Value of Harmonic Like 3rd , 5th , 7th and THD.
I am converting 120 V ac signal to 0-5 V For Arduino / ADC and Doing Sampling of Analog signal in ADC
Bellow is logic/Program for That
Average power
Code C - [expand] 1 2 3 4 5 6 for (n=0; n<number_of_sample; n++){ // inst_voltage and inst_current calculation from raw ADC goes here inst_power = inst_voltage * inst_current; sum_inst_power += inst_power; } Average_power = sum_inst_power / number_of_samples;
RMS Voltage / CUrrent
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 for (n=0; n<number_of_sample; n++){ // inst_voltage calculation from raw ADC input goes here. squared_voltage = inst_voltage * inst_voltage; sum_squared_voltage += squared_voltage; } mean_square_voltage = sum_squared_voltage / number_of_samples; root_mean_square_voltage = sqrt(mean_square_voltage); apparent_power = root_mean_square_voltage * root_mean_square_current; power_factor = real_power / apparent_power;
Now Need Help for Calculating 3rd , 5th , 7th and THD.
Please Advise me How to do that.
Thank you
Hi,
That′s the way to measure true values.
Good job!
******
what is your sampling frequency? Is it mad by a crystal oscillator?
You are measuring AC mains? What frequency?
What AC frequency range do you expect?
**
My idea:
Do some DFTs. It′s not that difficult as it sounds.
You need some lookup tables for calculated sine values...
But when AC frequency or sampling frequency is not stable, then it′s becoming more difficult.
****
Do you know there are special IC′s that help to do the calculations above? But not the overtones...
Klaus
IEC 1000-3-2 (limits for harmonic current emissions) defines conditions for harmonic measurements using DFT in appendix B.4. It assumes that the measurement window is synchronized to the mains period and an integer multiple of it.
My frequency is 60Hz and 120V signal
So Fundamental freq is 60Hz
Need to measure odd No of Harmonics 3rd at 180Hz, 5th at 300Hz ,7th at 420Hz 9th 540Hz
so maximun freq is 9*60hz = 540Hz
so According to Ni quest Criteria of Sampling Frequency , We need to take
Fs=2 * 540 Hz
Fs = 1080Hz
i am taking 2560 Hz Sampling frequency at 100ms Sample rate
Now What to do Next for Calculating Magnitude of Each Harmonic??
How to do DFT or FFT operation ??
can any one guide me
Thanks
Hi,
* In Europe and Germany DIN EN 50160 consider overtones up to the 25th harmonic...
* According nyquist 1080Hz is not enough. You need more than this.
* --> 2560 is no integer multiple of 100Hz, nor of 60Hz, you will have problems...
What about sampling clock source? And what about AC frequency range?
Klaus
I presume it's o.k. for a basic power analyzer project to restrict the analysis to e.g. 9th harmonic. Using a higher sampling rate than 1080 is however appropriate. I'm not familiar with Arduino libraries but assume a higher timer based rate should be possible.