Fork me on GitHub

Project Notes

#353 D Flip-Flop

Building a clocked D Flip-flop with 74LS00 NAND gates.



The LEAP#348 DLatch project demonstrated how to build a “data latch” with NAND gates. It’s operation is asynchronous however - meaning while enabled, the output changes as inputs change.

For digital logic circuits however, it is often preferred to have synchronous changes - meaning the outputs only change on a definitve part of a clock cycle. These are usually referred to as flip-flops, to distinguish them from asynchronous “latches”.


The D flip-flop circuit here is only slightly modified from the latch circuit:

  • same NAND-gate construction
  • but the enable input is tied to a clock source, with an RC circuit to acta as a rising-edge detector

As a result, output changes only occur on the rising edge of the clock.

As a clock source, I’ve wired up a simple 74LS14 Schmitt oscillator, with a pretty slow frequency of around 1.77Hz.

The edge detector is an RC integrator with a time constant of 0.1ms.

To demonstrate the flip-flop behaviour, an Arduino is feeding a data signal at around 10Hz (100ms period). This is not synchronised with the clock (enable) input, so results are somewhat randomised, allowing for all combinations of inputs to be tested.

Ben Eater’s Tutorials

Great explanations of the D latch and D Flip-Flop..

D latch

D flip-flop


Channel connections for the following traces:

  • CH1 (Yellow) - Q output
  • CH2 (Blue) - clock/enable oscillator (unfiltered)
  • CH3 (Red) - clock/enable trigger (filtered)
  • CH4 (Green) - D input (from Arduino)

This first trace shows output Q transitioning from low to high. Note:

  • occurs on the leading edge of the clock/enable pulse
  • when data input is high
  • does not reset on the falling edge of the clock
  • does not reset when data input falls


This second trace shows output Q transitioning from high to low. Note:

  • occurs on the leading edge of the clock/enable pulse
  • when data input is low
  • does not reset on the falling edge of the clock
  • does not reset when data input rises






Credits and References

Project Source on GitHub Project Gallery Return to the LEAP Catalog

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

LEAP is just my personal collection of projects. Two main themes have emerged in recent years, sometimes combined:

  • electronics - usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting
  • scale modelling - I caught the bug after deciding to build a Harrier during covid to demonstrate an electronic jet engine simulation. Let the fun begin..
To be honest, I haven't quite figured out if these two interests belong in the same GitHub repo or not. But for now - they are all here!

Projects are often inspired by things found wild on the net, or ideas from the many great electronics and scale modelling podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know (or send a PR!). See the individual projects for credits where due.