Community project

74HC Hardware Frequency Counter

ESP32
Photo of 74HC Hardware Frequency Counter
Generated with AI

Zeyad Mohamed

Last updated October 22, 2026

This project builds a hardware frequency counter using classic 74HC logic ICs and an ESP32, capable of measuring signal frequencies up to several megahertz. The counter uses a 32.768 kHz crystal oscillator as a stable time base, decade counter ICs to tally input pulses, and a 7-segment LED display to show the results in real time.

The guide provides a complete wiring diagram, full parts list, and step-by-step assembly instructions across three breadboards. Builders will learn how to chain logic ICs together for frequency measurement, implement a crystal-based timing reference, and drive a 7-segment display with BCD decoder logic. The modular assembly approach allows testing each section independently before integration.

Wiring diagram

Wiring diagram for 74HC Hardware Frequency Counter

Gather all the parts

QtyComponent
1

BNC input connector

The panel connector that brings a clean 0–5 V square-wave test signal into the counter.

1

74HC14 Schmitt-trigger inverter

Six noise-tolerant logic inverters that clean up the incoming square-wave signal and make its edges sharp.

1

1 kΩ input series resistor

1 kΩ

A resistor that limits fault current into the input protection diodes of the logic chip.

1

74HC08 quad AND gate

Four logic gates that pass input pulses only while the one-second measurement window is open.

2

74HC390 dual decade counter IC

A dual BCD decade-counter chip; use two chips to make the four decimal digits of the counter.

4

74HC4511 BCD-to-7-segment latch/decoder/driver

Four chips that copy each decimal count and light the matching segments on common-cathode number displays.

4

single-digit common-cathode 7-segment LED display

Four red number displays that show the held frequency count.

28

1 kΩ LED segment resistor

1 kΩ

A current-limiting resistor that protects each LED segment and keeps the display-driver load safe.

1

74HC4060 crystal time-base counter

A crystal-controlled oscillator and divider that makes the accurate one-second measuring window.

1

32.768 kHz watch crystal

32.768 kHz

The small timing crystal that makes the measurement window accurate.

1

74HC123 dual retriggerable monostable

Two one-shot timing circuits that latch the finished count and then clear the counters before the next measurement.

1

74HC123 timing resistor and capacitor set

2 × 10 kΩ + 2 × 1 nF

The resistor and capacitor pairs that set the latch and reset pulse lengths.

1

regulated 5 V DC supply

5 V, 500 mA minimum

A regulated supply that powers the logic, LED displays, and RF prescaler from a stable 5 V output.

18

100 nF ceramic decoupling capacitor

100 nF

A small capacitor placed beside each IC to keep its 5 V supply clean when signals switch.

1

74HC74 dual D flip-flop

Two flip-flops wired as toggles to divide the crystal time-base into a one-second-high, one-second-low gate signal.

1

50 Ω SMA RF input connector

A panel-mount 50 ohm coax connector that brings the high-frequency test signal into the RF prescaler.

1

uPB1506GV 3 GHz ÷256 RF prescaler

A microwave divider that turns a 500 MHz to 3 GHz RF signal into a slower signal the 74HC counter can count.

1

two-position low/RF range selector switch

A small SPDT switch that selects either the low-frequency BNC input or the divided RF output before the 74HC logic.

2

74HC390 dual decade counter IC

Two more dual decade counter chips that add four decimal places for the divided RF count.

4

74HC4511 BCD-to-7-segment latch/decoder/driver

Four more BCD display drivers that show the four high-order RF count digits.

4

single-digit common-cathode 7-segment LED display

Four more common-cathode LED digits that show the high-order count digits.

28

1 kΩ LED segment resistor

1 kΩ

A current-limiting resistor that protects each LED segment and keeps the display-driver load safe.

1

1000 pF C0G RF coupling capacitor

1000 pF, C0G/NP0

A stable high-frequency capacitor that AC-couples the SMA signal into the RF prescaler.

4

1000 pF C0G RF bypass capacitor

1000 pF, C0G/NP0

Small capacitors that hold the RF prescaler supply, input-bypass, and division-select pins at RF ground.

Assemble it in 9 steps

1. Arrange the three breadboards

Use three full-size solderless breadboards, each with long red and blue power rails. Put them left to right on a flat base: breadboard 1 is TIMING + INPUT, breadboard 2 is COUNTING, and breadboard 3 is DISPLAY. Leave a 2–3 cm gap between boards so the colored jumper wires remain visible. Put printed labels above them: INPUT/TIME, COUNTERS, and DISPLAY.

  • A wide, side-by-side layout is easier to trace than stacking boards behind each other.
  • Make every IC notch face upward so pin 1 is always in the same corner.
  • Do not build the GHz RF circuit on any of these breadboards; it needs its own small ground-plane PCB.

2. Join power rails first

With the 5 V supply turned off, run one red wire from breadboard 1 positive rail to breadboard 2 positive rail and another red wire from breadboard 2 to breadboard 3. Run matching black ground wires between all three ground rails. Connect supply_5v positive to the red rail on breadboard 1 (power) and supply_5v negative to the blue or black rail on breadboard 1 (ground).

  • Use thicker red and black wires for the power links than for signal wires.
  • Keep power links along the rear edge of the boards so they do not cover the logic wiring.
  • Make sure 5 V and ground are not swapped — reversed power can damage every logic IC.

3. Build the timing and input board

On breadboard 1, place hc4060_timebase and watch_crystal at the upper left, hc74_gate_divider beside it, and hc123_control at the upper right. Place the low-range input parts input_bnc, input_resistor, hc14_input, hc08_gate, and rf_range_switch along the lower half. Keep the crystal beside hc4060_timebase with very short leads. Wire the crystal network, one-second gate, latch pulse, and reset pulse on this board. Connect input_bnc center to rf_range_switch LOW_IN (signal), input_bnc shell to GND (ground), and connect rf_range_switch OUT through input_resistor to hc14_input 1A (signal).

  • Use yellow wires for the one-second gate, white wires for latch, and orange wires for reset; use the same colors on every board.
  • Leave a clear row along the bottom as a labeled connection strip to breadboard 2.
  • Do not connect a sine wave, negative voltage, mains, or RF source to the low-range BNC input — it is only for clean 0–5 V square waves.

4. Build the counter board

On breadboard 2, place the two hc390_counters on the left for digits 0–3 and the two hc390_high_counters on the right for digits 4–7. Arrange them in a straight row from the least-significant digit at the left to the highest digit at the right. Bring the gated clock from hc08_gate 1Y on breadboard 1 to hc390_counters DIG0_CLK (count). Cascade each decade to the next, then bring RESET_PULSE from breadboard 1 to every counter reset input (clear). Run each group of four BCD output wires toward the front edge and label them D0 through D7.

  • Use four matching colored wires for each BCD group: A, B, C, and D. Keeping that color order identical avoids crossed display digits.
  • Use a small paper label below each group: 1 Hz, 10 Hz, 100 Hz, 1 kHz, 10 kHz, 100 kHz, 1 MHz, 10 MHz.
  • A carry wire connected to the wrong counter stage gives a believable but incorrect reading, so test one digit at a time before continuing.

5. Build the display board

On breadboard 3, put the eight single-digit displays across the top in one clear row, with digit 7 at the far left and digit 0 at the far right so the number reads normally. Put four hc4511_displaydrivers below the right-hand four displays and four hc4511_high_displaydrivers below the left-hand four displays. Connect each BCD group from breadboard 2 to its matching 74HC4511 inputs (display number). Bring LATCH_PULSE from breadboard 1 to every 74HC4511 latch input (freeze the result).

  • Keep all eight displays facing the same direction and label the far-left side “10 MHz” and far-right side “1 Hz”.
  • Run the BCD bundles across the lower front edge of the boards, not over the displays, so the digits remain easy to see.
  • Use common-cathode displays only; common-anode displays will not work with the 74HC4511 wiring.

6. Add one resistor to every LED segment

For every display digit, connect each 74HC4511 segment output through one separate 1 kΩ resistor to the matching display segment anode (light). Connect every display common cathode to the ground rail (ground). Place the 56 resistors in eight neat groups of seven directly below their matching display, not in one tangled bank.

  • Seven vertical resistor groups make it easy to spot a missing segment connection.
  • Mark the segment order a, b, c, d, e, f, g on masking tape before plugging resistors in.
  • Do not connect a 74HC4511 output straight to a display segment — the missing resistor can damage the LED or driver output.

7. Add the small supply capacitors

Fit one decoupling_caps 100 nF capacitor beside every logic IC: one leg to that chip’s 5 V pin (power) and one leg to its ground pin (ground). Keep each capacitor close to the IC, rather than putting them only at the end of a power rail.

  • Use 18 capacitors: one for each logic IC and one for the separate RF prescaler PCB.
  • A capacitor’s placement matters more than making its jumper leads tidy; keep its legs short.
  • Do not power the circuit above 5.5 V — higher voltage can damage 74HC logic.

8. Keep the 3 GHz input on its own PCB

Build rf_sma_input, rf_coupling_cap, upb1506_prescaler, and rf_bypass_caps on a compact two-layer PCB with a solid ground plane. Connect its OUT pin to rf_range_switch RF_IN on breadboard 1 using one short signal wire alongside a ground wire (signal and ground). Connect the PCB 5 V and ground to the rails at breadboard 1, where the supply enters.

  • Mount the RF PCB at the left side of the three-board assembly so its short output lead reaches the range switch without crossing the display wiring.
  • Mark the switch positions clearly: LOW for BNC digital input and RF for SMA prescaler input.
  • Breadboard contacts and jumper wires do not work at 3 GHz; using them for the SMA-to-prescaler path will make the RF range inaccurate or unusable.
  • Never connect a transmitter output directly to the SMA input; use a suitable fixed RF attenuator.

9. Test one section at a time

Turn on the regulated 5 V supply and first check that the timing board creates its repeating gate, latch, and reset signals. Next apply a known 1 kHz, 0–5 V square wave to input_bnc with the selector on LOW and verify that the display freezes near 00001000. Only after the low range works, select RF and connect a low-power 50-ohm RF generator to rf_sma_input. Multiply the displayed RF count by 256 Hz.

  • Build from left to right: timing/input first, then counters, then display. This makes faults easier to find.
  • At 1 GHz, the divided output is 3,906,250 Hz, so the display should read 03906250 before multiplying by 256.
  • Keep the RF input below the prescaler’s permitted level; a strong RF source can damage the prescaler.

Review all connections

1. Connections between "supply_5v" and "ESP32"

Functionsupply_5vESP32
power5V → regulated logic supply5V
groundGND → common returnGND

2. Connections between "input_bnc" and "ESP32"

Functioninput_bncESP32
groundGND → BNC shell returnGND
dataSIG → two-position low/RF range selector switch LOW_INEXT

3. Connections between "input_resistor" and "ESP32"

Functioninput_resistorESP32
dataOUT → 74HC14 Schmitt-trigger inverter 1AEXT

4. Connections between "hc14_input" and "ESP32"

Functionhc14_inputESP32
digital1Y → 74HC14 Schmitt-trigger inverter 2AEXT
digital2Y → 74HC08 quad AND gate 1AEXT
powerVCC → logic power5V
groundGND → logic groundGND

5. Connections between "hc08_gate" and "ESP32"

Functionhc08_gateESP32
digital1Y → 74HC390 dual decade counter IC DIG0_CLKEXT
powerVCC → logic power5V
groundGND → logic groundGND

6. Connections between "hc4060_timebase" and "ESP32"

Functionhc4060_timebaseESP32
digitalOSC → 32.768 kHz watch crystal X1EXT
digitalONE_HZ → 74HC74 dual D flip-flop CLKEXT
powerVCC → logic power5V
groundGND → logic groundGND

7. Connections between "watch_crystal" and "ESP32"

Functionwatch_crystalESP32
dataX2 → 74HC4060 crystal time-base counter OSCEXT

8. Connections between "hc74_gate_divider" and "ESP32"

Functionhc74_gate_dividerESP32
digitalGATE → 74HC08 quad AND gate 1BEXT
digitalGATE → 74HC123 dual retriggerable monostable TRIGGEREXT
powerVCC → logic power5V
groundGND → logic groundGND

9. Connections between "hc123_control" and "ESP32"

Functionhc123_controlESP32
powerVCC → logic power5V
groundGND → logic groundGND
digitalRESET_PULSE → 74HC390 dual decade counter IC RESETEXT
digitalLATCH_PULSE → 74HC4511 BCD-to-7-segment latch/decoder/driver LATCHEXT

10. Connections between "hc390_counters" and "ESP32"

Functionhc390_countersESP32
digitalDIG0_BCD → 74HC390 dual decade counter IC DIG1_CLKEXT
digitalDIG1_BCD → 74HC390 dual decade counter IC DIG2_CLKEXT
digitalDIG2_BCD → 74HC390 dual decade counter IC DIG3_CLKEXT
digitalDIG0_BCD → 74HC4511 BCD-to-7-segment latch/decoder/driver DIG0_BCDEXT
digitalDIG1_BCD → 74HC4511 BCD-to-7-segment latch/decoder/driver DIG1_BCDEXT
digitalDIG2_BCD → 74HC4511 BCD-to-7-segment latch/decoder/driver DIG2_BCDEXT
powerVCC → logic power5V
groundGND → logic groundGND
digitalDIG3_BCD → 74HC390 dual decade counter IC DIG4_CLKEXT
digitalRESET → 74HC123 dual retriggerable monostable RESET_PULSEEXT

11. Connections between "hc4511_displaydrivers" and "ESP32"

Functionhc4511_displaydriversESP32
digitalDIG0_SEGMENTS → 1 kΩ LED segment resistor INEXT
digitalDIG1_SEGMENTS → 1 kΩ LED segment resistor INEXT
digitalDIG2_SEGMENTS → 1 kΩ LED segment resistor INEXT
digitalDIG3_SEGMENTS → 1 kΩ LED segment resistor INEXT
powerVCC → logic power5V
groundGND → logic groundGND
digitalLATCH → 74HC123 dual retriggerable monostable LATCH_PULSEEXT
digitalDIG3_BCD → 74HC390 dual decade counter IC DIG3_BCDEXT

12. Connections between "segment_resistors" and "ESP32"

Functionsegment_resistorsESP32
dataOUT → single-digit common-cathode 7-segment LED display SEGMENTSEXT

13. Connections between "digit_displays" and "ESP32"

Functiondigit_displaysESP32
groundCOM → common cathode returnGND

14. Connections between "decoupling_caps" and "ESP32"

Functiondecoupling_capsESP32
powerVCC → place one at each logic IC supply pins5V
groundGND → place one at each logic IC supply pinsGND

15. Connections between "rf_range_switch" and "ESP32"

Functionrf_range_switchESP32
dataOUT → 1 kΩ input series resistor INEXT

16. Connections between "rf_sma_input" and "ESP32"

Functionrf_sma_inputESP32
dataSIG → 1000 pF C0G RF coupling capacitor INEXT
groundGND → RF connector shellGND

17. Connections between "rf_coupling_cap" and "ESP32"

Functionrf_coupling_capESP32
dataOUT → uPB1506GV 3 GHz ÷256 RF prescaler RFINEXT

18. Connections between "upb1506_prescaler" and "ESP32"

Functionupb1506_prescalerESP32
powerVCC → clean 5 V supply5V
groundGND → RF ground planeGND
groundRFIN_BYPASS → RF input bypass pointGND
digitalOUT → two-position low/RF range selector switch RF_INEXT
groundSW1 → low selects divide-by-256GND
groundSW2 → low selects divide-by-256GND

19. Connections between "rf_bypass_caps" and "ESP32"

Functionrf_bypass_capsESP32
powerVCC → prescaler local supply bypass capacitor5V
groundGND → prescaler local RF bypass capacitorsGND

20. Connections between "hc4511_high_displaydrivers" and "ESP32"

Functionhc4511_high_displaydriversESP32
digitalDIG4_SEGMENTS → 1 kΩ LED segment resistor INEXT
digitalDIG5_SEGMENTS → 1 kΩ LED segment resistor INEXT
digitalDIG6_SEGMENTS → 1 kΩ LED segment resistor INEXT
digitalDIG7_SEGMENTS → 1 kΩ LED segment resistor INEXT
powerVCC → logic power5V
groundGND → logic groundGND
digitalDIG4_BCD → 74HC390 dual decade counter IC DIG4_BCDEXT
digitalDIG5_BCD → 74HC390 dual decade counter IC DIG5_BCDEXT
digitalDIG6_BCD → 74HC390 dual decade counter IC DIG6_BCDEXT
digitalDIG7_BCD → 74HC390 dual decade counter IC DIG7_BCDEXT

21. Connections between "high_segment_resistors" and "ESP32"

Functionhigh_segment_resistorsESP32
dataOUT → single-digit common-cathode 7-segment LED display SEGMENTSEXT

22. Connections between "high_digit_displays" and "ESP32"

Functionhigh_digit_displaysESP32
groundCOM → common cathode returnGND

23. Connections between "hc390_high_counters" and "ESP32"

Functionhc390_high_countersESP32
powerVCC → logic power5V
groundGND → logic groundGND
digitalDIG5_BCD → 74HC390 dual decade counter IC DIG6_CLKEXT
digitalDIG6_BCD → 74HC390 dual decade counter IC DIG7_CLKEXT
digitalDIG4_BCD → 74HC390 dual decade counter IC DIG5_CLKEXT

24. Connections between "timing_parts" and "ESP32"

Functiontiming_partsESP32
dataLATCH_TIMING → 74HC123 dual retriggerable monostable LATCH_PULSEEXT
dataRESET_TIMING → 74HC123 dual retriggerable monostable RESET_PULSEEXT

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace — diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik