Part

CD4017 decade counter

Ten outputs, one high at a time, stepping along on every clock.

See every part
  • 16 pins
  • 1 setting
  • In 1 project
Drawn live by the editor's own code, at the size you see it.
At a glance

The CD4017 decade counter in brief

What it is, and every setting the properties panel gives it.

The CD4017 is the decade counter in LED chaser kits: ten decoded outputs, Q0 to Q9, exactly one of them high, and each rising edge on CLK moves the high one along. CO is high for counts 0 to 4, RST high sends the count to 0, and INH high freezes it. VDD takes 3 to 18 volts. A 555 astable usually supplies the clock, but any Arduino pin will do: CLK to a digital pin and one short HIGH pulse per step, from an Uno at 5 volts or from an ESP32 with VDD at 3.3. Mokxi models the weak metal-gate outputs as 2500 / VDD ohms, 500 at 5 volts, so an LED with no resistor gets a few milliamps and glows; the clock delays of 500 nanoseconds to an output and 400 to CO at 5 volts; and Q5 wired to RST counting to five. The model property offers the 74HC4017, whose strong outputs do need resistors. The classic mistakes are leaving RST or INH floating, which turns the whole count unknown, and wiring the LEDs in pin order when pin 1 is Q5. Minimum pulse widths and a real chip’s random power-up count are not modeled.

Family
Logic
Pins
16
model
CD4017B (or 74HC4017)
Pins

16 pins

Named as the editor names them, so a wire lands where you expect it.

Output11

  • Q5
  • Q1
  • Q0
  • Q2
  • Q6
  • Q7
  • Q3
  • Q8
  • Q4
  • Q9
  • CO

Input or output2

  • VSS
  • VDD

Input3

  • INH
  • CLK
  • RST
How to use it

How to use the CD4017 decade counter with an Arduino

VDD to 5 V, VSS to ground, RST and INH to ground so it counts, and a clock on CLK: every rising edge moves the one high output along, Q0 to Q9 and around again. The chaser here takes its clock from a 555 at about 4 Hz with no code; from an Arduino, CLK goes to a digital pin and each short HIGH pulse is one step.

The outputs are not in order around the chip: pin 1 is Q5 and pin 3 is Q0, which is why the wires to the LEDs cross. The LEDs need no resistors because a CD4017 output is a weak 500 ohm switch at 5 V. Leave RST or INH floating and the whole count goes unknown; wire Q5 to RST instead of ground and it counts to five.

Part pin
Board pin
VDD
5 V
VSS
GND
CLK
555 OUT (pin 3)
RST, INH
GND
Q0 to Q9
LED anodes, cathodes to GND

With VDD at 3.3 V an ESP32 pin can clock it; the outputs are weaker still at that supply. The 74HC4017 model has strong outputs that do need resistors.

No board: 555 and CD4017 LED chaserlive0.000 s 0.00x
Click to open it in the editor
This is the simulator itself, running here. Click anything to open it in the editor.
How it is modeled

What is true about the CD4017 decade counter, here

In its help article’s own words: what the simulation gets right, and where it stops.

Modeled

The outputs are weak. A metal-gate CMOS output is a few hundred ohms. The model uses 2500 / VDD ohms, which is 500 ohms at 5 V and matches the MC14017B data sheet's typical drive currents at 5, 10 and 15 V to within a few percent. An LED with a 220 ohm resistor on an output gets about 4 to 5 mA at 5 V and glows rather than blazes, exactly as it does on a real breadboard, and the output voltage sags under that load.

It is slow, and the delay depends on the supply. From the MC14017B data sheet's typical column at 50 pF: 500 ns from the clock to a decoded output and 400 ns to CO at 5 V, falling to 230 and 175 ns at 10 V and 175 and 125 ns at 15 V. Supplies in between are interpolated along those points.

Resetting from an output works. Wire Q5 to RST and the counter runs 0, 1, 2, 3, 4 and starts again, because Q5 resets the chip the moment it goes high. Q5 is high for about half a microsecond each time, as on the real chip, which is too short to light an LED.

Not modeled

The Johnson counter inside a real 4017 is modeled as the count 0 to 9 it decodes to, which is all its pins ever show. It powers up at 0 rather than wherever it likes. There are no minimum clock pulse widths or reset removal times: a pulse of any length counts. Below 5 V the delays are held at the 5 V figures, where a real chip is slower still. Input thresholds are half the supply, where the data sheet only promises 30% and 70%.

From CD4017 decade counter, in full.

Projects

See the CD4017 decade counter in a project

One built-in project uses it. It opens in the editor, already wired.

Wire up the CD4017 decade counter

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.