Electronic – Where do overtones in a 555 generated square wave come from

555audiofrequencyspectrum analyzersynthesizer

I have built a 555 oscillator and connected it to a speaker.

Using an oscilloscope I adjusted the 555 to generate a 2.5kHz square wave.

I then held a microphone up to the speaker and fed the input into a spectrum analyser.

What I expected to see was a single peak at 2.5kHz. However, what I actually got was this:

spectrum analyser screenshot showing harmonics every 2.5kHz

My question is, where have these harmonics come from if the 555 is only generating a 2.5kHz signal?

I know that a square can be constructed from sine waves:

diagram showing the sum of sine waves forming a square wave

However, the 555 does not generate sine waves or multiple frequencies, it generates a single square pulse. So where have these harmonic frequencies come from?

Best Answer

When you are holding a hammer, the world looks like a nail.

Roughly speaking, a spectrum analyser captures a time record and represents the resulting capture as a unique linear combination of sinusoids.

It does not mean that whatever generated the signal generated separate sinusoids, only that the resulting signal can be represented in this (very useful) way.

As other answers have pointed out, a square wave can be represented by the sum of sinusoids at odd harmonics, hence the harmonics on your analyser.

There are other systems of representation (cf. Walsh functions) that represent signals in terms of square waves, however these representations are not practical from current perspective. However, if one had a mythical Walsh spectrum analyser and you looked at a sinusoid, your question might then be asking where do all the square waves come from.