Low Voltage AC Source (Summary)

electronics AC

Let's look back at what we learned in this project series and talk about which solution fits which use case.

Summing up

During this project series we have looked at different techniques to build an AC source. We explored how to generate analog signals, learned about amplifiers and filters, and finally looked at inverter circuits, which are commonly used in commercial DC-to-AC converters. The circuits we built were neither optimized nor applicable to higher voltages and currents, however they allowed as to start simple and learn the basics step-by-step. It is now time to look back and see what we learned.

Generating Analog Signals

Sine signal

The AC waveform we are used to is sinusoidal. This is the natural way the voltage and current curves are when generating power using a generator. The waveform is the result of the rotational movement of the rotor. For a digital microcontroller like the Arduino Uno generating an analog signals doesn't come naturally. Nevertheless, we found ways to achieve it. Let's recap and compare the different methods side-by-side.

Digital-to-Analog Converters

A digital-to-analog converter (DAC) is probably the easiest way to generate analog signals with microcontrollers. Similar to an ADC which converts a voltage into a digital value, a DAC outputs digital values as an analog signal. With a DAC it is possible to output not only sinusoidal, but arbitrary waveforms or even audio signals. The output quality is dependent on the resolution of the DAC. In case of a low resolution the output signal is going to show a staircase effect. The achievable signal frequency is dependent on the maximum sampling rate of the DAC. Whenever a microcontroller has a DAC, which supports the desired sampling rate, use it, it is the easiest and the most flexible way. However, the Arduino Uno does not have an integrated DAC, which is why we had to use an external DAC like the MCP4725.

Read the details in part 2

Using the MCP4725 with the Arduino Uno

Using Filters

The Arduino Uno might not be cable of directly generating analog signals, but it is very good at generating digital ones. It is very easy to generate a square wave - either by using PWM or by simply toggling a pin. It is possible to convert such a square wave into a sinusoidal wave. From area of harmonic analysis we learned that every complex waveform is can be thought of as a composition of sine waves. Using filters we can remove the higher frequency components of a 50 Hz square wave signal and are left with a 50 Hz sine wave.

Converting a square wave to sinusoidal wave by filtering out the higher frequency components

The advantage of this method that it is very easy to generate a square wave even at high frequencies. There is also no need to worry about the staircase effect. However, using filters also has a huge disadvantage: the filter circuit needs to be designed specifically for one output frequency. There is no flexibility to change the frequency or generate non-sinusoidal waveforms. Use this method only if you want to generate a fixed frequency sine wave.

Read the details in part 3

Creating a sine wave from a square wave using a third-order RC filter


A good compromise between the two solutions is a so-called PWM DAC. By modulating a high frequency PWM signal and filtering out the high frequency parts of the signal it is possible to generate arbitrary waveforms like with a DAC. This works by changing the duty cycle of the PWM signal and filtering out everything but the DC component of the signal.

Changing the duty cycle to create the desired output voltage

The technique gives us all the advantages of a DAC without needing an external module. Of course the downsides of a DAC like the staircase effect also affect a PWM DAC. Using a PWM DAC is more flexible than filtering a square wave, however, a resistor-ladder DAC like the MCP4725 is still superior to it. The problem with a PWM DAC is that it only produces a clean output signal if the PWM frequency is much higher than the frequency of the output signal. A factor of ten or more is advisable.

Read the details in part 4

PWM DAC with 1st order RC filter

The Challenge of Negative Voltages

We have so far looked at different ways to generate a sine wave. The tricky part about AC is not the waveform, however, but the alternating current. For a real AC source we need to switch the polarity back and forth. We need to have not only positive, but negative voltages as well. But how can we generate negative voltages?

While there are several methods and components to generate negative voltages, it is best to remember first what a negative voltage actually is. Voltage is measured differentially. A voltage is the potential difference between two points and thus whether a voltage is positive or negative depends on what we choose as the ground reference. If we have a sine wave between 0 V and 5 V, we can also regard this as a sine wave between -2.5 V and 2.5 V, if we measure relative to a point at 2.5 V. The new reference point can be generated by a voltage divider.

Creating a new ground reference using a voltage divider

The advantage of this technique is that it is very easy. This is also why I used this technique in the signal generation circuits above. The huge drawback of a voltage divider is, that its output voltage changes under load. It works fine if we look at the waveform with an oscilloscope, but as soon as we connect a load the problems start to begin. We can solve this problem by buffering the voltage with an operational amplifier. However, using this technique limits us to only half our voltage range and causes huge power losses. We can do better than that.

Read the details in part 1

The better alternative is to generate two sine waves that are inverse to each other. If we connect our AC circuit in between we also have a true AC source and can even use the full voltage range. The disadvantage is that we now need our signal generation circuit twice.

Read the details in part 8

Using an inverted sine wave to create an AC signal

Using Amplification

It is one thing to generate a signal, it's another to make it stable and useable for other circuits. The signal generation circuits we discussed all have one big problem: as soon as we connect a load to any of the circuits the signal becomes instable and distorted. The most universal way to cope this issue is to add an amplifier.

Amplifier circuits

There are two things we can amplify: current and voltage. With a voltage buffer, we can stabilize the generated signal and ensure that higher currents are possible while keeping the voltage the same. With a non-inverting amplifier we can additionally increase the voltage. The two resistors R1 and R2 define the amplifier's voltage gain. In the example the voltage is amplified by a factor of two.
\(A = 1 + {R1 \over R2} = 1 + {10 kΩ \over 10 kΩ} = 2\)

➔ Read the details in part 5 and part 6

Below you can see how the amplification circuit for the PWM DAC circuit looks like. Since we amplify the voltage by a factor of two, we need an external 12 V power supply to be able to actually generate voltages up to \(2 \cdot 5 V = 10 V\).

Amplification circuit with external 12 V supply

The above circuit gives us a stable signal generator for whatever waveform we want. Due to the constant amplification factor it is possible to calculate what the amplified signal looks like beforehand. The amplifier does whatever it can to compensate for any distortions the load might cause to the output signal. Of course there are limits. For example, it is very easily possible to reach the amplifier's maximum output current. For a typical op amp the limit it is around 40 mA. While there are also more powerful op amps, in such case it is best to use a push pull-output stage like shown below. The achievable output power depends solely on how powerful the used transistors are.

Read the details in part 8

Amplification circuit with push-pull stage and external 12 V supply

The advantage of using amplification is that the output is predictable. It is easy to build the circuit and calculate what components you need. A huge disadvantage these linear amplifier circuits are their high losses. So when to use such an amplification circuit? Whenever you care for your output signal to follow exactly your desired waveform and don't care about the energy you waste. Use them in lab equipment, temporary experiments or low power circuits, but not use them if you actually intend to power something over a long period of time. In such a case you want switching-mode circuits like inverters.

Using H-Bridge Inverters

Inverters are ideal for use cases that require a high output powers and small losses. Commercial H-bridge inverters can reach efficiencies of up to 99 %. The trick is to use MOSFETs and switch them on and off with a PWM signal. Due to the MOSFETs being fully turned on and off and not partially like the transistors in a linear amplifier, there are very little losses. The downside of this is very easy to spot: the output signal of an H-bridge is always a digital one. Either one arm of the H-Bridge is on or it is off. If we want to generate a sine wave, we need to modulate our PWM signal like we did for the PWM DAC. The filtering is then done after the amplification by the H-bridge inverter. For this we now need a powerful filter. In such a case it is much better to use an LC filter instead of an RC filter.

Below you can see the solution I came up with. The output power is limited by the MOSFETs and the LC filter components. In my case the inductor used in the LC filter was the limiting factor, however, with the right components an H-bridge inverter as this can provide surprisingly high output powers.

Read the details in part 10

When to use an H-bridge inverter design? Use it when you need to actually power something. However, I highly recommend you use a commercial product in such a case. There are lots of things that can go wrong in high power circuit. You might notice, that our design has a big downside: it has no feedback circuit. In our Arduino program, we cannot tell, how our output signal looks and whether it is distorted or not. While it is possible to build inverter circuits with feedback, it is a much more challenging task than with linear amplifiers.

Previous Post Next Post