DEV Community

Ashen Chathuranga
Ashen Chathuranga

Posted on

Why Square Waves Create Many Frequencies

Understanding Digital Noise Using the Water Wave Analogy


1. The Core Confusion

A very common question in electronics is:

“If a square wave has one frequency, how does it create many other frequencies?”

At first glance, this feels contradictory. But the confusion comes from mixing up repetition rate with frequency content.

To make this intuitive, we’ll start with a water wave analogy, then slowly connect it to the real technical explanation.


2. The Water Wave Analogy

Calm Water

Imagine a perfectly calm lake. The surface is flat. Nothing is moving.

This is like DC voltage — no frequency at all.


Smooth Hand Motion → Single Frequency

Now gently move your hand up and down smoothly in the water.

What happens?

  • Clean, smooth waves
  • One dominant wave size
  • Predictable motion

This is like a sine wave:

  • Smooth voltage change
  • One frequency
  • Very little interference

Sudden Slap → Many Frequencies

Now instead of moving smoothly, slap the water once.

What do you see?

  • Large slow waves
  • Medium-sized ripples
  • Tiny fast ripples
  • Splashing in many directions

One single action created many wave sizes at the same time.

This is the key idea.

Sudden changes create many waves


Repeated Slaps → Square Wave

A square wave is like slapping the water repeatedly at a fixed rate:

SLAP   SLAP   SLAP   SLAP
Enter fullscreen mode Exit fullscreen mode

Even if the slaps happen at a steady rhythm:

  • Each slap still creates

    • slow waves
    • fast ripples
    • very fast ripples

So although the rate is fixed, the wave content is broad.


3. Translating the Analogy to Electronics

Repetition Rate vs Frequency Content

When we say:

  • "This is a 1 MHz square wave"

We are only talking about:

  • How often the wave repeats

Not what frequencies it contains.


Sharp Edges = Fast Change

A square wave looks like this:

_|‾|_|‾|_|‾|
Enter fullscreen mode Exit fullscreen mode

Notice the instant vertical edges.

In physics:

Faster voltage change → higher frequencies

An instant edge means:

  • Infinite speed (theoretical)
  • Infinite frequency components (theoretical)

In reality, edges are limited — but still very fast.


4. The Technical Explanation (Fourier Concept)

Any repeating signal can be broken into sine waves.

A square wave is equivalent to:

  • Fundamental frequency (f)
  • 3×f
  • 5×f
  • 7×f
  • 9×f
  • … continuing upward

Example:

A 100 kHz square wave contains energy at:

  • 100 kHz
  • 300 kHz
  • 500 kHz
  • 700 kHz
  • 900 kHz
  • into the MHz range

These are called harmonics.


5. Why Digital Devices Create Radio Noise

Raspberry Pi / Arduino Example

  • GPIO pins switch very fast
  • Output square waves
  • No built-in RF filtering

The connecting wires:

  • act like antennas
  • radiate the harmonics

This is exactly like water ripples spreading outward.


Why AM Radios Are Affected

AM radios:

  • detect amplitude changes
  • are sensitive to wideband noise

Square-wave harmonics fall directly into AM bands, causing:

  • buzzing
  • whining
  • clicking sounds

6. Why Sine Waves Are Clean

Signal Type Edge Speed Harmonics RF Noise
Sine wave Smooth None Very low
Triangle wave Medium Some Medium
Square wave Instant Many High

7. How Engineers “Calm the Water”

To reduce noise, engineers:

  • slow down edges
  • add RC filters
  • add capacitors near power pins
  • use ferrite beads
  • use shielding

In water terms:

Filters turn slaps into smooth hand movements


8. One-Sentence Summary

A square wave has one repetition rate, but its sharp edges force nature to include many frequencies — just like a water slap creates many ripples.


9. Memory Trick

Smooth motion → clean wave
Sudden motion → many waves

Top comments (0)