Solve AC Circuit Analysis Issues with Intel Galileo Gen2

  • Thread starter Thread starter cnh1995
  • Start date Start date
  • Tags Tags
    Galileo
cnh1995
Homework Helper
Gold Member
Messages
3,489
Reaction score
1,173
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
4K
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