# Square wave to DC voltage with passive components

Good day,

I have a design challenge that I have been thinking about.

Is there a passive and inexpensive system that I can get a square wave (frequency not decided yet, but less than 8MHz) that will output a 5V DC signal? If the input changes to a fixed voltage the output must go low.

My solution was to DC null the square wave with a decoupling cap and then smooth out the gaps in the remaining square wave with a passive low pass filter. Essentially take advantage of the capacitor to GND and allow it to charge and discharge at a frequency that will result in a DC signal.

The problem with this design that I can see is that this is wildly inefficient as the DC null will half the power and the passive LPF will also result in a loss of power.

Is there a way I could use transistors to active what I want? (I am trying to stay away from IC's)

EDIT @Neil_UK

This is my simulation response with a slow frequency of 2kHz.

• You should make up your mind about this being either passive and inexpensive or active. Jun 25, 2018 at 6:47
• An AC coupled rectifier can possibly do the trick, but we need to know more about the square wave. Jun 25, 2018 at 6:50

The following voltage doubler may give you what you want

simulate this circuit – Schematic created using CircuitLab

It presents the peak to peak input voltage to the output, less two diode drops. Choose D2/3 to be schottky types for lower drop than silicon. A 5v squarewave will give you a bit more than 4v.

Choose C1 depending on frequency. Its impedance at the input frequency needs to be much less than the load resistor R1.

R2 should be as small as possible, consistent with it limiting the current taken from the gate driving the line. If it's a 'buffer gate' like HC125 or similar, it could be quite small, or with a small C1, not needed at all.

The ratio C2/C1 determines how many cycles are needed to 'pump up' the output voltage.

The product C2.R1 determines the time it takes for the output voltage to drop once the input signal has gone to DC.

With its less than 5v output, slow ramp up, and slow ramp down, the circuit may or may not meet your requirements. You may want to add a transistor or logic buffer to get crisper outputs.

To get 5v output, you'll need either to use a higher voltage input, to stack on another doubler stage Dickson multiplier style, or to add active FETs to reduce the diode drop to near zero, which is probably more complicated than you need.

simulate this circuit

The zener clamps the output voltage.

Bonus Points. What's the difference between Dickson and Cockcroft-Walton? This is a Dickson. In a Cockcroft-Walton, C3 goes to the junction of C1/D2/D3. The Dickson style has a lower output impedance, but subjects its input capacitors to a higher voltage. This means low voltage cascades are best with a Dickson, and high voltage cascades usually need a Cockcroft-Walton.

sure, a voltage doubler will do that.if you'll allow diodes as "passive"

simulate this circuit – Schematic created using CircuitLab

The circuit below assumes that your square wave signal has an amplitude of 5V and an offset of 2.5V (0V to 5V square wave)

D1 with C1 forms a half-wave rectifier. Transitor M1 acts as a switch which turns on when there is a square wave input and is off when the input is a static DC signal.

R1, R2, C2 can be adjusted depending on your timeout requirements for turn-on and turn off.