- #1
- 3,483
- 1,164
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..
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..