## Harmonic frequencies

26 posts / 0 new
Author
Message

I sometimes play with simple medium wave receivers for my grandson.

As there is a very weak signal in our flat, I recently made a simple signal generator with Avr.

It produces a square wave frequencies modulated with 1 kHz (also square wave).

I used a MW ferrit antenne coil as the load.

It worked well but something confused me.

When I set 200 kHz, I expected to receive harmonic frequencies at 200, 400, 600, 800, 1000 etc. kHz.

But surprisingly I found only odd harmonics 200, 600, 1000, 1400.

The even ones are extremely weak (if any). See the picture below.

I would like to know why it is so.

Visovian wrote:

But surprisingly I found only odd harmonics 200, 600, 1000, 1400.

Correct. Rather than me type a long reply, have a look here...

https://en.wikipedia.org/wiki/Sq...

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

That is exactly right.  A square wave is composed of the odd harmonics.

Note the (2k-1) where k = 1,2,3, ... resulting in 1,3,5, ...

Thank you,

So all my life I lived in a wrong belief that the square signal contains all harmonics.

I feel unhappy.

Visovian wrote:

Thank you,

So all my life I lived in a wrong belief that the square signal contains all harmonics.

I feel unhappy.

But living with this ignorance all this time has not caused you to lose hair, or your cat to die, or your Bascom code to fail has it? Rejoice! Even the occasional gravitational wave has passed through you... and me, during our lifetimes without disturbing us.

Ross McKenzie ValuSoft Melbourne Australia

Valusoft,

In fact it is not so bad with me.

It is the infinite impulse, know in math as Dirac delta function, is a pulse of high amplitude and short duration, that has all harmonics. The perfect signal for emi.

It all starts with a mental vision.

Last Edited: Sat. Feb 13, 2016 - 12:32 PM

I seem to remember... square waves have odd harmonics that roll off at 6dB per octave, and triangle waves have odd harmonics that roll off at 12 dB per octave.

Imagecraft compiler user

Yep!  And sawtooth (ramp) waves also have all harmonics that fall off at -20 dB/decade (-6dB/octave).

The cool thing with the OP's signal generator is that by playing with the duty cycle of the rectangular wave carrier, he can shift more energy into different bands, by changing where the nulls are -- if that's important.

Mike

I lived in a wrong belief that the square signal contains all harmonics.

That is partly true.

Remember the odd harmonics exist for all odd integers to infinity, (sort of "all", just missing a few...).

JC

Since we're talking about harmonics of square waves here, I have a question about the bandwidth of scopes necessary to properly display a square wave of a certain frequency.

I always thought that the scope needs to cover the 5th harmonic to correctly display the square wave.  So for a 20MHz square wave, the scope needs 100MHz bandwidth.

Is that correct.  Does anyone have any scope traces that show what a 20MHz square wave look link on 50MHz vs 100MHz scopes?

if you need all harmonics just make the DC value different from 0. :)

needs to cover the 5th harmonic

How good is "good enough"?

My goal has generally been to capture up to the 10th harmonic of periodic waveforms.

I can do that easily when I'm working with low frequency signals, (EKG, for example).

But, for a lot of signals my gear won't capture the 10th harmonic.

Oh well, so be it.

A lot depends upon your work, what signals are you looking at, and what can you afford?

Back in the day, 20 MHz was considered "RF" work.

These days its the clock for the micro...

Anyways, in practice it is very rare to have to actually look at the 20 MHz clock signal.

On a micro it is easy to divide the clock and output the result on an I/O pin.

You can now look at Clock/1024, or whatever you want, easily.

If you wish to do real RF work, then open up your wallet.

The test gear is expensive.

JC

Last Edited: Mon. Feb 15, 2016 - 04:53 PM

Chuck99 wrote:

Does anyone have any scope traces that show what a 20MHz square wave look link on 50MHz vs 100MHz scopes?

A couple of minutes in Excel and you can make you own...

...showing up to 11th harmonic.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

Thank you Brian.  That's a very nice graphic.

Take a look at the orange trace, which clearly shows a sinusoidal wave in the top and bottom part of the square wave.  I've never seen that on a scope trace.  What I do see is reduced rise and fall times as well as the overshoot and undershoot which can also be caused by reflections.

What complicates this is that a scope with 100MHz BW doesn't drop to zero at 100MHz + 1Hz.  I don't know what the roll-off is for a scope.  Typical amplifiers have a roll-off of 20dB/decade.  Also, the scope BW of 100MHz might be minimum guaranteed BW.

I was just wondering if people had any experience and examples of what to expect for a given scope bandwidth.

DocJC wrote:

Back in the day, 20 MHz was considered "RF" work.

Yes, and way back in the day 3MHz was 'High Frequency'.

Times change.  It's called progress.

Anyways, in practice it is very rare to have to actually look at the 20 MHz clock signal.

But I do.  Others do also.  Not so rare.

If you wish to do real RF work, then open up your wallet.

The test gear is expensive.

Not RF work, but I do work with square waves at 20MHz and above.  And yes, the gear can be expensive.  I have a DSO with 200MHz analog bandwidth.  (Application of the old axiom "Buy as much bandwidth as you can afford".)

Again, I was wondering how one can estimate the performance of a scope based on the specified analog bandwidth.

Well, you mentioned a rule of thumb, my rule of thumb is twice the analog BW you suggested.

But, for DSO's, other factors than the analog BW come into play, the two most important being the sample rate, and the sample depth, (memory); (and of course the number of channels, and all analog or mixed signal, and trigger options, and, and, and...).

The sample rate tells you how many dots the DSO is going to paint on the screen per second.

To make the point, sampling a 10 Hz sin wave with a 200 MHz BW front end should be way more BW than is needed.

But if the sampling rate is only 100 S/Sec, then there will only be 10 dots painting each period of the sin wave.

That gives a pretty poor display of the sin wave.

As the S/Sec increases, the ability to see sharp rise and fall times increases.

You can't see a rise time shorter than two sequential dots on the display, regardless of the analog front end's BW.

The memory is critical depending upon how close to the signal of interest you can trigger the scope, and how long does the signal of interest last.

Anyway, on a DSO I think the analog front end BW is important, and can certainly be a limiting factor, but it is tightly connected to the sampling rate when it comes to actually displaying a meaningful signal.

On an old analog scope the analog front end told the whole story, not so with a DSO.

JC

DocJC wrote:
The sample rate tells you how many dots the DSO is going to paint on the screen per second.

Not quite! The sample rate is the number of samples per second it puts into memory - what goes onto the screen is somewhat slower and may have a variety of functions imposed upon it - persistence, interpolation etc.

My Tek 2465 is starting to show his age, but go old analog 'scopes are less likely to lie to you. One day I might get around to fixing the psu - the screen is a little shaky until it warms up.

Agreed.

It is, however, the best case scenario when you expand the display to look at a signal's rise time and over shoot, for example, or want to look at the high freq noise present in a filter output.

It can't display what isn't in its memory.

I think one has to be very careful with interpolation.  But that's another full discussion.

Interpolated data is to make your brain happy with a pretty image.

The interpolated data points may or may not have anything to do with the reality of the actual signal being examined.

JC

Chuck99 wrote:
I have a question about the bandwidth of scopes necessary to properly display a square wave of a certain frequency.

I always thought that the scope needs to cover the 5th harmonic to correctly display the square wave.

Signal Consulting

High-Speed Digital Design Online Newsletter: Vol. 11 Issue 03

by Dr. Howard Johnson

http://www.sigcon.com/Pubs/news/11_03.htm

...

(near bottom of the page)

The most commonly used rule of thumb for determining the bandwidth you need depends on the effective rise/fall time of the measuring instrument.

...

XMEGA I/O rise time is 4ns typical; 2.7ns typical for SPI.

"Dare to be naïve." - Buckminster Fuller

Thank you gchapman.  That's just the type of info I was looking for.

DocJC wrote:
A lot depends upon your work, what signals are you looking at, and what can you afford?

Back in the day, 20 MHz was considered "RF" work.

These days its the clock for the micro...

Siglent SDS1102CML oscilloscope

July 14, 2014

http://www.embedded.com/electronics-blogs/break-points/4432282/Siglent-SDS1102CML

...

If you need more than a few MHz of bandwidth – and even a mid-level hobbyist does - ...

...

Siglent is one of several Chinese vendors of these devices, and they kindly sent me a unit. I asked for one of their lower-end instruments, one where the price is attractive to a wide range of users and where there’s little competition from the big scope vendors. They sent an SDS1102CML, a dual channel 100 MHz digital scope.
...

The SDS1102CML retails for \$379. At that price I figured it might be OK for hobbyist work but would be disappointing to a pro.

I was wrong.

...

That model's product range nearly covers a megaAVR (i.e. bandwidth).

May or may not need much waveform memory; if looking at analog signal quality (rise time, fall time, spectrum, etc.) then modest waveform length.

Might use a logic analyzer for the remainder.

SIGLENT Technologies America, Inc

SDS1000CML Series Digital Storage Oscilloscopes

http://www.siglentamerica.com/pdxx.aspx?id=27&T=2&tid=1

"Dare to be naïve." - Buckminster Fuller

Last Edited: Wed. Feb 17, 2016 - 10:10 AM

I always thought that the scope needs to cover the 5th harmonic to correctly display the square wave.

A 100 MHz scope won't stop responding to signals higher than 100 MHz.  As you have noted, the bandwidth figure quoted is the -3 dB 'knee'.

Here's what a square wave looks like when put through a fist order low pass Butterworth filter with the -3 dB knee at five times the square wave's fundamental:

Is this correct?  I suppose it is, for a certain value of 'correct'.  A particular scope will exhibit its own filter curve, perhaps behaving like a second (or higher) order filter of some other type.  YMMV.

However, 5x is better than 1x:

 "Experience is what enables you to recognise a mistake the second time you make it." "Good judgement comes from experience.  Experience comes from bad judgement." "Wisdom is always wont to arrive late, and to be a little approximate on first possession." "When you hear hoofbeats, think horses, not unicorns." "Fast.  Cheap.  Good.  Pick two." "We see a lot of arses on handlebars around here." - [J Ekdahl]

joeymorin wrote:

I always thought that the scope needs to cover the 5th harmonic to correctly display the square wave.

A 100 MHz scope won't stop responding to signals higher than 100 MHz.  As you have noted, the bandwidth figure quoted is the -3 dB 'knee'.

Here's what a square wave looks like when put through a fist order low pass Butterworth filter with the -3 dB knee at five times the square wave's fundamental:

Thanks joey.  I should have said "needs to cover at least the 5th harmonic".

The plot you showed for a filter that covered the 5th harmonic does indeed look like a square wave to me.

Could you show similar plots for 3rd and 7th harmonics with the fist order low pass Butterworth filter?

Could you show similar plots for 3rd and 7th harmonics with the fist order low pass Butterworth filter?

3rd:

7th:

 "Experience is what enables you to recognise a mistake the second time you make it." "Good judgement comes from experience.  Experience comes from bad judgement." "Wisdom is always wont to arrive late, and to be a little approximate on first possession." "When you hear hoofbeats, think horses, not unicorns." "Fast.  Cheap.  Good.  Pick two." "We see a lot of arses on handlebars around here." - [J Ekdahl]