Calculate Phase Difference between Voltage and Current


When capacitors or inductors are involved in an AC circuit, the current and voltage do not peak at the same time. The fraction of a period difference between the peaks expressed in degrees is said to be the phase difference. The phase difference is <= 90 degrees. It is customary to use the angle by which the voltage leads the current. This leads to a positive phase for inductive circuits since current lags the voltage in an inductive circuit. The phase is negative for a capacitive circuit since the current leads the voltage.
This application was effectively used for 50Hz or 60Hz power line. This use  Zero Cross Detector to detect the rising edge of voltage and current. The square wave represent the voltage fed to INT0 (port D pin 2) and the square wave represent the current fed to ICP1 (port D pin 6). When the first of rising edge of the first wave at INT0 occurs, timer 1 will active. This timer starts to count the period of the wave. When the rising edge of the wave at ICP1 occurs, the Input Capture Unit of microcontroller actives and saves the value of ICR1 register. And, when the next rising edge of the wave at INT0 occurs, it will stop the Timer 1. This will followed by running a special routine to measure the frequency of the voltage and the phase different between voltage and current.
This application can measure the frequency of signal (act as frequency meter), measure duration between two clock pulses (act as period meter), and measure phase difference between voltage and current. The results were saved in a specific memory location that will be described below. You can send them to LCD display or to PC while data logger. The development of this application to specific purpose application is become new really enabled and has been done.

The frequency of the signal in hexadecimal format can be read at the location referred by Frequency_voltage. This 2-byte value will represent the frequency multiplied by ten. The frequency in ASCII format can be read at the location referred by Frequency_voltage_ASCII. This 3-character represents the frequency in XX.X Hz format.
The phase difference angle between voltage and current in hexadecimal format can be read at the location referred by Phase_different_angle. The phase difference angle in ASCII format can be read at the location referred by Phase_different_angle_ASCII. This 3-character represents the frequency in degree.
In the future, from this application, we can build an AVR-microcontroller-based power factor measurement.



What’s next? You can send the data to PC like data logger....

5 comments:

  1. could you please send me code at jhon.smith87@yahoo.com , it would be appreciating

    ReplyDelete
  2. kindly send me the actual code bcz i really need it for my FYP.
    faizahmed856@yahoo.com

    ReplyDelete
  3. plz mail me assembly prg

    patelgajendra401@gmail.com

    ReplyDelete
  4. ould you please send me C code at bond777@gmail.com

    ReplyDelete