How to get half frequency square wave from sin wave?

The task is to get such wave: I can get square wave from sin wave, but I have no idea how to make it half-frequency. Have some advices?

• In your drawing, the square wave has the same frequency as the original sine wave. What's different from the simplest case is the duty cycle of the square wave is 25% rather than 50%. That means the square wave is only high for 25% of the signal's period. – The Photon Apr 15 '12 at 18:12
• How important is the phase shift between sine and (fundamental of) output signal? In the diagram this is 45°. – stevenvh Apr 18 '12 at 16:49

The frequency of your square wave is the same as your sine, it's not half.

The following solution focuses on getting the 45° phase difference between sine and pulse.
Differentiate the sine to get a cosine. (Note that a simple RC differentiator won't give you the required 90° phase shift. The opamp differentiator will.)
Pass both sine and cosine though a comparator, where you compare with 0V. This will get you two 50% square waves 90° phase shifted. AND these and you're there. This will get you the 45° phase shift between sine and pulse as shown. If phase is not important then Russell's idea of the flip-flop is also good. AND flip-flop input and output to get a 25% duty cycle.

• Guy u r cool. =) – Yurgen Apr 15 '12 at 18:17

The shown output signal would be hard to get with any reliability in most cases as it is triggered by the peak of the sine wave. this is doable but unusual.

As Steven says, this is a 1F signal still but with asymmetric mark-space ( = high low) ratio.

A common way of getting F/2 is to use a fli-flop in toggle mode with a square wave derived from the sine wave as a clocking signal. On the first sine wave rising edge (or falling edge) the flip flop is toggled to output = high. On the next rising edge it is again toggled so that output = low.

You would usually convert the sine wave to a square wave to make a clock signal. Something like shown below. This uses a digital inverter as a comparator. A formal comparator IC could be used. The output is shown AC coupled with a capacitor - not needed in this application if flip-flop and comparator share the same supply. And then divide that by two. One means: From here which provides a good discussion.

• Is potmeter R1 to set the duty cycle to 50%? – Federico Russo Apr 16 '12 at 7:02

are you using any Micro controller to perform this function...because a freind of mine did just that with an arduino..

what yiu have to do is to interface your analog volatge with an arduino through a zero crossing detector (ZCD) when you pass this through a zero crossing detector you would have the points where the voltage passes the x-axis or 0v. then all you have to do is to Start a Square wave at the first input from ZCD, ignore the other two and then on the fourth input from the ZCD complement the Square wave output, again ignore the next two inputs and at the third input , complement the output.