I have a square wave that oscillates at 500 Hz from 12 to 14 V. I would like it to oscillate at the same frequency from 0 to 5 V, so I could use to trigger i.e. a switch. Is there any circuit to do this (shift down the signal)?

It goes from 12 V (low level) to 14 V (high level). I would like it to shift it down so it will go from 0 V (low level) to 5 V (or higher from 5 V... I don't mind).

  • 5
    \$\begingroup\$ Do you mean that it goes from 12V to 14V or that it goes from 0V to 12V~14V? \$\endgroup\$ – Spehro Pefhany Dec 3 '16 at 21:20
  • \$\begingroup\$ It goes from 12V (low level) to 14V (high level). I would like it to shift it down so it will go from 0V (low level) to 5V (or higher from 5V...I don't mind). \$\endgroup\$ – Argy Krou Dec 4 '16 at 12:01

@Olin's answer is a good one if you can live within the limitations which are:

  1. High voltage supply for the comparator (or special comparator)
  2. Duty cycle of input close to 50%
  3. Some pulses will be missed when the signal is first applied.

It has the great advantage of being non-critical as to component values (it automagically adjusts to the average input voltage) and has a good noise immunity once it adjusts.

There are a couple other simple options. First, you could simply use a 2.5V reference and divide down the input with a voltage divider such that 13V gives you 2.5V out. Since you would have only +/-7% (minus whatever noise immunity you require) to play with, this makes for a relatively critical circuit.


simulate this circuit – Schematic created using CircuitLab

It will also stop working if the input voltages change by a small percentage.

A third option is a DC restoration type of circuit that AC couples the input. Again, a comparator is used.


simulate this circuit

In the case of my first circuit the signal level is faithfully preserved if the input stops switching. In the case of Olin's circuit, the input noise immunity drops to close to zero if the signal disappears so you could see random noise at the output. In the case of my 2nd circuit, the output will eventually drift to one state or the other (the state can be enforced by a resistor from the + input of the comparator to +2.5 or ground).

In all 3 cases you could add some hysteresis by feeding back a bit of the output voltage to the + input.


One way is what's known as a data slicer. A simple one, as shown below, requires the average value to be near the middle between the two levels. That is true for a square wave.

Since the input voltage is 12-14 V, the comparator must be powered from a voltage enough above that so that the input signal is within its common mode range.

In this case, the comparator is assumed to have a open collector output. That makes the output signal digital from ground to whatever voltage the pullup resistor (R2 in this example) goes to.

R1 and C1 form a low pass filter. The comparator is therefore comparing the instantaneous input signal to somewhat of a average of recent history of the input signal. Since that average will be half way between the high and low levels, this will work nicely. This circuit automatically adjusts to drift of the high and low levels of the input signal. The time constant of the filter is a tradeoff between being long enough to not react to the individual input pulses, but short enough to react to the drift in the digital levels.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.