Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How do I filter a square wave to get an analogue voltage?

Say I have a square wave, flipping between 0V and +6V, with a cycle of about 100Hz. How do I get from that to a flat analogue voltage that's between 0V and +6V?

So, for example, the square wave is at 0V for 50% of the time and at +6V for 50% of the time, I want to have an output of +3V. And if, for example, the square wave is at +6V for 75% of the time, I'd want an output of a flat 4.5V. Same for all other variations.

In effect I suppose this is a 1-bit DAC.

I think I need something like one resistor and one capacitor - but what are their values and wiring?!

Points to note:

* The frequency of 100Hz isn't a definite value if it's easier for it to be something else

* It doesn't matter if the system loses some voltage through the inefficiencies of the components

* The conversion doesn't have to be exactly linearly proportional but close to a linear relationship would be ideal

* What matters most is that the output would look virtually flat on an oscilloscope and can be smoothly varied between 0V and something near to +6V as the incoming square wave's peak and trough lengths are varied

* Fewest possible components with smallest power drain is desirable; this has to run off batteries

Thanks!

4 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    There is no linear way ot get a perfect average voltage from the waveform, but passing it through a low pass filter will reduce the strength of the higher frequency components of the square wave, without much changing the DC (average) component. Since the lowest frequency AC component is the fundamental frequency and low pass filters generally attenuate higher frequencies more than lower frequencies, the fundamental frequency is the hardest to acceptable eliminate with a simple low pass filter. But if you add a notch filter to the low pass filter, at the fundamental frequency, you can more easily get an acceptable average output. The combination of notch and low pass is often referred to as a Cauer or eliptical filter

    In general, the higher the pulse frequency, the easier it is to filter out the AC in a given amount of delay time to produce an acceptable average voltage. That is, the delay between some change in the pulse duty cycle (percent of on time) and an acceptably stable average output voltage goes down as the pulse frequency rises, for a given filter complexity.

    There are some links for low pass and notch filter designs.

    http://en.wikipedia.org/wiki/Low-pass_filter

    http://www.science.unitn.it/~bassi/Signal/TInotes/...

    http://en.wikipedia.org/wiki/Elliptic_filter

    All those filters are linear devices, because they have a proportional effect on any signal. But if you have the capability to do digital stuff (have a microprocessor of discrete logic) you can do lots of other solutions. For instance, you can combine a very simple low pass filter (that will have a lot of ripple in its average) with a sample and hold that is synchronized with the pulse, you can grab a sample of the average at the same place in each ripple cycle, so that the sample and hold output is much more representative of the true average with very little ripple, and also with minimal delay. This average will step to the new average when the duty cycle of the pulse changes.

    http://www.analog.com/static/imported-files/tutori...

    --

    Regards,

    John Popelish

  • Anonymous
    5 years ago

    I go along with most of the answers already given. However, voltmeters are supposed to read the RMS voltage of the ac waveform. The RMS is that value of dc voltage, which would give the same heating effect as an ac waveform. Thus, the only TRUE RMS measure is a meter involving a thermocouple. However, there is a relationship if sine waves are involved, which links the peak value to the RMS value. In your average voltmeter, a bridge rectifier inverts the negative half cycles so that a series of positive half cycles are produced. The average of these is NOT zero of course, and so gives an indication on the meter. On the assumption that sine waves are involved, the meter can then be calibrated to show the RMS value, even though the average of the rectified wave is what is actually measured.

  • 4 years ago

    Convert Square Wave To Dc

  • Anonymous
    1 decade ago

    Fourier theorem sates that any periodic signal can be expressed as a summation of sinusoidal signals with different frequencies, so, if you put a band pass filter and center it at the frequency you want, you'll get a sinusoidal signal, of course it won't be pure, as your filter is not ideal.

Still have questions? Get your answers by asking now.