SPWM refers to Sine Wave Pulse Width Modulation which is a pulse width arrangement in which the pulses are narrower at the start, which gradually get broader at the middle, and then narrower again of the end of the arrangement. This set of pulses when implemented in an inductive application like inverter enables the output to be transformed into an exponential sinewaveform, which may look exactly identical to an conventional grid sine waveform,

Acquiring a sinewave output from an inverter can be the most crucial and the most advantageous feature for rendering maximum efficiency to the unit, in terms of its output quality. Let's learn how to make sine wave PWM or an SPWM using an opamp.

## Simulating a Sine waveform is not Easy

Achieving a sinusoidal wave output could be quite complex and may not be recommended for inverters, because electronic devices normally do not "like" exponentially rising currents or voltages. Since inverters are essentially made by using solid state electronic devices, a sinusoidal waveform is normally avoided.

Electronic power devices when forced to operate with sinusoidal waves produce inefficient results since the devices tend to get relatively more hot compared to when operated with square wave pulses.

So the next best option for implementing a sine wave from an inverter is by the way of PWM, which stands for Pulse width modulation.

PWM is an advanced way (digital variant) of putting forth an exponential waveform through a proportionately varying square pulse widths whose net value is calculated to exactly match the net value of a selected exponential waveform, here "net" value refers to the RMS value. Therefore a perfectly calculated PWM with reference to a given sine wave can be used as a perfect equivalent for replicating the given sinewave.

Furthermore, PWMs become ideally compatible with electronic power devices (mosfets, BJTs, IGBTS) and allow these to run with minimal heat dissipation.

However generating or making sinewave PWM waveforms is normally considered complex, and that's because the implementation is not easy to simulate in ones mind.

Even I had to go through some brainstorming before I could correctly simulate the function through some intense thinking and imagining.

## What is SPWM

As explained at the beginning of the post, an SPWM is a digital equivalent of an analogue sine waveform. An analogue sine waveform has a gradually increasing waveform at the start, which grows maximum at the center of its travel, and then it gradually descends downwards towards the zero mark. In the same way an SPWM has thinner pulses at the start of the waveform, the thickness or the width of the pulses gradually get bigger and maximum at the center of the travel, and then the pulses slowly grow thinner towards the end of the waveform.

When this SPWM consisting of growing and shrinking pulse widths is applied to a transformer, the output from the transformer transforms this SPWM into an analogue equivalent which closely replicates an analogue sine waveform.

The easiest known method of generating a sinewaver PWM (SPWM), is by feeding a couple of exponentially varying signals to the input of an opamp for the required processing. Among the two input signals one needs to be much higher in its frequency compared to the other.

The IC 555 can also be used effectively for generating sine equivalent PWMs, by incorporating its built-in opamps and an R/C triangle ramp generator circuit.

The following discussion will help you to understand the entire procedure.

New hobbyists and even the professionals will now find it quite easy to understand regarding how sine wave PWMs (SPWM) are implemented by processing a couple of signals by using an opamp, let's figure it out with the help of the following diagram, and simulation.

### Using two Input Signals

As mentioned in the previous section, the procedure involves the feeding of two exponentially varying waveforms to the inputs of an opamp.

Here the opamp is configured as a typical comparator, so we can assume that the opamp will instantly start comparing the instantaneous voltage levels of these two superimposed waveforms the moment these appear or are applied to its inputs.

* ** *In order to enable the opamp to implement the required sine wave PWMs correctly at its output, it's imperative that one of the signals has a much higher frequency than the other. The slower frequency here is the one which is supposed to be the sample sine wave which needs to be imitated (replicated) by the PWMs.

Ideally, both the signals should be sinewaves (one with a higher frequency than the other), however the same can be also implemented by incorporating a triangle wave (high frequency) and a sine wave (sample wave with low frequency).

As can be seen in the following images, the high frequency signal is invariably applied to the inverting input (-) of the opamp, while the other slower sinewave is applied to the non-inverting (+) input of the opamp.

In a worst case scenario, both the signals can be triangle waves with the recommended frequency levels as discussed above. Still that would help you to achieve a reasonably good sinewave equivalent PWM.

**The signal with the higher frequency is termed as the carrier signal, while the slower sample signal is called the modulating input.**

### Creating an SPWM with Triangle wave and Sinewave

Referring to the figure above, we can clearly visualize through plotted points the various coinciding or overlapping voltage points of the two signals over a given time span.

The horizontal axis signifies the time period of the waveform, while the vertical axis indicates the voltage levels of the two simultaneously running, superimposed waveform.

The figure informs us regarding how the opamp would respond to the shown coinciding instantaneous voltage levels of the two waveforms and produce a correspondingly varying sine wave PWM at its output.

The procedure is actually not so difficult to imagine. The opamp simply compares the fast triangle wave's varying instantaneous voltage levels with the relatively much slower sinewave (this can also be a triangle wave), and checks the instances during which the triangle waveform voltage may be lower than the sine wave voltage and responds by instantly creating high logic at its outputs.

This is sustained as long as the triangle wave potential continues to be below the sine wave potential, and the moment the sine wave potential is detected to be lower than the instantaneous triangle wave potential, the outputs reverts with a low and sustains until the situation reverts.

This continuous comparison of the instantaneous potential levels of the two superimposed waveforms over the two inputs of the opamps results in the creating of the correspondingly varying PWMs which may be exactly the replication of the sine waveform applied on the non-inverting input of the opamp.

### Opamp Processioning the SPWM

The following image shows the slo-mo simulation of the above operation:

Here we can witness the above explanation being implemented practically, and this is quite how the opamp would be executing the same (although at a much fater rate, in ms).

The upper figure shows a slightly more accurate SPWM depiction than the second scrolling diagram, this is because in the first figure I had the comfort of the graph layout in the background whereas in the second simulated diagram I had to plot the same without the help of the graph coordinates, therefore I might have missed a few of the coinciding points and therefore the outputs looks a little inaccurate compared to the first one.

Nevertheless, the operation is quite evident and distinctly brings out how an opamp is supposed to process a PWM sine wave by comparing two simultaneously varying signals at its inputs as explained in the previous sections.

Actually an opamp would process the sine wave PWMs much more accurately than the above shown simulation, may be a 100 times better, producing a extremely uniform and well dimensioned PWMs corresponding to the fed sample. sinewave.

## Have Questions? Please post your comments below for quick replies! Comments should be related to the above artcile