A Dedicated Oscillator: The 555 Timer

Today we'll turn our attention to yet another dedicated purpose chip: the 555 timer.  While not the newest or fanciest way of generating signals, it is cheap, reliable, and well-known. While they're kind of a meme in the world of hobbyist electronics, you can do some surprisingly cool things with them like drive ultrasonic transducers to levitate things or amplify signals as part of a geiger counter.  Let's dig into what it does.

The 555 timer is an integrated circuit (IC) that is primarily used to make square waves of a known frequency.  It is a powered device, and therefore requires connections from pin 1 to ground and from pin 8 to a supply voltage ($V_{CC}$, typically +5 V) in order to function.

A diagram of the the pin connections critical for the operation of the 555 timer as a square-wave generator. The positions of the connections have been shifted to comply with typical circuit conventions (positive powering voltages to the top, negative/ground to the bottom, signals in on the left, and signals out on the right).
Why not match the pins to this diagram?

Many integrated circuits are fabricated on essentially a 2d piece of silicon. The way we interface our pin connections to that silicon is often done by bonding tiny gold wires to pads at the edge of the silicon. To avoid having wires cross one another (which could result in unexpected shorts), they're typically connected to whatever pin is closest physically. Since chips are typically manufactured at a massive scale, it is usually worth it to design a compact circuit in silicon that doesn't match up to human conventions in order to save space. More chips per cm${}^2$ means faster production and lower costs. All this is to the best knowledge of the author; there may well be other reasons for this design choice as well.

The 555 timer has two states: on and off

  • The chip begins in the on state, in which $V_{out}$ is equal to the supply voltage ($V_{CC}$), and the discharge ($\mathrm{D}$) is not connected to ground (i.e., there is an open switch between the discharge pin and ground). 
  • When the chip is off, the discharge ($\mathrm{D}$) is connected to ground (i.e., the switch between the pin and ground is closed) and $V_{out}$ is also equal to ground. 

The 555 timer has two inputs, the trigger ($\overline{\mathrm{TR}}$ ) and the threshold ($\mathrm{TH}$), which are typically wired together.  The values of these inputs are compared to specific voltages, and the outcomes of these comparisons determine whether or not the 555 timer changes state. 

  • The trigger ($\overline{\mathrm{TR}}$ ) voltage is compared to $\frac{1}{3}V_{CC}$; if $V_{TR} < \frac{1}{3}V_{CC}$, the chip switches to the on state. 
  • The threshold ($\mathrm{TH}$) voltage is compared to $\frac{2}{3}V_{CC}$; if $V_{TH} > \frac{2}{3}V_{CC}$, the chip switches to the off state. 

Although the threshold and trigger voltages may change the 555 timer’s state, there is no current in or out of either pin (since they effectively have infinite input impedance). There may, however, be current at the other four pins, depending on the configuration.  The reset ($\mathrm{R}$) pin will disable or reset the timer if it is at ground or lower, so it generally is tied to $V_{CC}$ to prevent unwanted behavior.

If you want some practice thinking through the logic of how this works, there is a tutorial exercise available here. This was meant to be done in class as guided practice, but it could still be useful on its own.

Why another new chip?

You might ask yourself why we're introducing new chips, if we can accomplish the same thing with other components we already know how to use.  The answer is twofold: specialized parts tend to do the job better than general ones, and we'd like you to get comfortable learning about how to go about using new components and learning about them from their descriptions and datasheets.  There are thousands upon thousands of different devices out there that can accomplish lots of useful tasks without the need to design a system from scratch, such as the SN74LS247N

which makes driving seven segment displays easy, to the MMA8452Q triple-axis accelerometer, which can be used to tell what direction something is facing or if a device is falling.  Modern circuit design is often a mix of finding the right parts for the job and then adapting them to the situation at hand. 

Building an oscillator

Alright, now that we've talked about what the chip's designed to do, we'll put it to work making an oscillator for us. 

A typical 555 timer astable oscillator.  Note that the pins are not shown in clockwise order around the circuit here.  They have been arranged according to conventions of putting higher voltages towards the top of a diagram and having signals propagate from left to right.  The same circuit, drawn with the pins in counter-clockwise order. The topology is the same, but it requires drawing long, looping connections and doesn't take as well to modifying.

Let's start with a couple of predictions (If you did the tutorial these will be familiar).  Assume the chip initially starts in the on state.

How long will it take the capacitor to charge up to the threshold voltage $\left(\frac{2}{3}V_{CC}\right)$?
After the chip is off, how long will it take the capacitor to discharge enough to turn the chip back on?

Finally, how long will it take in the next cycle for the capacitor to charge from $\frac{1}{3}V_{CC}$ to $\frac{2}{3}V_{CC}$ ?

If you get stuck, look at the “Astable Operation” section (7.4.2) of the datasheet. lm555.pdf   Their schematic is drawn differently, but it has the same topology and thus the circuit is the same)

What is the resulting period of oscillation for this circuit's output?

Now that you have some idea of how the circuit works (or are thoroughly flummoxed), build it on your breadboard so that you can test it.  Note that we don't do anything with pins 4 or 5 for now; that's coming up later.

Characterize the signals you see at both $V_{out}$ and across the capacitor, $V_C$.  Do they behave as expected?

Connect your piezo speaker (shown below) with an inline resistor between $V_{out}$ and ground to listen to the dulcet tones of your circuit.  I'd suggest using a wire you can easily disconnect when wiring this, especially if you don't want your classmates to disconnect it percussively.

Your signal will be distorted somewhat when you attach your speaker, but the effect will be greatly mitigated with the 100$\Omega$ resistor inline with it. This also results in the sound volume being reduced greatly, as you're effectively making about a 10:1 voltage divider. A properly designed transistor circuit would be able to boost the volume substantially, if you want to experiment with this sort of thing in your copious free time.

Our breadboard-ready speaker. There are two pins on the underside, and the entire thing is about the diameter of a quarter. A button designed to straddle the middle channel of the breadboard. The left and right sides are connected when the button is pushed. A schematic of a resistor-speaker network that will not overload our poor 555 timer, and that will be muted when the button isn't pressed.
What do you hear when the speaker is connected?
Predict how the frequency of the sound would change (increase or decrease) if $R_2$ were replaced with a 2.2k resistor

Test your prediction and resolve any discrepancies.

Keep your circuit built, you'll be modifying it throughout the lab. 

Making Square(er) Waves

As you noticed, you get a somewhat lopsided square wave out of this circuit, because the capacitor charges through both resistors but only discharges through $R_2$.  To fix this, we can use our good friend the diode (Use a 1N914, the smaller ones) to make it so that the capacitor charges through $R_1$ and discharges through $R_2$, letting us create a wider array of signals.

A modified circuit that allows for more flexibility in waveform.  Note that the diode will result in slightly slower charging through $R_1$ due to the 0.6 V drop.

Modify your circuit by adding a diode, and observe its behavior.

What effect did adding the diode have on the output's waveform (without the speaker attached)?

What effect did adding the diode have on the speaker's sound?

Modulating the signal

Remember that pin 5 that we told you not to worry about before?  It is the control pin, and it is used to modify the typical trigger and threshold settings by altering a voltage divider circuit.  If we feed a different voltage threshold, then when our input signal is low it will result in the capacitor charging to a lower voltage, (causing quicker oscillations) and when it is higher it will take the capacitor longer to charge, resulting in slower oscillations.

See the wikipedia page for a schematic of the internals. It does include flip-flops, which you haven't encountered yet, and an inverter, which does exactly what you'd think.

Our modulated square wave generator.  The differences are the connection of an input to pin 5, the removal of the diode, and the removal of the resistor in the speaker network.

Use the adjustable power supply for $V_{in}$, using a voltage between between 1 V and 4 V for $V_{in}$. (Why?  Because it behaves fairly well in this regime.)

Do your tests support the idea that higher control voltages lead to the output staying high longer?

Frequency Modulation

To start out with, we're going to modify the circuit in a few ways:

  1. Change the timing capacitor $C$ to 10 pF (yes, pico!)
  2. Changing R1 and R2 back to 1k resistors
  3. Add a 100 nF capacitor between the modulating voltage and pin 5

The first two changes is to up the frequency of the chip's output to 200+ kHz, well outside the audible range. The second will make it so that (when combined with the resistors internal to the timer) we'll effectively make a biased high-pass filter to let our AC signal modify the existing threshold values

A circuit for modulating signals with sine/square waves.  Without the capacitor, we'd want have to manually bias our signal around $\frac{2}{3}V_{CC}$ to keep the behavior similar.

Set the function generator to make a 1k Hz, 5V peak-to-peak square wave, but leave it off for the moment

Predict what parts of the square wave will correspond to higher/lower frequencies.

To make observations a little easier, set the scope to trigger off of this square wave signal.  Test your circuit, and resolve any discrepancies between your predictions and observations.

What happens when you change the frequency and amplitude of the modulating signal?

FIX THE INSTRUCTIONS HERE YOU MORON, the signal is inaudable!

Finally, let's try reconnecting the speaker to the circuit.

To test the difference the modulating signal makes, connect/disconnect the wire that goes to the pin 5 capacitor. (Turning off the channel on the function generator may give unanticipated results)

What difference does the modulating signal make?

You can also try changing the frequency and amplitude of the modulating signal.  For bonus funky noises, go to the menu for your modulating signal and add a linear or log sweep.

What can I do with this?

By modulating one signal with another, you can send information much more reliably than you could with a pure analog signal.  If you transmit a low-amplitude analog signal, you're likely to pick up a lot of unwanted noise along the way.  But, if you use that signal to modulate a square wave, you can keep (much) of the same information while having to worry a lot less about noise, because we've essentially encoded the amplitude of our original signal as a frequency in our carrier. 

This can also be used to play audio over things that were never meant to do so, such as toothbrushes, tesla coils, or (profanity warning) piezoelectrics hidden in electric drills.  More practically, this is what lets the vibration motor in your phone make patterns instead of just buzzing.

In physics, sometimes we'll generate signals that are modulated in a similar manner, such as from a Surface Acoustic Wave (SAW) sensor.  These sensors will reflect back signals of a certain frequency with modifications based on their physical parameters, and can be used for things like high temperature thermometers that don't need wires running directly to them.

Fourier Transforms

Currently under maintenance for 2024.

You've probably noticed that the output for your circuit is scrolling about in some odd ways on the scope, and that its hard to observe sometimes.  Since scopes are mostly designed for signals with a single, known period, combinations will always prove problematic.  Fortunately, these scopes have a built-in Fourier transform option, which will let us get information about the frequency components of our signals even when they're hard to observe otherwise.

Go ahead and disconnect your speaker (if it is connected) and change the input to a 500 Hz, 1V pk-pk square wave. Disconnect or turn off the input to start with, and press the FFT button (just left of channel 1).  Make sure the “source” is set to whichever channel is hooked up to your circuit's output.  You'll want to turn the scale knob counter-clockwise to adjust the frequency space that's being shown until it is at 2.5 kHz per major tick (see the images below)

The Fourier transform display is a plot of the amplitudes of different frequency components of your signal.  For a pure sine wave, you'll expect to see a sharp peak at a single frequency (middle) and then some low amplitude noise.  Since the 555 timer circuit generates a few kHz square wave, the largest component will be the first peak shown, followed by some higher-order components.

A Fourier transform of the square wave generated by the 555 timer.  The most prevalent frequency is at about 2.5 divisions from the side of the screen, which corresponds to about 6.25 kHz.  The next component occurs at around double that frequency, and the next at triple. A Fourier transform of a 500 Hz sine wave.  There's just one prevalent frequency that's 1/5 of a division over, corresponding to 500 Hz. A Fourier transform of a 500 Hz square wave, from the function generator.  Similarly to the signal from the 555 timer, the odd harmonics are more prevalent than the even harmonics.

Your milage may vary depending on how you've set up your system. The most useful thing to do here is to change settings while going back and forth between the $V$ vs $t$ view and FFT to get an idea of how they're correlated.

Identify the strongest frequency component of your circuit when no external input is used.  Is it what you'd expect?

Describe how the output changes when the input is added.

What is the separation between the two most prominent frequency components of your signal when modulated by a 500 Hz sine wave?

Briefly describe the effects of changing the frequency or amplitude of the input signal.

Our scope is not designed for doing sophisticated analysis via FFT. For that you'd want a dedicated spectrum analyzer, which is a much more niche tool. As such, there's a bit of an art to selecting an appropriate frequency binning. Don't agonize over the this last section too much, we primarily want you to learn a bit about how you can get information from an FFT that you can't easily see from the normal operational mode of the scope.

Portions of this page are adapted from “Flexible Resources for Analog Electronics” by Stetzer and Van De Bogart .