Built-in project · no microcontroller

CD4060 timer

A CD4060 oscillates on two resistors and a capacitor and divides it down to blink four LEDs, each at half the rate of the one before. There is no microcontroller in it: the simulator solves the 12 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.

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

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

The circuit runs here once the page has loaded.

What you'll learn

  • An RC oscillator: two resistors and a capacitor set the speed
  • Binary counters that divide a frequency by two at each stage
  • Why a larger capacitor makes everything blink more slowly
  • A reset pin held low to let a chip run
  • Difficulty: Intermediate
  • Time: About 20 minutes
  • Parts: 14

How it works

The CD4060 is one chip with two jobs. The 47k resistor, the 220k resistor and the 100 nF capacitor make its built-in oscillator run at about 97 Hz. That is far too fast to see.

The chip then counts those pulses and divides them. Each output runs at half the speed of the one before it. Q4 blinks about 6 times a second, Q5 about 3, Q6 about 1.5 and Q7 about once every 1.3 seconds.

Each of those four outputs drives a green LED through a 330 ohm resistor. The MR pin is tied to ground so the counter keeps running. There is no microcontroller and no code.

Parts list

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

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
CD4060 counter with oscillator pin VDD5 V
CD4060 counter with oscillator pin VSSGround
CD4060 counter with oscillator pin MRGround
LED, green (1) pin CGround
LED, green (2) pin CGround
LED, green (3) pin CGround
LED, green (4) pin CGround
Resistor, 330 Ω (3) pin 1CD4060 counter with oscillator pin Q6
Resistor, 330 Ω (2) pin 1CD4060 counter with oscillator pin Q5
Resistor, 330 Ω (4) pin 1CD4060 counter with oscillator pin Q7
Resistor, 330 Ω (1) pin 1CD4060 counter with oscillator pin Q4
Capacitor, 100 nF pin 1CD4060 counter with oscillator pin PO
Resistor, 47k Ω pin 2CD4060 counter with oscillator pin PON
Resistor, 220k Ω pin 1CD4060 counter with oscillator pin PI
Resistor, 47k Ω pin 1Resistor, 220k Ω pin 2
Capacitor, 100 nF pin 2Resistor, 220k Ω pin 2
LED, green (1) pin AResistor, 330 Ω (1) pin 2
LED, green (2) pin AResistor, 330 Ω (2) pin 2
LED, green (3) pin AResistor, 330 Ω (3) pin 2
LED, green (4) pin AResistor, 330 Ω (4) pin 2

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
// A CD4060 timer: an RC oscillator and a 14-stage divider in one chip.
//
// The two resistors and the capacitor on pins 9, 10 and 11 make the chip
// oscillate at f = 1 / (2.2 x RX x CX). Here RX = 47k and CX = 0.1 uF:
// about 97 Hz, too fast to see.
//
// The counter divides it. Qn runs at f / 2^n:
//
//   Q4 (pin 7)  6 Hz      Q5 (pin 5)  3 Hz
//   Q6 (pin 4)  1.5 Hz    Q7 (pin 6)  0.76 Hz
//
// Q14 (pin 3) is f / 16384, about one change every 85 seconds: that is how
// a 4060 makes a long timer with no microcontroller. Click CX and make it
// 1 uF and everything slows down ten times.
//
// MR (pin 12) high resets the count and stops the oscillator.

Troubleshooting

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

  • The LEDs stay dark and nothing blinks This project
    Check that MR (pin 12) goes to ground. If it is high, the chip resets its count and stops the oscillator. Also check VDD has 5 V and VSS has ground.
  • Everything blinks too fast or too slowly This project
    The speed comes from the 47k resistor and the 100 nF capacitor. A bigger capacitor or resistor slows it down, a smaller one speeds it up.
  • An LED never lights This project
    LEDs only work one way. The long leg (anode) goes toward the 330 ohm resistor and the other leg goes to ground.
  • The oscillator does not run, or the frequency is wrong. CD4060 counter with oscillator
    It needs R and C on pins 9, 10 and 11. A common rule is f of about 1 divided by (2.2 times R times C). Use a larger resistor in series with Rs, and keep C above about 100 pF.
  • The counter acts strangely on power up. CD4060 counter with oscillator
    Pin 12 is reset and is active HIGH. Tie it to GND for normal running, or pulse it to restart the count. A floating reset gives random behavior.
  • The LED is dim, burns out, or the pin reads wrong because the resistor value is off. Resistor
    Read the color bands again. A 220 ohm to 330 ohm resistor suits a typical LED on 5 V. 10k is a common pull-up or pull-down value. Check with a multimeter if unsure.
  • A pull-up or pull-down resistor is missing, so the input floats and reads random values. Resistor
    Tie the input to 5 V or ground through about 10k. Or use INPUT_PULLUP and wire the switch to ground.
  • An electrolytic capacitor heats up, bulges or pops. Capacitor
    Electrolytics have a polarity. The stripe marks the negative leg, which goes toward ground. Also keep the voltage under the rated value, such as 10 V or 16 V.

Change it and keep it

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