Created by
Created February 04, 2012
Last modified June 07, 2017
Tags 555   pwm  

Summary

A 555 Timer can be used with variable "control" input to create a pulse width modulation (PWM) generator with its digital duty cycle varying based on an analog input voltage.


Description

The 555 timer chip has been a staple of electronics tinkerers for decades as it can be configured into a wide range of different modes with just a handful of external components. Here, by varying the internal setpoints using the 555's "control" pin, we can make an adjustable pulse width generator. Every time the "trigger" pin pulses low briefly, the 555's output switches to be high, and the discharge transistor is disabled, so C1 charges through R1. It keeps charging until its voltage is above the "control" pin voltage, at which point the 555 changes states. The output goes low, and the discharge transistor is activated, nearly immediately discharging C1. Therefore, the width (in time) of the output pulse is determined by the control voltage! By putting a constant stream of brief low-going pulses into the "trigger" pin, this cycle repeats again and again, and we get a digital sampled PWM representation of our analog waveform. This might be useful for motor control, or transmitting servo signals to remote-controlled electronics.

The clock generator itself has a clock, plus a buffer and XNOR gate. Whenever the clock CLK1 transitions from high to low or low to high, there is a brief amount of time for which the two inputs to the XNOR1 gate are different. (This amount of time is the "propagation delay" of buffer BUF1.) When these inputs are different, the output of XNOR1 is low. This provides us with an easy way to generate a stream of brief negative pulses that this 555 circuit needs.

A few things to try in CircuitLab

Load the simulation by clicking "Open in editor" above, and then click "Simulate" at the bottom. Run a time domain simulation.

Look at how the output voltage is composed of a series of digital pulses of different widths, and those widths depend on the present value of the sine wave voltage source.

Adjust the source

Try different analog input shapes, like a triangle wave or sawtooth wave, to see how the pulse generator reacts. You can also adjust the amplitude and frequency, but beyond some limits this PWM generator circuit won't necessarily be able to follow the input signal.

Adjust the PWM clock frequency

The circuit currently fires 4000 pulses per second, which is double the frequency of CLK1. (Why double? See the paragraph about the clock generator above.) Try adjusting this and see how you might have to also change R1 or C1 to compensate.

Advanced: improve linearity

A careful observer will note that the pulse width is not totally proportional to the analog input voltage because of the exponential response of the RC charging circuit. Can you come up with a way to make it totally linear by replacing R1 with some other ideal component? Can you then implement that ideal component with "real" components?

See also

555 Timer as Astable Multivibrator (Oscillator):


Comments

cool.thanks

by mcuhack
March 08, 2012

Leave a Comment

Please sign in or create an account to comment.

Revision History

Only the circuit's creator can access stored revision history.