Built-in project · no microcontroller

Counting a 555

A 555 astable with a frequency counter and a multimeter on its Hz range: frequency, period, duty and a running pulse total, against the arithmetic. There is no microcontroller in it: the simulator solves the 6 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 15 minutes to build and run. Runs in your browser. Free, and no account needed.

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

The circuit runs here once the page has loaded.

What you'll learn

  • How a 555 astable sets frequency and duty from R and C
  • What a frequency counter measures: frequency, period, duty and a running total
  • Why two instruments agree on one signal but differ in gate time
  • Why the frequency changes in step with the capacitor value
  • Difficulty: Intermediate
  • Time: About 15 minutes
  • Parts: 6

How it works

A 555 timer is wired as an astable: its output flips between high and low on its own. A 10k resistor from 5 V to DIS, a second 10k from DIS to the timing node, and a 100 nF capacitor to ground set the pace. The chip's output goes to a frequency counter and to a multimeter.

The capacitor charges through both resistors and drains through one, so the output is high for about 1.386 ms and low for about 0.693 ms. That works out to roughly 481 Hz on paper, high for two thirds of each cycle.

The counter shows frequency, period, duty and a pulse total. The multimeter, set to Hz, reads the same signal. The counter waits a whole second for each reading, the meter only a quarter of one, so the meter reacts sooner and the counter is steadier.

Parts list

6 parts, plus the jumper wires and 2 bench instruments. The parts retail for about $5.45; on Mokxi they're free, and so are the instruments.

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
Resistor, 10k Ω (1) pin 15 V
NE555 timer pin RESET5 V
NE555 timer pin VCC5 V
NE555 timer pin GNDGround
Capacitor, 100 nF pin 2Ground
Frequency counter pin GNDGround
Multimeter pin COMGround
NE555 timer pin DISResistor, 10k Ω (1) pin 2
Resistor, 10k Ω (2) pin 1Resistor, 10k Ω (1) pin 2
NE555 timer pin THRNE555 timer pin TRIG
Resistor, 10k Ω (2) pin 2NE555 timer pin TRIG
Capacitor, 100 nF pin 1NE555 timer pin TRIG
Frequency counter pin INNE555 timer pin OUT
Multimeter pin VNE555 timer pin OUT

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
// Counting a 555, three ways.
//
// The astable is the textbook one: R1 = 10 k from the supply to DIS, R2 = 10 k
// from DIS to THR, and 100 nF from there to ground.
//
//   high   =  0.693 x (R1 + R2) x C  =  1.386 ms
//   low    =  0.693 x R2 x C         =  0.693 ms
//   period =  2.079 ms               ->  481 Hz, high for 2/3 of it
//
// The counter reads about 479 Hz, and under it the period, the duty and how
// long each cycle spends high. That is within half a percent of the 481 on
// paper: the formula is for an ideal 555, and the simulated one is very
// nearly, but not exactly, that. The multimeter, on its Hz position, says the same
// number, because underneath they are the same comparator and the same
// counter. What differs is the gate: the counter's is a whole second by
// default and the meter's is a quarter of one, which is why the meter follows
// a changing frequency sooner and the counter is steadier.
//
// Neither of them samples. Both are told the instant the net crosses the
// trigger level, so the reading does not step in units of anything and a
// frequency a thousand times higher would be counted just as exactly.
//
// Things to try:
//
//   Make C1 1 uF and the frequency drops by ten, to about 48 Hz. The arithmetic
//   above is linear in C, so check it.
//   Make R2 100 k and the duty goes from 67% towards 52%, because the charge
//   path (R1 + R2) and the discharge path (R2) become nearly equal.
//   Press RST on the counter and the pulse total starts again from zero. At
//   about 480 Hz it is up in the thousands within seconds, which is what a
//   counter's TOTAL function is for: counting things that happen, not
//   measuring a rate.
//
// What neither instrument can tell you: there is no noise in here, so there is
// no trigger sensitivity and no false counting on a slow edge, and no input
// bandwidth; a real counter's front end would have opinions about both.

Troubleshooting

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

  • The counter reads zero or nothing. This project
    Check that OUT goes to the counter's IN pin, and that the counter's GND is on the ground rail.
  • The reading is not near 480 Hz. This project
    Check for two 10k resistors and a 100 nF capacitor. A 1 uF capacitor gives about 48 Hz.
  • The 555 does not oscillate. This project
    TRIG and THR must be joined to the capacitor, and RESET must be tied to 5 V.
  • 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.
  • The output does nothing or stays high. NE555 timer
    Pin 8 goes to the supply, pin 1 to ground, and RESET (pin 4) must be tied high. Floating reset is the most common mistake.
  • The frequency is unstable or wrong. NE555 timer
    Tie pin 5 to ground through a 10 nF capacitor. In astable mode f is about 1.44 divided by (R1 + 2 x R2) x C. Watch the polarity of electrolytic caps.
  • 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.