Frequency, pulse shape and pitch
Build a tone from two levels
Pitch is how high or low a sound seems. Frequency f counts cycles per second; Hz (hertz) means one cycle per second. A rectangular wave switches between 0 and V; at 50% duty it is a symmetric square wave. Duty D is the percentage spent high. Period T lasts one cycle; ms is millisecond, 1/1000 second.
EXPERIMENT BENCH
Change the circuit settings, predict the readings, then check a challenge. These are learning models, with the assumptions explained in each lesson.
Sign in to save progress. Guest progress stays on this device.
Why it works
Piezo means piezoelectric: voltage changes a material’s shape so it can vibrate and make sound. The lab models electrical timing and mean voltage, not piezo loudness or current. Optional playback is a short browser tone, not a physical piezo model. Devices may sound different at the same frequency.
Piezo is short for piezoelectric: a material changes shape with voltage and can vibrate air into sound. Here V is the high level in volts, D the high-time percentage and Vmean the time average. Changing D changes pulse shape, not f. At 50% both levels last equally long.
Difficulty
Build · Build it
Power on with f = 200 Hz, D = 50% and V = 5 V. Get T = 5 ms and Vmean = 2.5 V.
Need a hint?
f = 200 Hz; D = 50%; V = 5 V → T = 5 ms; Vmean = 2.5 V
Explore · Change the command
Set f = 1000 Hz, D = 25% and V = 5 V. Get T = 1 ms and Vmean = 1.25 V.
Need a hint?
f = 1000 Hz; D = 25%; V = 5 V → T = 1 ms; Vmean = 1.25 V
Solve it · Solve the challenge
Set f = 500 Hz, D = 75% and V = 4 V. Get T = 2 ms and Vmean = 3 V.
Need a hint?
f = 500 Hz; D = 75%; V = 4 V → T = 2 ms; Vmean = 3 V
Extra reading and circuit recipes
Build a tone from two levels
One repeated on-and-off pattern can become a beep. First predict its timing on the trace; then, if browser playback is available, listen to the frequency.
T = 1000 / f ms; Vmean = V × D / 100
One cycle is high for D% of its duration and zero for the rest. The average is V times that fraction. Frequency controls cycle timing; the acoustic response also depends on the sound device.
A useful pattern
Doubling frequency halves period: 200 Hz has 5 ms cycles, while 400 Hz has 2.5 ms cycles. Neither change requires a different pulse height.
Beyond the model
A real piezo has mechanical resonances and a frequency-dependent response. Mean electrical voltage alone cannot tell you its sound level.
A useful trap to avoid
A 2.5 V mean does not mean the wire stays at 2.5 V: this waveform alternates between 0 and 5 V. More mean voltage is not a universal rule for a louder tone.
Keep f = 200 Hz and V = 5 V, but change D from 50% to 25%. What happens?
- T stays 5 ms; Vmean becomes 1.25 V
- T becomes 2.5 ms
- frequency becomes 100 Hz
Read more
Duty shortens high time within the same cycle. The mean falls, but the cycle frequency is unchanged.
Build it
Set 200 Hz, 50% and 5 V. Equal high and low intervals give a 2.5 V mean.
f = 200 Hz; T = 5 ms; Vmean = 2.5 V
Change the command
Set 1000 Hz, 25% and 5 V. The cycle is 1 ms long, high for 0.25 ms, with a 1.25 V mean.
f = 1000 Hz; T = 1 ms; Vmean = 1.25 V
Try another path
Keep 5 V and 50%, compare 200 and 400 Hz, and predict the period first. Then hold frequency fixed and change duty: distinguish pulse shape from repetition rate.