Build it step by step
0 of 8 donePower the chip
5V to pin 16, GND to pin 8.
Tie the enable pin
Pin 13 to GND.
Wire the clock and reset
Pin 14 to D2, pin 15 to D3.
Wire ten LEDs
Each output through 1 kohm to an LED and GND.
Wire the buttons
D4 and D5 each to GND.
Upload the sketch
A lit LED runs along the row.
Press the run button
The slow clock stops.
Press the step button
One step per press.
How do you build a ten-step counter display?
A decade counter lights ten LEDs one after another from a clock pulse. You need Arduino Nano, CD4017 Counter, LED 5 mm red × 10, Resistor 1 kΩ × 10, Tactile push button 6 mm × 2 and Breadboard 830 Tie Points. It takes 8 steps and about 60 minutes.
- Level
- Beginner
- Time
- About 60 min
- Parts
- 6
Parts list
- Development BoardsBuyArduino Nano × 1
- Integrated CircuitsBuyCD4017 Counter × 1
- SemiconductorsBuyLED 5 mm red × 10
- PassivesBuyResistor 1 kΩ × 10
- SwitchesBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| CD4017 pin 16 (VDD) | Nano 5V | Power |
| CD4017 pin 8 (VSS) | Nano GND | Ground |
| CD4017 pin 13 (CE) | Nano GND | Enables the clock |
| CD4017 pin 14 (CLK) | Nano D2 | Clock pulses from the Nano |
| CD4017 pin 15 (RESET) | Nano D3 | Back to the first output |
| Outputs 0 to 9 | Pins 3, 2, 4, 7, 10, 1, 5, 6, 9, 11 | Each through a 1 kohm resistor to an LED then GND |
| Step button | Nano D4 to GND | Manual step |
| Run and pause button | Nano D5 to GND | Switch between slow clock and manual |
Code
The CD4017 is a classic counter chip that has ten outputs and lights only one at a time. Each rising edge at its clock pin moves the lit output to the next one, and after the tenth it goes back to the first. A pulse on the reset pin sends it back to output zero at once. The Nano here simply produces the clock, one pulse every 0.4 seconds, so the lit LED seems to run along the row. A second button pauses this slow clock, and then the first button steps the counter by hand so you can watch each output turn on in order. The chip is a CMOS part with weak outputs, which is why the resistors are 1 kilohm rather than 220 ohm: the LEDs are a little dimmer but the chip stays within its ratings. The clock enable pin must be tied to ground or the counter will not move. This is a good way to see counting, decoding and sequencing in hardware, and later you can try the carry output on pin 12 to chain two chips.
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
const int CLK = 2, RST = 3, STEP_BTN = 4, RUN_BTN = 5;
bool autoRun = true;
unsigned long lastStep = 0, lastPress = 0;
void pulse() {
digitalWrite(CLK, HIGH);
delay(2);
digitalWrite(CLK, LOW);
}
bool clicked(int pin) {
if (digitalRead(pin) == LOW && millis() - lastPress > 250) {
lastPress = millis();
return true;
}
return false;
}
void setup() {
pinMode(CLK, OUTPUT);
pinMode(RST, OUTPUT);
pinMode(STEP_BTN, INPUT_PULLUP);
pinMode(RUN_BTN, INPUT_PULLUP);
digitalWrite(RST, HIGH); // reset to output 0
delay(10);
digitalWrite(RST, LOW);
}
void loop() {
if (clicked(RUN_BTN)) autoRun = !autoRun;
if (autoRun) {
if (millis() - lastStep >= 400) { lastStep = millis(); pulse(); }
} else if (clicked(STEP_BTN)) {
pulse();
}
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Power on | First LED lit, then runs along |
| After the tenth | Back to the first |
| Press run | Counting stops |
| Press step | One LED at a time |
| Hold reset high | First LED lit |
If it does not work
Nothing moves
Pin 13 must go to GND.
LEDs light in the wrong order
Check the output pin order 3, 2, 4, 7, 10, 1, 5, 6, 9, 11.
Skipped steps
The clock line is noisy, add a 100 nF capacitor from pin 14 to GND.
Two LEDs lit
Reset is floating, wire it to D3.
LEDs very dim
Use a low-current LED.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the ten-step counter display?
Arduino Nano, CD4017 Counter, LED 5 mm red × 10, Resistor 1 kΩ × 10, Tactile push button 6 mm × 2 and Breadboard 830 Tie Points.
How long does the ten-step counter display take to build?
About 60 minutes for a beginner maker, in 8 steps.
How do I know the ten-step counter display works?
Power on: First LED lit, then runs along. After the tenth: Back to the first. Press run: Counting stops.
Nothing moves: what should I check?
Pin 13 must go to GND.
LEDs light in the wrong order: what should I check?
Check the output pin order 3, 2, 4, 7, 10, 1, 5, 6, 9, 11.
Skipped steps: what should I check?
The clock line is noisy, add a 100 nF capacitor from pin 14 to GND.
Two LEDs lit: what should I check?
Reset is floating, wire it to D3.
