Learn & build · Electronics · Part II · Chapter 19

Two chips talking: a running light

Real circuits are rarely one chip. A clock feeds a counter, a sensor feeds a microcontroller, a microcontroller feeds a driver, and every one of those joins is a wire from one chip's output to another chip's input. This build makes the simplest such pair, a 555 clocking a 4017 counter so ten LEDs light one after another, and asks the question every joined pair raises: does the first chip's "high" look high enough to the second?

Before you start. The 555 blinker and the build steps are chapter 17; flip-flops counting is chapter 12 §6; 1s and 0s as voltages are chapter 12's opening; floating inputs are chapter 13 §2; hysteresis is chapter 7 §5.

1. The goal and the blocks

The goal: ten LEDs light one at a time, left to right, about four steps a second, from a 9 V battery. The blocks: a clock (chapter 17's 555, faster), a counter that turns each clock pulse into "the next LED", and ten LEDs. The counter is the new part.

The CD4017 is a decade counter: it counts rising edges on its clock input, and instead of showing the count in binary (chapter 12) it makes exactly one of ten outputs high, Q0 for a count of 0 through Q9 for 9. Predict before you look: what happens on the clock edge after Q9?

Watch the LEDs on the right: one lit at a time, and after Q9 the count wraps around to Q0. Pick U2 to read what's inside it, and pick R3, the single resistor every LED shares (section 5 explains why one is enough).

2. Pin 3 is Q0

The 4017 has 16 pins, and its outputs are scattered around them: Q0 is pin 3, Q1 pin 2, Q5 pin 1. The schematic draws them in counting order because that's how you think about the circuit; the package puts them wherever its designers' layout put them, decades ago. This is normal, and it's why a schematic always carries pin numbers.

Pick pins until you've found it: which pin is Q0, the output that's high right after a reset?

Pin 3. Then Q1 is pin 2 and Q2 pin 4. Wire the LEDs by pin number from the datasheet, never by guessing from the order of the outputs.

3. Every input needs a voltage

Two of the 4017's inputs do nothing in this build: RST (pin 15) and INH, clock inhibit (pin 13). Both are tied to ground in the schematic. Chapter 13 explained why an unconnected input is trouble: it's a CMOS gate (chapter 12) that draws almost no current, so it drifts to whatever voltage is nearby. That matters more here than on the 555's pin 4.

You forget pin 13 (INH) and leave it unconnected. What would you most likely see?

A floating INH wanders between high (count frozen) and low (counting) with every bit of hum it picks up, including from your hand. A floating RST is worse: it sends the light back to Q0 at random. The datasheet says the count advances only while CLOCK INHIBIT is low, and that a high RESET clears it. Tie every input you don't use to VDD or VSS (a CMOS chip's names for its + supply and its ground), whichever means "do nothing" for that pin.

4. Does a 555's high look high to a 4017?

Here's the new question. Chapter 12 said a voltage near the supply means 1 and near 0 V means 0, "and nothing in between counts." Datasheets put numbers on that. The 4017's datasheet promises to read any input above its input-high voltage VIH as a 1 (3.5 V on a 5 V supply, 7 V on 10 V, 11 V on 15 V: about 70% of the supply), and anything below VIL (1.5, 3 and 4 V) as a 0. In between, it promises nothing. The 555's datasheet promises its output high is at least VOH, 2.75 V on a 5 V supply and 12.75 V on 15 V while it pushes 100 mA (about 2.25 V below its supply), and typically 1.7 V below. Slide the supply both chips share.

🎯 Challenge: find the lowest supply where the 555's guaranteed high still clears the 4017's VIH.

At 5 V the pair fails on paper: the 555 promises 2.75 V and the 4017 asks for 3.5 V, so even the 555's typical 3.3 V falls short. It might work on your bench, and fail with the next chip from the bag or on a cold morning (chapter 5: design with the min and max columns). At 9 V there's room: the promise is 6.75 V against the 6.3 V the 4017 needs. That's why this build runs on 9 V. In the simulator the clock reaches 7.3 V, because the 4017's input draws almost no current, far less than the datasheet's 100 mA test.

Two chips can talk only if the first one's guaranteed output-high is above the second one's input-high threshold, and its output-low below the input-low one, at the supply you'll actually use.

Where it breaks: a microcontroller's 3.3 V into a 5 V chip

The same check decides one of the most common questions in hobby electronics. A 3.3 V microcontroller pin (high is at least about 2.6 V) driving a 5 V CMOS chip like this one (VIH 3.5 V) fails on paper. The usual fixes: run the second chip from 3.3 V too (the 4017 runs from 3 V), pick a part whose inputs are made for it (the 74HCT family reads 2 V as a 1 on a 5 V supply), or put a level shifter between them. Going the other way, a 5 V output into a 3.3 V input, is worse: it can push current into the smaller chip and damage it, unless its datasheet says its inputs are "5 V tolerant." Chapter 22 meets this on real modules.

5. One resistor for ten LEDs

The circuit lab's "Two LEDs, one resistor (why it fails)" circuit showed what goes wrong when LEDs share a resistor: the one with the lower voltage takes all the current. Yet here ten LEDs share R3. Why does it work?

Why can ten LEDs share one resistor here?

Sharing fails when two LEDs are on together. The 4017 guarantees one high output, so one lit LED and one current: (9 − 1.9) V across R3 plus the output's own resistance, about 5.8 mA in the simulator. That guarantee comes from the datasheet ("exactly one output high"), and it's what makes the shortcut safe. With a chip that could turn on two outputs at once, it wouldn't be.
Why are CMOS outputs "weak"?
  1. Each output is chapter 12's CMOS inverter: a P-channel MOSFET from VDD to the pin, an N-channel from the pin to ground.
  2. On a logic chip these transistors are tiny, built to charge the next chip's input capacitance (chapter 12's ripple-carry box), not to drive loads. Fully on, a tiny MOSFET is still a resistor of a few hundred ohms.
  3. The datasheet says it as current: at 10 V, at least 1.3 mA (typically 2.6 mA) while holding the output within 0.5 V of VDD. That's about 0.5 V / 2.6 mA ≈ 190 Ω, close to the 220 Ω the simulator uses at 9 V.
  4. So an LED driven from a 4017 is dimmer than one from a 555 (whose output stage is built for 200 mA), and a 4017 output can't drive a relay or a motor at all: that needs a transistor (chapter 4).

6. The breadboard

Two chips, the same plan as chapter 17: each across the gap, power to its pins first, then each pin's strip gets its parts. Two things are new. The clock is one long blue jumper from the 555's pin 3 to the 4017's pin 14. And the bottom blue rail isn't ground here: it's the ten LEDs' shared cathode node, and R3 joins it to ground on the right. A rail is only a long strip; its color is a habit, so say so on your board with a label.

🎯 Challenge: click the bottom blue rail and count the LEDs joined to it.

7. The shopping list

RefPartWhy this one
U1NE555PThe clock (chapter 17).
U2CD4017BE (16-pin DIP)B-series CMOS: 3–18 V, so it shares the 9 V. "BE" is the DIP package.
R1, R210 kΩ, 68 kΩ, ¼ WAbout 4.5 steps a second with C1.
C12.2 µF electrolytic, 16 V+Timing.
R31 kΩ, ¼ WThe shared LED resistor: about 6 mA.
C20.1 µF ceramic (104)Bypass. On a soldered board, one beside each chip.
LED1–10red 5 mm LEDsOne color, so they look alike at the same current.

8. Power up and check

9. What's wrong?

The light runs, but in a strange order: 1, 2, 3, then the 6th LED, then back near the start.

The counter is fine; the LEDs are in the wrong strips. Q0 is pin 3, Q1 pin 2, Q2 pin 4, Q3 pin 7: placing LEDs along pins 1, 2, 3… scrambles the order. Rewire by the pinout (section 2).

The light freezes on one LED, then moves on when you touch near pin 13.

Your finger is the giveaway: its hum is enough to move a floating CMOS input (section 3). Find the jumper from pin 13's strip to the ground rail.

10. Make it yours

Next: a dusk light, where a sensor makes the decision: a light sensor, a comparator and a MOSFET switch a 12 V LED strip on when it gets dark.

Previous: A 5 V and 3.3 V supply · All chapters: Learn & build.

Last updated