COUNTERS

Photo of author

By Jackson Taylor

Home » Hardware » COUNTERS

As an Amazon Associate we earn from qualifying purchases.

Counters are among the most useful building blocks in electronics. They keep track of pulses, divide frequencies and step through sequences. One of the most popular for hobby projects is the CD4017 decade counter. This guide explains what it does, how its pins work and where it fits in a circuit.

CD4017 Decade Counter

CD4017 Decade Counter image

The CD4017 is a CMOS integrated circuit that combines a counter with a decoder. It has ten outputs, labelled Q0 to Q9. Only one output is high at any moment. Each clock pulse moves the high output to the next pin in order, then it wraps around to Q0 after Q9.

Stock listing from the original page

The original listing for this part showed a price of 8 and 50 units remaining. No currency was given, and stock and prices change, so treat these figures as historical and check with your supplier before ordering.

Hardware Hack

Stop Buying New Batteries for Your Tech

Electronics are expensive, but their power sources don't have to be. Discover the simple engineering trick to recondition dead batteries and bring your gadgets back to 100% capacity.

Watch the Free Video

How the CD4017 works

Inside the chip is a five-stage Johnson counter followed by decoding logic. You don’t need to understand the internals to use it. The practical behaviour is simple:

  • On power-up or reset, output Q0 is high and the other nine outputs are low.
  • Each rising edge on the clock input advances the high output by one step.
  • After Q9, the next pulse returns the high output to Q0.
  • A high level on the reset pin forces the count back to Q0 at any time.

Because each output goes high in turn, the chip works well for sequencing, such as lighting LEDs one after another, without any extra decoding parts.

CD4017 pinout

The chip comes in a 16-pin package. The control and power pins are:

  • Pin 16 (VDD): positive supply.
  • Pin 8 (VSS): ground.
  • Pin 14 (CLOCK): counts on the rising edge.
  • Pin 13 (CLOCK INHIBIT or enable): when high, the counter ignores clock pulses. Tie it to ground for normal counting.
  • Pin 15 (RESET): when high, the count returns to Q0. Tie it to ground if you don’t need it.
  • Pin 12 (CARRY OUT): goes high for counts 0 to 4 and low for counts 5 to 9, giving one full cycle per ten clock pulses. This is useful for chaining chips.
See also
RESISTORS

The ten outputs are on these pins:

  1. Q0: pin 3
  2. Q1: pin 2
  3. Q2: pin 4
  4. Q3: pin 7
  5. Q4: pin 10
  6. Q5: pin 1
  7. Q6: pin 5
  8. Q7: pin 6
  9. Q8: pin 9
  10. Q9: pin 11

The output order isn’t sequential by pin number, so check the pinout against the datasheet for your exact part before wiring it up.

Power supply and output limits

Like other CD4000-series chips, the CD4017 accepts a wide supply range, so it runs from a few volts up to roughly 15 V in typical hobby use. The exact limits vary by manufacturer, so check the datasheet for your part. This makes it easy to power from a battery or a regulated supply.

The outputs can only supply a small current. An LED with a suitable series resistor is fine. Anything heavier, such as a relay, motor or buzzer, needs a transistor between the output and the load.

Common uses

LED chaser

Feed the clock pin from a slow oscillator, such as a 555 timer, and connect an LED with a resistor to each output. The lit LED moves along the row and repeats, giving a running-light effect. Changing the oscillator speed changes how fast the light moves.

Sequencer and timer

Each output can trigger a different action in turn. You can use this for simple lighting sequences, step-based timers or basic music and sound sequencers.

Divide-by-10 frequency divider

The carry output completes one cycle for every ten input pulses. This means you can divide a clock frequency by ten, and chaining several chips divides it by 100, 1000 and so on.

Sustainable Tech

Keep Toxic E-Waste Out of Landfills

Don't throw away your failing laptop, phone, or car batteries. Learn how to recondition them at home in just a few hours. It's better for the planet—and your wallet.

Learn How It Works

Counting fewer than ten steps

To make a shorter sequence, connect the output after your last step to the reset pin. For example, wiring Q6 to reset gives a repeating six-step sequence from Q0 to Q5, because the counter resets as soon as Q6 goes high.

Wiring tips

  • Don’t leave CMOS inputs floating. Tie the reset and clock inhibit pins to ground when unused.
  • Add a small capacitor, such as 100 nF, across the supply pins close to the chip to reduce noise.
  • Use a clean clock signal. Switch contacts bounce and can cause extra counts, so debounce a button before using it as a clock.
  • Handle the chip with care. CMOS parts are sensitive to static electricity.
  • Use a series resistor with every LED, and avoid drawing too much current from any single output.
See also
Frequency detection using LM567

Choosing the right counter

The CD4017 is a good fit when you want one active output at a time. If you need a binary count value, for example to drive a display decoder or feed a microcontroller, a binary counter such as the CD4020 or a BCD counter such as the CD4510 may suit better. If you need ten outputs and a simple setup, the CD4017 is hard to beat.

FAQ

What does the CD4017 do?

It counts clock pulses and turns on one of its ten outputs at a time, moving to the next output with each pulse. It’s often used for LED chasers, sequencers and frequency division.

Can the CD4017 drive LEDs directly?

Yes, for small LEDs, provided you add a current-limiting resistor to each one. For larger loads, use a transistor as a driver.

How do I make the CD4017 count to fewer than ten?

Connect the output that follows your last step to the reset pin. The counter then returns to Q0 immediately and repeats the shorter sequence.

How do I connect two CD4017 chips together?

Connect the carry-out pin of the first chip to the clock pin of the second. The second chip then advances once for every full cycle of ten pulses on the first.

The CD4017 stays popular because it is cheap, simple to wire and does one job well. Once you know the clock, reset and inhibit pins, you can build a wide range of sequencing circuits with very few components.

Revive Your Dead Electronics

Got a drawer full of dead gadgets or a failing car battery? Instead of paying a premium for replacements, use this simple trick to easily recondition them right from home.

See How It Works