ADC problem with rectified sine wave

Discussion in 'Embedded Systems and Microcontrollers' started by shoka, Apr 19, 2009.

  1. shoka

    Thread Starter Active Member

    Mar 12, 2009
    39
    0
    hello,
    i have a problem with ADC oh PIC18f452.
    i try to measure 3 phase voltage and current ,frequency and power factor.
    my code depend on the detecting of the peak of the sine wave.
    when i detect the peak of voltage of phase 1 i start a timer and when i detect the peak of phase 2 i stop it .
    this value gives indication to frequency.
    i have a problem the the timer gives sometimes logic numbers and other times false numbers.
    i think it's noise
    how can i solve it .
     
  2. bertus

    Administrator

    Apr 5, 2008
    15,638
    2,343
    Hello,

    You can also look at the zero crossings in stead of the tops.
    For zer crossing there have been some discussions already (use searh on this forum).

    Greetings,
    Bertus
     
  3. shoka

    Thread Starter Active Member

    Mar 12, 2009
    39
    0
    i addition to the frequency, i need to measure the voltage and current so i measure the peak .
     
  4. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    What is the ratio of the sampling frequency relative to the frequency of signal being sampled? One explanation might be that you are undersampling.

    hgmjr
     
  5. shoka

    Thread Starter Active Member

    Mar 12, 2009
    39
    0
    i sample a 50 HZ signal with sampling frequency =100us
     
  6. bertus

    Administrator

    Apr 5, 2008
    15,638
    2,343
    Hello,

    If you use a zerocrossing detector and you know the frequency
    than you can calculate the delay to find the top of the signal.

    Greetings,
    Bertus
     
  7. shoka

    Thread Starter Active Member

    Mar 12, 2009
    39
    0
    i must measure the peak and the frequency.
    frequency may be changed so it must be measured and also the peak.
     
Loading...