Signal Generators

A signal generator produces a controlled electrical signal — sine, square, triangle, or arbitrary waveform — at a specified frequency and amplitude. They're essential for electronics testing and development: you need a known, clean signal to characterise a filter, test an amplifier's frequency response, verify ADC sampling, or inject a tone into an audio circuit. Understanding what's available (from the humble 555 to a modern DDS bench instrument) lets you pick the right tool for the job.

Types of Signal Generators

TypeFrequency rangeOutput waveformsAccuracyCost range
555 timer (astable)1 Hz – ~500 kHzSquare (approximate)Poor (±10–20%)Cents
MCU PWMDC – ~1 MHzSquare (+ filtered sine)Moderate (crystal-limited)Already have one
AD9833 DDS module0 – 12.5 MHzSine, triangle, squareGood (±0.1 Hz)$2–5
Si5351 clock gen8 kHz – 160 MHzSquare (3 independent outputs)Good$5–10
Analog bench function gen0.1 Hz – 20 MHzSine, square, triangle, rampGood (DDS-based internally)$50–500
AWG (arbitrary waveform gen)DC – GHz rangeAny user-defined waveformVery good$200 – $50,000+
RF signal generator100 kHz – 40 GHzModulated RF carrierExcellent (synthesised)$500 – $100,000+

Function Generators

The classic bench instrument for audio and RF development. Modern function generators are DDS-based internally — a DAC clocked at high speed reads a waveform lookup table, producing the output frequency and shape. Key specs to look for:

SpecWhat to look forWhy it matters
Max frequencyAt least 10× your highest frequency of interestSquare wave edges contain harmonics well above fundamental
Frequency resolutionµHz to mHz resolution in DDS instrumentsFine-tune beat frequencies, PLL testing
Amplitude range1mVpp to 10–20VppInjecting signals into sensitive circuits needs small amplitudes
DC offsetAdjustable ± supply rangeBiasing signals to ADC input range, testing with DC component
Output impedance50Ω (standard)Matches coaxial cable and RF equipment; affects amplitude at load
ModulationAM, FM, PM, sweepTesting receiver sensitivity, PLL lock range, filter characterisation

AD9833 — Cheap DDS Module

The AD9833 is an SPI-controlled DDS IC producing sine, triangle, or square waves
from DC to 12.5 MHz with 28-bit frequency resolution.

Frequency register = f_desired × 2^28 / f_MCLK

Example (f_MCLK = 25MHz):
  1 kHz:  FREQ_REG = 1000 × 268435456 / 25000000 = 10,737
  10 kHz: FREQ_REG = 10000 × 268435456 / 25000000 = 107,374
  1 MHz:  FREQ_REG = 1000000 × 268435456 / 25000000 = 10,737,418

SPI write sequence (16-bit frames):
  1. Write control register (reset, waveform type)
  2. Write lower 14 bits of frequency word
  3. Write upper 14 bits
  4. Release reset — output begins

Si5351 Clock Generator

Three independent clock outputs, each 8kHz – 160MHz.
Commonly used as a variable frequency oscillator (VFO) for radio.

Control via I2C:
  PLL A and B: each multiplied from crystal reference (25 or 27MHz)
  Each output: divided down from PLL

Output frequency = (f_xtal × a + b/c) / d
  where a, b, c, d are programmed dividers

Libraries (Si5351Arduino by NT7S) handle all the register math:
  si5351.set_freq(1000000ULL * 100, SI5351_CLK0);  // 100 MHz on CLK0

555 Timer as Signal Generator

555 Timer Astable Circuit Standard 555 astable oscillator. Resistors RA and RB in series with capacitor C to ground. Pin 7 connects between RA and RB, Pins 2 and 6 connect between RB and C. VCC RA PIN 7 (discharge) RB PIN 2, 6 (threshold/trigger) C
555 timer astable circuit: RA, RB, and C connect to the discharge and threshold/trigger pins to set the output frequency and duty cycle.
f = 1.44 / ((RA + 2×RB) × C)
Duty cycle = (RA + RB) / (RA + 2×RB)

Note: standard 555 cannot achieve exactly 50% duty cycle in astable mode.
Use TLC555 or LMC555 (CMOS) with equal R and steering diodes for 50%:
555 Timer 50% Duty Cycle Modified 555 oscillator with steering diodes D1 and D2 to independently control charge and discharge paths. VCC RA D1 D2 RB PIN 7 C
Modified 555 timing network: steering diodes D1 and D2 separate the charge and discharge paths so equal timing resistors can produce an approximately 50% duty cycle.
Charge: through RA, D1 (bypasses RB)
Discharge: through RB, D2 (bypasses RA)
With RA=RB: duty ≈ 50%

Microcontroller as Signal Generator

PWM Square Wave

Any MCU with a timer peripheral can generate square waves:

Arduino (hardware PWM, pin 9):
  TCCR1B = (TCCR1B & 0xF8) | 0x01;  // no prescaler, ~31kHz base
  analogWrite(9, 127);               // ~50% duty, ~31kHz

Or: direct tone():
  tone(9, 1000);   // 1kHz square wave on pin 9, blocking

For precise frequency: use ICR1 mode (16-bit timer):
  ICR1 = F_CPU / (prescaler × frequency) - 1

Sine Wave via DAC + Low-Pass Filter

Generate sine wave from lookup table via DAC:
  1. Create table of N samples per cycle: sine_table[N]
  2. Output each sample via DAC at rate f_sample
  3. Sine output frequency = f_sample / N
  4. Low-pass filter after DAC removes step artifacts

Arduino Uno with R-2R DAC (8-bit, 8 pins):
  f_sample ≈ 40kHz (limited by loop speed + DAC settling)
  For 1kHz sine: N = 40 samples per cycle

Raspberry Pi Pico with 12-bit DAC (MCP4725):
  f_sample up to ~100kHz via DMA
  For 1kHz: 100 samples per cycle, very clean output

Scope Usage with Signal Generator

MeasurementSignal generator settingScope setup
Filter frequency responseSweep frequency, constant amplitudeMeasure output amplitude at each frequency; plot
Amplifier gainKnown amplitude at target frequencyCompare output to input — gain = Vout/Vin
Amplifier distortionSine at rated frequency and amplitudeFFT mode on scope — harmonics show distortion
ADC sampling testSine at known frequency below NyquistSample and reconstruct — check for aliasing
RC time constantLow-frequency square wave (period >> 5τ)Watch exponential charging on scope

References