Step-by-Step Guide to Building a NAND‑Gate 4‑Bit Binary Counter
Ever wondered why your digital clock can count seconds without a microcontroller? The secret is a simple 4‑bit binary counter built from just NAND gates. With a handful of cheap chips and a breadboard, you can watch numbers roll over, learn how flip‑flops work, and end up with a tiny piece of logic you can reuse in many projects. Let’s dive in.
What is a 4‑Bit Binary Counter?
A binary counter is a circuit that adds one to a binary number each time it receives a clock pulse. With four bits you can represent 0‑15 (0000‑1111). After 1111 the next pulse wraps the count back to 0000. In everyday life this is the heart of digital clocks, frequency dividers, and simple state machines.
Why Build It With NAND Gates Only?
NAND is a universal gate – you can make any other gate (AND, OR, NOT, XOR) from it. By restricting ourselves to NAND we get two benefits:
- Learning value – you see how complex behavior emerges from a single primitive.
- Component simplicity – a single 7400 quad‑NAND chip supplies four NAND gates, enough for the whole counter if you arrange them right.
Parts List
- 1 × 74LS00 (quad NAND, 5 V supply) – the star of the show
- 1 × 10 kΩ resistor (pull‑down for the clock)
- 1 × 100 Ω resistor (optional LED current limit)
- 1 × LED (to show the least‑significant bit)
- Breadboard and jumper wires
- 5 V DC power source (USB power bank works fine)
- Optional: 2 × 16 segment display and a driver if you want to see the full count
Understanding the Building Blocks
The NAND‑Based SR Latch
An SR (Set‑Reset) latch stores one bit of information. With NAND gates it looks like this:
- Two NAND gates cross‑connected.
- Inputs S (set) and R (reset) are active‑low – a low on S forces the output Q high, a low on R forces Q low.
- When both inputs are high, the latch holds its state.
The T Flip‑Flop From NAND
A T (Toggle) flip‑flop changes state on each clock pulse when its T input is high. You can make a T flip‑flop by feeding the Q output back into one input of a NAND gate together with the clock. The result is a toggle on every rising edge.
Cascading Flip‑Flops for a Counter
Connect four T flip‑flops in series. The output Q of the first (least‑significant) flip‑flop becomes the clock for the next stage, and so on. Each stage divides the frequency by two, giving you a binary count.
Wiring the Circuit – Step by Step
1. Power Up the NAND Chip
- Insert the 74LS00 into the breadboard so that the notch aligns with the middle.
- Connect pin 14 to +5 V and pin 7 to ground.
- Double‑check that no pins are shorted.
2. Build the First T Flip‑Flop
- Use NAND gates 1 and 2 for the SR latch.
- Connect the two inputs of gate 1 together – this will be the “Set” line.
- Connect the two inputs of gate 2 together – this will be the “Reset” line.
- Tie both “Set” and “Reset” together through a 10 kΩ resistor to +5 V. This makes the latch hold its state when the clock is idle.
- Feed the clock (a square wave from a push‑button or a 555 timer) into the “Set” line through a 10 kΩ pull‑down. When the button is pressed, the line goes low, forcing the latch to toggle.
3. Add the Toggle Logic
- Take the Q output of the latch (pin 3 of gate 1) and feed it back into one input of a third NAND gate (gate 3).
- Feed the same clock signal into the other input of gate 3.
- The output of gate 3 becomes the new clock for the next stage and also drives an LED (through a 100 Ω resistor) so you can see the LSB blink.
4. Replicate for Bits 2‑4
- Use the remaining NAND gates (gate 4, gate 5, gate 6) to build three more identical T flip‑flops.
- The clock for each stage is simply the Q output of the previous stage.
- Connect each Q output to a separate LED if you want a visual binary display.
5. Test the Counter
- Press the clock button repeatedly. You should see the LEDs count in binary: 0001, 0010, 0011, … up to 1111, then back to 0000.
- If an LED stays on or off unexpectedly, check the pull‑down resistor on the clock line and make sure the NAND inputs are not floating.
6. Optional: Add a 7‑Segment Display
- Use a simple BCD‑to‑7‑segment decoder (like a 4511) and wire the four Q outputs to its inputs.
- Connect the decoder’s segment pins to a common‑anode display with appropriate current‑limiting resistors.
- Now you have a readable decimal counter from 0 to 9, with the extra binary states looping silently.
Debugging Tips
- Floating inputs cause unpredictable behavior. Always tie unused inputs to VCC through a resistor.
- Power supply noise can make the counter jitter. A small 0.1 µF capacitor across VCC and GND near the chip helps.
- Button bounce may generate extra clock pulses. If you notice missed counts, add a debouncing circuit (a simple RC filter or a 555 debouncer).
Why This Project Is Worth Your Time
Building a NAND‑only counter forces you to think in terms of fundamental logic rather than relying on ready‑made ICs. You’ll understand how clocks, latches, and flip‑flops interact, and you’ll have a reusable building block for larger designs like frequency dividers, state machines, or even a simple CPU prototype. Plus, watching those LEDs march through binary is oddly satisfying.
When I first built this on a cramped dorm desk, the only thing I had was a busted Arduino board and a bag of spare chips. The moment the fourth LED lit up and the count wrapped back to zero, I felt like I’d just cracked a secret language of computers. That thrill is exactly what NAND Logic Hub aims to share with every hobbyist who picks up a breadboard.
So grab a 74LS00, a few resistors, and a push‑button. In under an hour you’ll have a working 4‑bit binary counter that you can expand, modify, or simply admire. Happy building!
- → DIY Digital Alarm System: Designing and Wiring a Logic-Gate Based Security Circuit @gatecraft
- → Step‑by‑Step Guide: Build a 4‑Bit Binary Counter Using Only NAND Gates @gatecraft
- → Choosing the Perfect Oscilloscope for Your Next Maker Project: A Practical Guide @scopecraft
- → How to Prevent Wing Nut Stripping in Mechanical Projects – Step‑by‑Step Tips @wingnutworkshop
- → Choosing the Right Wing Nut for Your Next DIY Build: A Practical Guide @wingnutworkshop