Converting Square wave to DC voltage

Thread Starter

keymie94

Joined Apr 12, 2016
8
Hello...just wanted to ask something...I know that we can achieve dc from a sine wave by introducing a smoothing circuit....is it possible to do that on a square wave? really helpful if anyone can give some knowledge

Thanks in advance
 

Alec_t

Joined Sep 17, 2013
14,280
If the square wave is unipolar you don't need a rectifier; just a low pass filter (i.e. smoothing). Using a rectifier does, however, yield a higher DC voltage.
DC-from-square.PNG
 
Last edited:

dl324

Joined Mar 30, 2015
16,839
Welcome to AAC!
I know that we can achieve dc from a sine wave by introducing a smoothing circuit....is it possible to do that on a square wave? really helpful if anyone can give some knowledge
Yes. If you provide more details regarding your application, you'll get better answers.
 

crutschow

Joined Mar 14, 2008
34,280
Hello...just wanted to ask something...I know that we can achieve dc from a sine wave by introducing a smoothing circuit....is it possible to do that on a square wave? really helpful if anyone can give some knowledge
You can't achieve DC from a sine-wave (with no dc offset) by using only a smoothing circuit, you need a rectifier and a smoothing circuit.

You can do the same with a square-wave. If you full-wave rectify a square-wave you theoretically need no filtering to achieve a smooth DC output.
In practice you need a small amount of filtering for the glitches caused by the real square-wave finite rise and fall times to achieve a smooth DC.
 

RichardO

Joined May 4, 2013
2,270
Once you add a load to the top output, it won't be what the OP wants either. The diode is needed. It won't be perfect but it will be more perfect.:D
It depends on whether he wants to measure the average voltage (amplitude) of the square wave or obtain pwoer from the square wave...
 

wayneh

Joined Sep 9, 2010
17,496
A square wave already is DC, just as surely as the output of a rectifier is. Pulsing DC is not the same as AC. If the current never changes direction, I call that DC.
 

crutschow

Joined Mar 14, 2008
34,280
A square wave already is DC, just as surely as the output of a rectifier is. Pulsing DC is not the same as AC. If the current never changes direction, I call that DC.
We've had discussions about this before.
So, if you have an audio signal going through an amplifier with a DC bias (which is typical), you won't call that signal AC? :confused:
 

wayneh

Joined Sep 9, 2010
17,496
I had those discussions in mind when I wrote my provocative post! I honestly don't know the answer. In your audio example, some component very early in the circuit would in fact be seeing current reversing direction with time. Whenever that happens, it's probably more useful to call it an AC circuit.

The TS's application is unclear but it sounded to me like a power supply question. When you rectify an AC sine wave in a full wave bridge, we usually call the output DC. But it's no more "DC" than a pulsed DC square wave (as opposed to an H-bridge, current-reversing square wave).

My main point was that you don't need to send a square wave through a rectifier to get DC. The output is no different than the input except for the diode drops.
 

GopherT

Joined Nov 23, 2012
8,009
I had those discussions in mind when I wrote my provocative post! I honestly don't know the answer. In your audio example, some component very early in the circuit would in fact be seeing current reversing direction with time. Whenever that happens, it's probably more useful to call it an AC circuit.

The TS's application is unclear but it sounded to me like a power supply question. When you rectify an AC sine wave in a full wave bridge, we usually call the output DC. But it's no more "DC" than a pulsed DC square wave (as opposed to an H-bridge, current-reversing square wave).

My main point was that you don't need to send a square wave through a rectifier to get DC. The output is no different than the input except for the diode drops.
The combination of diode and capacitor chance everything.

A 100Hz square wave with a 100uF capacitor.

image.jpg

image.jpg
 

crutschow

Joined Mar 14, 2008
34,280
................In your audio example, some component very early in the circuit would in fact be seeing current reversing direction with time. Whenever that happens, it's probably more useful to call it an AC circuit.
-------------------------
My main point was that you don't need to send a square wave through a rectifier to get DC. The output is no different than the input except for the diode drops.
I call any fluctuating signal AC, even if the current doesn't reverse with time.
Thus ripple or any signal variation riding on a DC bias is simply an AC signal riding on DC.
With that definition there's no confusion or ambiguity about whether a signal is AC or DC.

And if a square wave is symmetrical plus and minus around 0V, then you need a rectifier to get DC.
 

Tonyr1084

Joined Sep 24, 2015
7,852
It's probably unwise of me to jump into this argument, but I feel compelled to say that both Crutschow AND Wayne BOTH have valid points when taken in the context of each argument. But lets be clear: AC is Alternating Current. IF it doesn't change then it does not alternate. Even if AC is riding on a DC carrier - it still remains DIRECT current (as long as the AC component does not dip the overall voltage below zero).

Case in point: 5v+ DC with a 2v AC component on top of that. The average voltage will be 5v+ with a positive going current (just for the sake of argument). At given moments within the period of the AC component, at either peak of the sine wave, the v+ will be either 7v+ or 3v+. In either case the voltage remains in the positive region, and current does not reverse (or alternate).

I DO agree with Crutschow that DC biased transistors (push/pull amplifier) is still passing AC. It's signal source is AC and it's output is AC. The DC bias is only to trick the transistors into thinking it's seeing a zero voltage equal to its turn-on voltage. For example: A transistor begins to turn on at 0.7v (±). From the AC standpoint, 0.7 IS the zero point at which the transistor begins to switch on. So the DC bias - while an excellent example - does not negate the fact that current is STILL reversing direction.

Wayne's POV is that a square wave is a wave of zero volts followed by a positive voltage. Current flows in one direction during a logical 1 and ceases to flow during a logical 0. This is also true. Hence, DC is present during a logical 1. That can NOT be rectified. It would have to be a square wave of v+ and v- before it could be rectified. THEN it becomes true that it can be rectified (full wave) to produce a (nearly) pure DC. As Wayne stated, the only aberration would be during the rise and fall of the wave form itself.

Unlike a sine wave, a square wave has no RMS value. Even if it swings from pos to neg. Therefore, a square wave would have very little need for a smoothing circuit, whereas a sine wave needs to be. Unless you can live with what we like to call "AC Hum" (even though after rectification is is no longer AC).

The OP asks: "Can a square wave be rectified into DC?" Yes - IF it is a square wave of both positive and negative peaks. If not - then you're going to only see the positive peak of the square wave during its peak then a lull in power during the zero period of the wave.

If I had such a circuit I'd take that square wave and feed it into a buffer/inverter to get a complementary square wave then combine the two to produce a nearly full wave signal. Of course you'd still need to rectify the current, otherwise the positive going wave form of the primary pulse will be canceled out by the zero of the complementary wave. And vice versa.

Boy I hope I don't get my head handed to me on this. I mean no disrespect to anyone, and I hope nobody is offended. If anyone has an opposing opinion - great! I'll entertain anyone's comments.
 
Last edited:

Tonyr1084

Joined Sep 24, 2015
7,852
Correction: It was Crutschow who said that full wave rectification of a square wave (of plus and minus voltage) can be nearly perfect DC with minor aberrations from the rise and fall times of the wave from peak to peak (or somewhat like that).
 

crutschow

Joined Mar 14, 2008
34,280
......................
I DO agree with Crutschow that DC biased transistors (push/pull amplifier) is still passing AC. It's signal source is AC and it's output is AC. The DC bias is only to trick the transistors into thinking it's seeing a zero voltage equal to its turn-on voltage. For example: A transistor begins to turn on at 0.7v (±). From the AC standpoint, 0.7 IS the zero point at which the transistor begins to switch on. So the DC bias - while an excellent example - does not negate the fact that current is STILL reversing direction.
......................
In a typical Class A BJT amplifier, both the base and collector are biased so that the current is always in the same direction, even though it fluctuates with the AC signal.
Only the push-pull output stage would experience unipolar current pulses.

My view is that the AC signal can be viewed as independent of any DC bias (i.e. after it goes through an imaginary perfect DC block capacitor).
I understand that's not a strict view of "alternating current" but it avoids having to calculate the actual current polarities to determine whether the current actually "reverses" at a particular point.
With the strict definition a signal would be classified as AC when it goes into the Class A amplifier through a DC blocking capacitor, but "varying DC" as it travels through the amplifier, and then AC again when it comes back out through another blocking capacitor.
That's a distinction that I think few design engineers use. Certainly it's not a useful distinction.
 

wayneh

Joined Sep 9, 2010
17,496
There really is no resolution to drawing a hard line between the two terms, AC and DC. The world cannot be divided neatly into just those two buckets. Just as eskimos have so many words for snow, you need precise language for describing all the permutations ranging from pure clean DC to a pure AC sine wave. Both of these are ideals never achieved in the real world.

We think of a battery as supplying DC, but even that signal might have noise on it if you look closely enough. Does 0.1ppm noise make it AC? For most practical uses, no, but it it would not be inaccurate to talk about the AC noise coming even from a battery. We also call the output of a rectified sine wave "DC" despite a 100% ripple. A PWM signal sent to an LED or a motor is pulsed DC. All of these could also be called AC, if that's useful.

We use shorthand acronyms for convenience, not precision.
 
Top