Solve AC Circuit Analysis Issues with Intel Galileo Gen2

  • Thread starter Thread starter cnh1995
  • Start date Start date
  • Tags Tags
    Galileo
Click For Summary

Discussion Overview

The discussion revolves around challenges faced in AC circuit analysis using the Intel Galileo Gen2, specifically focusing on measuring voltage, current, frequency, power factor, and programming in embedded C with Arduino. Participants seek solutions for improving frequency measurement accuracy and handling AC waveforms effectively.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant describes a method for measuring frequency by counting the time lag between zero crossings of the voltage waveform and suggests using a lookup table for accuracy.
  • Another participant proposes waiting for multiple zero crossings to improve accuracy, suggesting that the improvement should be proportional to the number of cycles counted.
  • A different participant emphasizes the need for a higher frequency to drive the counter for better resolution but does not specify the current setup.
  • One participant critiques the timing of zero crossings as a method for determining frequency, citing noise issues and suggesting the use of a high-speed counter to capture zero crossings via interrupts.
  • Another method proposed involves creating a one-second gate to count zero crossings within that interval as an alternative frequency measurement technique.
  • Participants discuss using a comparator to toggle at zero crossings and how this could be utilized to trigger interrupts or capture timer values more efficiently than reading the ADC.
  • One participant mentions the possibility of using an ADC method to read a high-speed timer at each zero crossing and averaging the readings for improved accuracy.
  • A final suggestion includes applying a DSP method, such as running an FFT on the AC waveform sampled by the ADC.

Areas of Agreement / Disagreement

Participants express differing opinions on the best methods for measuring frequency and handling AC waveforms, with no consensus reached on a single approach. Multiple competing views remain regarding the effectiveness of various techniques and the potential for improvement.

Contextual Notes

Some participants mention limitations related to noise in zero crossing detection and the need for additional hardware for accurate measurements. There are unresolved questions about the specific implementation details and the effectiveness of proposed methods.

cnh1995
Homework Helper
Gold Member
Messages
3,489
Reaction score
1,163
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..
 
Engineering news on Phys.org
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.
 
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.
 
meBigGuy said:
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.
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?
 
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.
 
  • Like
Likes   Reactions: cnh1995

Similar threads

  • · Replies 48 ·
2
Replies
48
Views
5K
  • · Replies 7 ·
Replies
7
Views
4K
Replies
18
Views
3K
Replies
4
Views
2K
Replies
13
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 63 ·
3
Replies
63
Views
8K
  • · Replies 39 ·
2
Replies
39
Views
5K
  • · Replies 13 ·
Replies
13
Views
4K