[En-Nut-Discussion] 60Hz frequency measurment questions..

Harald Kipp harald.kipp at egnite.de
Thu Jun 8 16:23:57 CEST 2006


Hello James,

Very impressive project, btw.

I do not have much experience with signal conditioning, which
may be required here, nor do I have any ready-to-use code.

But one essential hint may be to stick with hardware. For the
AVR based (8-bit) Ethernuts you have to deal with interrupt
latencies of about 100 microseconds. This depends very much
on the interrupt routines / drivers you are using. Thus, using
interrupts for counting frequencies is a bad idea.

The on-chip timers/counters of the Atmega128 (Ethernut 1 & 2) and
the AT91R40008 (Ethernut 3) are very versatile devices and can be
perfectly configured for almost any timing requirement. On the
other hand they are quite complex and you definitely need to
read the related chapters in the data sheets more than once,
in order to select the mode that will fit best. There are several
ways to start/stop counters by external signals. Then you can
read the results from the counter registers. This way
the measurement is done by hardware and the deviation mainly
depends on the CPU crystal. Btw. the crystals on our Ethernuts
are no rocket technology (30 ppm at room temperature), but
0.1% is no real challenge for a crystal either.

Keep in mind, that timer 0 is used by Nut/OS. All remaining
timers can be freely used by your application.

Harald

At 00:37 08.06.2006 -0400, you wrote:
>Greetings All,
>
>I'm going to use my EtherNut board as a engine monitoring and control 
>system for
>my homebuilt 15KW generator project.  I think I've figured out how to monitor
>everything except the line frequency of the generator output (60hz ideally).
>
>While the generator has a mechanical governor on it, it tends to sag about 1hz
>between no-load and 60% load (10KW).  One goal for the Ethernut board is to
>operate a governor assist system to help keep the generator producing 60hz 
>power
>even under varying loads (else my UPSes all start getting upset).
>
>The problem is I need to measure the frequency fairly accurately, 
>preferably in
>the +/- 0.1% range, and be able to update the difference between real 
>frequency
>and desired frequency fairly quickly. The diesel motor is a single
>cylinder,running ideally at 1800rpm (15 power strokes per second, so I 
>only get
>to measure few cycles of output to calculate the mean frequency, in time to
>update the throttle position in time for the next power stroke)
>
>Any thoughts or suggestions?
>
>Take Care,
>James Lerch




More information about the En-Nut-Discussion mailing list