When testing the response of many pulse-width-modulated (PWM) systems, there's a need to independently vary a multivibrator's frequency and duty cycle. Such systems include dc motors, ultrasonic hydrophones, and piezo-ceramic transducers. The figure shows a simple way to vary duty cycle and frequency independently. The circuit is based on the ubiquitous LM339 comparator with output frequency ranging from 5 to 15 kHz, and the duty cycle between 0% and 100%.
U1a is configured as an ordinary free-running square-wave generator whose frequency is 1/fO = C × ln4. But the voltage across capacitor C is the input to the second comparator. It can be shown that VC ramps from VCC/3 to 2VCC/3. U1b is a variable-threshold detector whose trip point can be anywhere from VCC/3 to 2VCC/3. Adjusting R4 varies the output's duty cycle between 0% and 100%. Frequency is adjusted with R2. The system's timing characteristics are independent of VCC, which can span anywhere from 2 to 28 V. The two pullup resistors have a value of 1k.