Converting Square wave to DC voltage

Discussion in 'General Electronics Chat' started by keymie94, Apr 12, 2016.

  1. keymie94

    Thread Starter New Member

    Apr 12, 2016
    5
    0
    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
     
  2. MrSoftware

    Member

    Oct 29, 2013
    498
    122
    A rectifier circuit will do what you want.
     
  3. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,791
    1,103
    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: Apr 12, 2016
  4. dl324

    Distinguished Member

    Mar 30, 2015
    3,242
    619
    Welcome to AAC!
    Yes. If you provide more details regarding your application, you'll get better answers.
     
  5. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,023
    3,789
    Try both options with the 1k as the load instead of a filter. The rectifier (diode) option will be much better.
     
  6. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,791
    1,103
    Removing the filter leaves a square wave. Not what the OP wants.
     
  7. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,023
    3,789
    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
     
  8. crutschow

    Expert

    Mar 14, 2008
    13,002
    3,229
    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.
     
  9. RichardO

    Well-Known Member

    May 4, 2013
    1,235
    384
    It depends on whether he wants to measure the average voltage (amplitude) of the square wave or obtain pwoer from the square wave...
     
  10. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,023
    3,789
    I'm sure an problem can always be found that fits a random solution.
     
  11. wayneh

    Expert

    Sep 9, 2010
    12,103
    3,038
    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.
     
  12. crutschow

    Expert

    Mar 14, 2008
    13,002
    3,229
    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:
     
    GopherT likes this.
  13. wayneh

    Expert

    Sep 9, 2010
    12,103
    3,038
    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.
     
  14. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,023
    3,789
    The combination of diode and capacitor chance everything.

    A 100Hz square wave with a 100uF capacitor.

    image.jpg

    image.jpg
     
    keymie94 likes this.
  15. crutschow

    Expert

    Mar 14, 2008
    13,002
    3,229
    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.
     
  16. Tonyr1084

    Active Member

    Sep 24, 2015
    535
    86
    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: Apr 13, 2016
  17. Tonyr1084

    Active Member

    Sep 24, 2015
    535
    86
    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).
     
  18. crutschow

    Expert

    Mar 14, 2008
    13,002
    3,229
    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.
     
  19. wayneh

    Expert

    Sep 9, 2010
    12,103
    3,038
    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.
     
Loading...