Where do overtones in a 555 generated square wave come from?
I know that a square can be constructed from sine waves. 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?
Congratulations on your explanation of what you are seeing and your experimentation.
The key issue is that not only CAN a square wave be constructed from sine waves, it fundamentally IS a collection of sine waves.
You can generate a square wave by summing appropriate sine waves, but, however you do it, what you arrive at IS a waveform that can be represented by a collection of sine waves.
In ideal circumstances you would not expect to see on the spectrum analyser quite what you show, but impedance matching and a 555 and .... can easily combine to produce a non ideal result.
A square wave = a summation of \$ f + \frac{3f}{3} + \frac{5f}{5} + \frac{7f}{7} + ...\$ (if my brain has correctly retrieved the relevant long ago stored facts). So you would expect to see every second harmonic, and amplitudes should decrease.
A square wave can be viewed as a sum of the odd harmonics of a single frequency.
A square wave can be generated by summing a bunch of sine waves.
A square wave can also be generated by simply toggling the power on and off at the primary frequency of the square wave.
In either case, the spectrum will look the same.
You cannot tell how a square wave was generated by looking at the spectrum.
The simple act of turning the power on and off generates the primary frequency, but it also generates the harmonics.
Your spectrum shows even as well as odd harmonics.
The even harmonics are an artifact of distortion coming from your microphone or the microphone amplifier. Too much gain or the microphone too close to the speaker. Alternatively, the signal from the 555 caused distortion in the speaker.
In any case, you should only see odd harmonics (2.5kHz, 7.5kHz, 12.5kHz, etc.) for a 2.5kHz square wave. The even harmonics (5kHz, 10kHz, etc.) are not part of the square wave.
Connect the 555 output to the line in of your PC. You may need to use a voltage divider to reduce the level.
That should be cleaner, and closer to an undistorted square wave.
Baudline (the spectrum analyser you are using) has an oscilloscope view. Use it to check if your square wave is distorted. Check the signal from the speaker and microphone setup as well as the direct connection to the 555.
What I expected to see was a single peak at 2.5kHz.
I don't know why. You need to reset your expectations.
Think of this this way: If you just had a single peak, then the input would by definition be a sine wave. But you're feeding it a square wave, so how do you account for the difference?
I know that a square can be constructed from sine waves.
Change that to: A square wave is equivalent to an infinite series of sine waves. That's what the math of Fourier analysis is all about.
the 555 does not generate sine waves or multiple frequencies, it generates a single square pulse.
They are exactly equivalent. So it's actually doing both.
So where have these harmonic frequencies come from?
You can think of them as "coming from" the fast edges on the square waves. You can see in your own graphs that as you consider higher harmonics, the edges of the sum get steeper. In the limit (infinitely many harmonics), the edges become vertical.