Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Intel Galileo gen2

  1. Aug 23, 2015 #1

    cnh1995

    User Avatar
    Homework Helper

    I am doing a little project with Galileo gen2 about ac circuit analysis in terms of voltage, current, frequency, power and pf. I am using arduino for programming,which is in embedded C. I am facing some problems. Please help me out..
    1. While writing program for frequency, I counted the time lag between two successive zero crossings of the voltage waveform in terms of a counter (an integer variable) and made a lookup table. For 50Hz (standard Indian frequency), the counter value was 33. I'm getting fairly accurate measured frequency for sine,square and ramp waves(like when I give 65 Hz signal, I get 64.79 Hz through program). But is there any better logic to increase the counter value for more accurate result? How can I use on-board timers for this? I'm curious about the millis() function but don't know how to use it in this case.
    2. The ac waveform is fed to A0 pin and GND, but only one cycle is read when A0 is +ve w.r.t GND. So, I shifted the dc level using a dc source in the signal's way to A0 and it totally worked. But is there any electronic way to do it? Any ICs?

    Eagerly waiting for replies...Thanks in advance..
     
  2. jcsd
  3. Aug 23, 2015 #2

    anorlunda

    User Avatar
    Science Advisor
    Gold Member

    You could wait for multiple zero crossings, say 60 crossings, then divide by elapsed time. Improvement in accuracy should be proportional to the number of cycles.
     
  4. Aug 23, 2015 #3

    meBigGuy

    User Avatar
    Gold Member

    To get better resolution you need a higher frequency to drive your counter. I don't know what you are using to drive your counter.
     
  5. Aug 23, 2015 #4

    cnh1995

    User Avatar
    Homework Helper

    I have simply used a do-while loop after zero crossing is detected. In that loop, I read the voltage at A0 pin and increment the counter, until voltage again becomes 0. For 50Hz, this counter value is 33. How should I get a high frequency counter?
     
  6. Aug 24, 2015 #5

    meBigGuy

    User Avatar
    Gold Member

    Timing zero crossings is a terrible way to determine frequency. (noise prone, etc)

    But, saving that for later,

    1. The standard way to actually time zero crossings is to have a high speed counter whose value is captured by a zero crossing. The processor is interrupted and the value saved or processed. That requires zero crossing hardware.

    2. Another common method to measure frequency is to create a 1 second gate and count the zero crossings in that 1 second interval.

    The arduino has a comparator. You can apply a reference to each side of the comparator (through separate resistors), and capacitively couple the AC to one side. The comparator output will toggle at each zero crossing. That can be used to trigger an interrupt, or possibly capture or increment an internal timer. Much faster than reading the ADC.

    3. You can use your ADC method to read a high speed timer at each zero crossing and average your counter readings. That will allow for values that are less than a loop length.

    4. The DSP method would be to run an FFT on the ac waveform as sampled by the ADC.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Intel Galileo gen2
  1. Intel Galileo & IOT (Replies: 6)

Loading...