Confirmation on Frequency Counter

Discussion in 'General Electronics Chat' started by bobby19, Sep 29, 2010.

  1. bobby19

    Thread Starter Member

    Jun 3, 2007
    Hi - I've been out of the digital world for a while now and I just want to confirm my thoughts/understanding.

    I want to measure the outlet frequency:
    -I plan to use a transformer to first step down voltage and then recitify it to a square wave.

    *Here is where I want to confirm my understanding*
    An oscillator will essentially act as the reference clock
    The rectified square wave will be compared to the oscillator
    Every clock cycle, it will look for a rising edge
    If a rising edge is detected, a counter will be incremented
    When the preset sampling period is over, the number of rising edges (count) will be divided by the sampling period (seconds)
    Reset counter and loop again

    This is obviously high level, but am I right in my understanding of frequency count and oscillators?

  2. beenthere

    Retired Moderator

    Apr 20, 2004
    You're close. The internal clock is usually a stable oscillator that is used to control the period that the external signal is gated in. If the period is 1 second, then the internal counter that is clocked with each external signal will read directly in Hz.

    Your idea about a transformer is excellent - it's the only safe way to observe the line frequency. Use half wave rectification to preserve the original frequency and pass the sine wave across a pot for level control. Use a Schmitt trigger gate to convert the signal to a digital pulse train for the internal counter. The count is as good on rising as it is on falling edges.
  3. lmartinez

    Active Member

    Mar 8, 2009
    How is the original :Dsignal stepped down, rectified, and converted to a square wave?
  4. marshallf3

    Well-Known Member

    Jul 26, 2010
    Doesn't need to be a square wave so long as the level is high enough to trigger the counter.
  5. Markd77

    Senior Member

    Sep 7, 2009
    If you need high accuracy then measuring the number of cycles in a second is not the best way to do it. That would give 2% accuracy. A better way is to time how long it takes for 50 cycles (for example). It should be easy enough to get better than 0.1% accuracy with this method and a crystal oscillator.
    <ed> 2% figure is for mains at 50Hz </ed>
  6. Wendy


    Mar 24, 2008
    This would work for countries with 50Hz, not so well with 60Hz. Line frequency is a quick and dirty way for a time base, a 10 Mhz crystal is a better way. But like my signature says, good enough works.
  7. SgtWookie


    Jul 17, 2007
    In the US, there are actually small fluctuations/deviations in the 60Hz line frequency, so from second to second you may notice some difference. When deviations in frequency occur, the load on the power grid is rather high, so they try to keep the deviations as small as possible.

    Over a longer period of time, say 24 hours, the net deviation will be extremely small.

    An uncompensated crystal oscillator's frequency may vary fairly significantly depending upon temperature. If used as a time base for a clock, the errors will quickly accumulate, and at the end of a week you may find the errors accumulate to several minutes.

    One way to stabilize a crystal oscillator is to keep it's temperature constant; an oven-controlled crystal oscillator (OCXO). This can actually be done quite simply and inexpensively. Roman Black has thoughtfully posted an inexpensive and effective means for creating a crystal oven on his website:

    This will improve the stability of an xtal oscillator by several orders of magnitude.
  8. bobby19

    Thread Starter Member

    Jun 3, 2007
    Albeit late, thanks so much for the help.

    So I've ordered some components and will begin working on this soon. I've found the following project:

    One question about the schematic on page 6. What is the purpose of the 9V DC battery and two 1N5819 diodes in the lower right side, after the bridge rectifier?

    Thanks again
  9. Wendy


    Mar 24, 2008
    Battery backup, same as in most digital clocks.

    The diodes switch between the power supply with the most voltage. If AC goes down that leaves the battery.

    When you get over 10 posts you will have the ability to delete posts. Handy for the accidental double post, which happens to us all.