Built-in project · no microcontroller

CD4000 counter, switch and one-shot drawer

13 chips on breadboards, powered, every input tied low and ready to rewire. There is no microcontroller in it: the simulator solves the 13 parts as a circuit, so it runs the moment you press Run, and nothing needs compiling.

Teaching? Assign it to your class in one click.

Beginner About 20 minutes to build and run. Runs in your browser. Free, and no account needed.

The parts retail for about $22. On Mokxi they're free.

The circuit runs here once the page has loaded.

What you'll learn

  • Powering CMOS logic chips, with VDD and VSS or VCC and GND
  • Why unused inputs are tied low instead of left floating
  • Flip-flops, counters and one-shots as building blocks
  • Testing a chip by changing one input at a time
  • Difficulty: Beginner
  • Time: About 20 minutes
  • Parts: 19

How it works

This is a drawer of thirteen logic chips on three breadboards: flip-flops, counters, a display driver, multiplexers, an analog switch and two one-shot timers. Each one is powered, and each input is tied to ground so nothing floats.

Nothing else is wired, so the circuit does nothing by itself. You choose a chip, move one input wire to the plus rail, add an LED and a resistor on an output, and watch what changes. Each chip's help page has its pins and truth table.

Parts list

19 parts, plus the jumper wires. They retail for about $22; on Mokxi they're free.

  • 3 × Full-size breadboard
  • 3 × Power, 5 V
  • 1 × CD4027 dual JK flip-flop
  • 1 × CD4013 dual D flip-flop
  • 1 × CD4020 14-stage counter
  • 1 × CD4040 12-stage counter
  • 1 × CD4024 7-stage counter
  • 1 × CD4060 counter with oscillator
  • 1 × CD4026 counter with 7-segment outputs
  • 1 × CD4543 7-segment LCD driver
  • 1 × 74HC4052 dual 4-channel mux
  • 1 × 74HC4053 triple 2-channel mux
  • 1 × 74HC4066 quad analog switch
  • 1 × 74HC123 dual monostable
  • 1 × 74HC221 dual monostable

Wiring table

Every connection, pin by pin, read from the circuit itself. Each row joins the pin on the left to the pin on the right, by a jumper wire or a breadboard strip.

Part and pinConnects to
CD4027 dual JK flip-flop pin VDD5 V
CD4013 dual D flip-flop pin VDD5 V
CD4020 14-stage counter pin VDD5 V
CD4040 12-stage counter pin VDD5 V
CD4024 7-stage counter pin VDD5 V
CD4027 dual JK flip-flop pin 2CPGround
CD4027 dual JK flip-flop pin 2RGround
CD4027 dual JK flip-flop pin 2KGround
CD4027 dual JK flip-flop pin 2JGround
CD4027 dual JK flip-flop pin 2SGround
CD4027 dual JK flip-flop pin VSSGround
CD4027 dual JK flip-flop pin 1SGround
CD4027 dual JK flip-flop pin 1JGround
CD4027 dual JK flip-flop pin 1KGround
CD4027 dual JK flip-flop pin 1RGround
CD4027 dual JK flip-flop pin 1CPGround
CD4013 dual D flip-flop pin 1CPGround
CD4013 dual D flip-flop pin 1RGround
CD4013 dual D flip-flop pin 1DGround
CD4013 dual D flip-flop pin 1SGround
CD4013 dual D flip-flop pin VSSGround
CD4013 dual D flip-flop pin 2SGround
CD4013 dual D flip-flop pin 2DGround
CD4013 dual D flip-flop pin 2RGround
CD4013 dual D flip-flop pin 2CPGround
CD4020 14-stage counter pin VSSGround
CD4020 14-stage counter pin CPGround
CD4020 14-stage counter pin MRGround
CD4040 12-stage counter pin VSSGround
CD4040 12-stage counter pin CPGround
CD4040 12-stage counter pin MRGround
CD4024 7-stage counter pin CPGround
CD4024 7-stage counter pin MRGround
CD4024 7-stage counter pin VSSGround
CD4060 counter with oscillator pin VDD5 V
CD4026 counter with 7-segment outputs pin VDD5 V
CD4543 7-segment LCD driver pin VDD5 V
74HC4052 dual 4-channel mux pin VCC5 V
74HC4053 triple 2-channel mux pin VCC5 V
CD4060 counter with oscillator pin VSSGround
CD4060 counter with oscillator pin PIGround
CD4060 counter with oscillator pin MRGround
CD4026 counter with 7-segment outputs pin CLKGround
CD4026 counter with 7-segment outputs pin INHGround
CD4026 counter with 7-segment outputs pin DEIGround
CD4026 counter with 7-segment outputs pin VSSGround
CD4026 counter with 7-segment outputs pin RSTGround
CD4543 7-segment LCD driver pin LDGround
CD4543 7-segment LCD driver pin CGround
CD4543 7-segment LCD driver pin BGround
CD4543 7-segment LCD driver pin DGround
CD4543 7-segment LCD driver pin AGround
CD4543 7-segment LCD driver pin PHGround
CD4543 7-segment LCD driver pin BIGround
CD4543 7-segment LCD driver pin VSSGround
74HC4052 dual 4-channel mux pin VEEGround
74HC4052 dual 4-channel mux pin GNDGround
74HC4053 triple 2-channel mux pin VEEGround
74HC4053 triple 2-channel mux pin GNDGround
74HC4066 quad analog switch pin VCC5 V

17 more connections: open it in the simulator to see them all.

The notes that come with it

There is no microcontroller in this one, so nothing is compiled: the simulator solves the circuit itself. The file in the editor is the notes that come with it.

sketch.ino
// CD4000 counter, switch and one-shot drawer.
//
// Every chip is on a breadboard and powered, and every one of its inputs is
// tied low by a wire to a ground rail, so nothing floats. Nothing else is
// wired: pick a chip, move an input's wire to the + rail, put an LED with a
// resistor on an output, and see what it does. Each chip's help page has its
// pins and its truth table.

Troubleshooting

The usual mistakes with this circuit, and the fix for each.

  • An output never changes This project
    Most inputs are tied to ground. Move the wire of the input you want to test to the plus rail.
  • An LED stays dark or the chip behaves oddly This project
    Put a resistor in series with the LED, and never leave an input unconnected.
  • The flip-flop ignores the clock, or stays set or reset. CD4027 dual JK flip-flop
    Set and reset are active high on the CD4027, and they override the clock. Tie both to GND when not used. Do not leave them floating.
  • Outputs change at an unexpected time. CD4027 dual JK flip-flop
    The clock acts on the rising edge only. Make sure J and K are stable before the edge. J high and K high makes it toggle, J and K low holds the state.
  • The flip-flop outputs are stuck or random. CD4013 dual D flip-flop
    Tie unused SET and RESET inputs to ground, since they are active high. Never leave inputs floating on a CMOS part. Add a 100 nF cap close to VDD.
  • It does not clock properly. CD4013 dual D flip-flop
    Data moves on the rising edge of the clock. Use a clean, debounced clock. For a toggle, connect Q-bar to D. The supply is 3 to 15 V.
  • The counter starts at a random value or never clears. CD4020 14-stage counter
    The reset pin is active high. Tie it low to count and pulse it high to clear. A floating reset gives erratic counts.
  • The count is wrong or skips. CD4020 14-stage counter
    The CD4020 counts on the falling edge of the clock. Use a clean clock. Not all outputs are present on the chip, as Q2 and Q3 are missing.

Change it and keep it

Open it in the editor, change the circuit or the code, and keep your version in a free account.