Intermediate to Advanced

Build a Digital Frequency Counter

A frequency counter measures how many cycles of an electrical signal occur within a specific period of time. It is one of the most important instruments for testing oscillators, function generators, radio transmitters, microcontrollers, crystal oscillators and digital circuits. This project demonstrates how to build a high-accuracy digital frequency counter using an Arduino, ESP32 or STM32 together with precision timing techniques.

Digital Frequency Counter

Project Overview

The frequency counter counts the number of pulses arriving at its input during a precisely controlled gate time.

After the gate closes, the total pulse count is converted into a frequency measurement and displayed on an LCD or OLED screen.

Longer gate times provide higher measurement accuracy, while shorter gate times provide faster display updates.

Project Difficulty

ItemValue
Difficulty⭐⭐⭐ Intermediate–Advanced
Build Time4–8 Hours
Supply Voltage5 V DC
DisplayOLED, LCD or TFT
Input Frequency1 Hz to 50 MHz (Design Dependent)

What Does a Frequency Counter Measure?

Measurement Description
Frequency Number of cycles per second (Hz).
Period Time for one complete cycle.
Pulse Width Duration of HIGH or LOW pulses (advanced designs).
Duty Cycle Percentage of time the signal remains HIGH.
Total Pulse Count Counts input pulses over time.

Main Sections

Section Function
Input Protection Protects the instrument from excessive voltage.
Signal Conditioning Shapes incoming signals into clean digital pulses.
Schmitt Trigger / Comparator Produces stable logic-level pulses.
Microcontroller Counts pulses during the gate interval.
Precision Time Base Generates an accurate gate time.
Display Shows measured values.

How the Frequency Counter Works

An unknown signal is applied to the input and converted into clean digital pulses by the signal conditioning circuit.

The microcontroller opens a timing gate for a precisely known duration, typically one second.

Every pulse arriving during this interval is counted. At the end of the gate time, the total count equals the input frequency in hertz when using a one-second gate.

More advanced counters use reciprocal measurement techniques to improve accuracy at very low frequencies.

Typical Components

QuantityComponent
1STM32, ESP32 or Arduino Nano
174HC14 Schmitt Trigger or LM393 Comparator
116 MHz or Higher Crystal Oscillator
1OLED or LCD Display
1BNC Input Connector
SeveralPrecision Resistors and Capacitors
15 V Power Supply
1Project Enclosure

Typical Frequency Ranges

Range Typical Use
1 Hz – 1 kHz Slow digital signals and sensors.
1 kHz – 1 MHz Microcontrollers and function generators.
1 MHz – 20 MHz Crystal oscillators and RF circuits.
20 MHz – 50 MHz Advanced RF measurements.

Applications

  • Crystal oscillator testing.
  • Function generator calibration.
  • Radio frequency measurements.
  • Microcontroller clock verification.
  • PWM signal analysis.
  • Digital circuit debugging.
  • Laboratory measurements.
  • Educational electronics.

Testing

  1. Verify the power supply voltage.
  2. Connect a known signal source.
  3. Select the desired gate time.
  4. Compare the displayed frequency with a calibrated source.
  5. Measure several different frequencies.
  6. Verify display stability.
  7. Check high-frequency performance.
  8. Calibrate the time base if necessary.

Troubleshooting

Problem Possible Cause
No reading No input signal or faulty comparator.
Incorrect frequency Time-base calibration error.
Display unstable Noisy input signal or insufficient signal conditioning.
Cannot measure high frequencies Input stage bandwidth too low.
Random counts Electrical interference or floating input.

Project Improvements

  • Add automatic range selection.
  • Measure duty cycle and pulse width.
  • Include reciprocal frequency measurement.
  • Add USB communication with a computer.
  • Display waveforms using a TFT screen.
  • Add GPS-disciplined time-base calibration.
  • Support Bluetooth data logging.
  • Increase the maximum frequency using a prescaler.

Skills Learned

  • Frequency measurement.
  • Precision timing.
  • Pulse counting.
  • Signal conditioning.
  • Comparator circuits.
  • Electronic instrumentation.

Safety Notes

  • Never apply voltages exceeding the instrument's input rating.
  • Use attenuators when measuring high-voltage signals.
  • Avoid measuring signals with excessive DC offset unless the input stage is designed for it.
  • Use shielded cables for high-frequency measurements.
  • Calibrate the time base periodically for maximum accuracy.

Key Points

  • A frequency counter measures the number of signal cycles occurring each second.
  • A precision time base is essential for accurate measurements.
  • Signal conditioning improves reliability and noise immunity.
  • Frequency counters are indispensable for testing oscillators, RF circuits and digital electronics.
  • Advanced models can also measure period, duty cycle and pulse width.

Next Project

Continue by building a Function Generator, capable of producing sine, square and triangle waveforms to test amplifiers, filters and digital circuits.

Next Project → Function Generator