Function Generator
Function Generator: How It Works and How to Use It
A function generator is a test instrument that produces a repeatable electrical signal. Instead of powering a circuit with a steady DC voltage, it can create waveforms such as sine, square, triangle, pulse, and sometimes arbitrary shapes. Engineers use these signals to test amplifiers, filters, timing circuits, sensor interfaces, communication inputs, and many other electronic systems.
A function generator is useful because a circuit's response often depends on how a signal changes over time. A filter may pass low frequencies and attenuate high ones; a digital input may respond to pulse width and edge timing; an amplifier may distort a large sine wave even when it handles a small one cleanly. By adjusting frequency, amplitude, offset, and waveform, you can explore these behaviors under controlled conditions.
Instrument capabilities vary. Some generators have a 50-ohm output, a limited maximum amplitude, and a specified load assumption. Others offer isolated outputs, arbitrary-waveform memory, modulation, or multiple channels. Read the manual before connecting the instrument. This guide focuses on low-voltage bench experiments and does not cover injecting signals into live mains circuits or unknown high-energy equipment.
1. The main controls
Waveform selects the shape of the signal. A sine wave changes smoothly, a square wave switches between two levels, and a triangle wave rises and falls linearly in an idealized form. A pulse waveform allows duty cycle or pulse width control. An arbitrary waveform generator can reproduce a user-defined sequence within its sampling rate, memory, bandwidth, and amplitude limits.
Frequency describes how often a periodic waveform repeats, measured in hertz (Hz). One hertz means one cycle per second. Amplitude describes the signal's size, but instruments may display peak, peak-to-peak, or RMS amplitude depending on the waveform and settings. DC offset shifts the waveform up or down relative to zero. Duty cycle describes the fraction of a period for which a pulse or square wave remains at its high level.
Output enable controls whether the signal is present at the connector. Some devices also provide burst, sweep, modulation, phase, channel synchronization, and output impedance settings. Confirm the displayed units and load configuration before enabling output. A mistaken unit, offset, or amplitude can overdrive a circuit even if the frequency looks correct.
2. Frequency, period, and waveform math
Frequency and period are reciprocals: (T = 1/f), where (T) is the period in seconds and (f) is frequency in hertz. A 1 kHz signal repeats every 1 millisecond; a 100 Hz signal repeats every 10 milliseconds. This relationship helps you predict how a waveform should appear on an oscilloscope and choose a sensible time base.
For a symmetrical sine wave centered at zero, peak-to-peak voltage is twice the peak amplitude. RMS voltage for a pure sine wave is peak voltage divided by the square root of two. These relationships do not apply unchanged to every waveform. A square wave's RMS value depends on its levels and duty cycle, and a waveform with DC offset includes a DC component. Always check whether the generator's amplitude readout assumes a particular load.
A 50-ohm output setting is especially important. Some generators display the voltage expected across a matched 50-ohm load. With a high-impedance load, the measured voltage can be approximately twice the displayed value for certain generators and settings. This behavior is model-dependent, so use the manual rather than relying on a blanket rule. The instrument's output may also have limits that vary with frequency and load.
3. Output impedance and load matching
Function generators often use a defined output impedance, commonly 50 ohms, to support predictable signal delivery into compatible equipment. The connected circuit forms a voltage divider with the source impedance. If the load impedance differs from the generator's assumed load, the voltage at the circuit can differ from the display.
For example, a generator configured to show a particular amplitude into a 50-ohm load may deliver a higher voltage into a high-impedance oscilloscope input. A proper 50-ohm termination can make the amplitude match the intended setting, but it also draws more current and may not be appropriate for every circuit. Check both the generator and oscilloscope input specifications before adding a terminator.
Do not confuse a generator's output impedance with a guarantee that it can safely drive any 50-ohm load at any frequency. Maximum amplitude may decrease at high frequencies, and the output stage has voltage and current limits. If a circuit requires a high input impedance or a special termination, follow its design documentation. Never connect outputs of two active signal sources together unless a documented method specifically permits it.
4. Safe connection procedure
Before connecting the generator, identify the circuit's input limits and reference point. Confirm the allowed voltage range, whether the input can tolerate negative voltage, and whether it expects AC coupling, DC coupling, or a biased signal. Keep output disabled while connecting the coaxial cable or test leads. Connect the signal to the intended input and the reference lead to the circuit's designated signal ground.
Start with a low amplitude and a frequency appropriate to the circuit. Use zero DC offset unless the circuit requires a specific bias. Enable the output, observe the result, and increase the signal only as needed. If the circuit input is designed for 0–3.3 V logic, a generator output that swings below ground or above 3.3 V may damage it. A generator's bipolar waveform is not automatically compatible with a microcontroller input.
Use a suitable probe or oscilloscope to confirm the signal at the circuit, not just at the generator display. Avoid loose clips that can short adjacent pins. Turn the output off before changing connections or moving to a different circuit. If you do not know the circuit's input limits, do not apply a signal until you have identified the component or obtained the schematic.
5. Testing a resistor-capacitor filter
A simple RC low-pass filter is a useful introductory experiment. Connect a resistor in series with the signal source and a capacitor from the output node to circuit ground, using component values and voltage ratings suitable for the signal. Measure the output across the capacitor with an oscilloscope or other instrument whose input impedance will not significantly alter the circuit. Keep the generator amplitude low and confirm that the offset is appropriate.
The approximate cutoff frequency of an ideal first-order RC low-pass filter is (f_c = 1/(2\pi RC)). With a 10 kΩ resistor and a 10 nF capacitor, the nominal cutoff is about 1.59 kHz. Below the cutoff, the output amplitude is relatively close to the input; above it, the output becomes increasingly attenuated. Real component tolerances and instrument loading affect the measured result.
Sweep frequency in sensible steps, recording the input and output amplitudes. Avoid changing several settings at once, because it becomes difficult to determine what caused a result. This exercise demonstrates how a known stimulus reveals a circuit's frequency response. It also teaches why the generator's output impedance, the oscilloscope probe, and the ground connection can influence measurements.
6. Square waves, digital circuits, and pulse width
Square waves are useful for examining switching behavior, logic inputs, clock circuits, and edge response. Their fast transitions contain frequency components well above the repetition frequency, so a circuit's behavior depends not only on the displayed frequency but also on edge rise time, bandwidth, wiring, and input capacitance. Long test leads can introduce ringing or overshoot that is absent from an ideal drawing.
A duty cycle of 50% means the signal is high for half of each period. Pulse-width modulation changes the high-time fraction and is commonly used in control applications. A function generator can help test a low-voltage input, but only when its voltage levels match the target circuit. Check the logic thresholds, absolute maximum ratings, and whether the input includes pull-up or pull-down circuitry.
Do not drive a microcontroller pin with a negative voltage or a level above its permitted range. For an ESP32, verify the exact device and board specifications; its GPIO is not generally 5 V tolerant. Use a suitable level shifter, divider, buffer, or protection circuit when required, and account for the effect each one has on edge shape. Never assume that a generator's TTL or CMOS label makes every output level compatible with every logic family.
7. Using a function generator with an oscilloscope
The generator creates a stimulus; the oscilloscope shows what actually happens. Connect the generator output to the circuit input and probe the circuit response using the scope's specified input and probe arrangement. Start with a time base that displays several cycles, then adjust it to inspect transitions or small waveform details. Set vertical scale so the waveform is visible without clipping the display.
Use the scope's measurement functions as a convenience, not as a substitute for understanding the waveform. Read peak-to-peak voltage, frequency, period, rise time, or duty cycle where appropriate. If a measured amplitude differs from the generator setting, check the load assumption, output impedance, probe attenuation setting, coupling mode, offset, and termination before concluding that the circuit is faulty.
Oscilloscope ground clips on many bench scopes are connected to protective earth. Connecting such a clip to an arbitrary circuit node can short that node to earth and create a hazard or damage equipment. Use the scope manual and a safe measurement arrangement; differential probes or properly rated isolated instruments may be necessary for some measurements. Do not defeat a scope's protective earth or use it on exposed mains circuitry as a beginner experiment.
8. Common mistakes and troubleshooting
The amplitude is twice the expected value. Check whether the generator is configured for a 50-ohm load while the circuit or scope input is high impedance. Read the manual and measure at the load.
The waveform has a DC shift. Inspect the offset setting and any bias network in the circuit. A coupling capacitor can remove DC, while a direct connection can pass it through.
The square wave looks rounded. The circuit bandwidth, probe capacitance, output rise time, or load may be limiting the edges. Check probe compensation and use appropriate cable and termination.
The output appears noisy. Confirm the cable and ground reference, reduce unnecessary lead length, and check whether the signal amplitude is small compared with environmental noise. Avoid creating multiple unintended ground paths.
The circuit does not respond. Verify the generator is enabled, the correct connector is used, frequency and amplitude are within the circuit's operating range, and the signal reaches the intended input. Confirm pinout and reference ground with power off before rewiring.
The microcontroller resets or becomes hot. Disable the signal immediately. The input may be overvolted, a reference connection may be wrong, or the generator may be driving a powered circuit in an unintended way. Never keep increasing amplitude to force a response.
9. Choosing a generator for a workbench
For basic learning, prioritize a clear display, stable frequency, adjustable amplitude and offset, common waveforms, and an output-enable control. Check the frequency range and amplitude limits at the frequencies you actually need; a headline maximum frequency does not guarantee full amplitude or good waveform quality at that limit. Read specifications for distortion, rise time, frequency accuracy, and output impedance if those characteristics matter to your work.
An arbitrary-waveform generator is useful when testing a repeatable sensor waveform, a custom pulse train, or a more complex stimulus. It may offer a sampling rate, memory depth, and waveform resolution that constrain what it can reproduce. More advanced modulation or dual-channel features are valuable only when the experiment needs them.
Also budget for quality coaxial cables, suitable adapters, termination resistors, and probes. A high-spec instrument with poor connections can produce misleading results. Verify calibration status if the measurements are used for formal testing, and never assume that a low-cost instrument is suitable for safety-critical verification. For hobby projects, repeatability and a clear understanding of limitations are often more valuable than the largest number printed on the front panel.
10. Practice plan and checklist
Try these exercises in order:
- Generate a low-amplitude sine wave at 100 Hz and measure its period on an oscilloscope.
- Increase frequency to 1 kHz and confirm that the period decreases by a factor of ten.
- Switch to a square wave and compare the observed high and low levels with the selected amplitude and offset.
- Build a low-voltage RC filter and record how output amplitude changes as frequency moves below and above the calculated cutoff.
- Observe a safe digital input waveform, making sure all voltage levels remain within the target device's documented limits.
Before every experiment, verify the waveform, frequency, amplitude units, DC offset, load setting, output enable, cable connections, and the circuit's maximum input ratings. Keep the generator output disabled while wiring, use short and secure connections, and stop if the measured behavior is unexpected. Check the scope's grounding arrangement before connecting its probe ground to a circuit.
A function generator is a controlled way to ask a circuit a question: “How do you respond to this signal?” The quality of the answer depends on choosing the right stimulus, measuring the response correctly, and understanding the limitations of the instruments and circuit. With conservative settings and a repeatable method, it becomes an essential tool for learning analog behavior and testing digital timing without guesswork.