How do I transform a unipolar signal to bipolar signal?
There are two ways to achieve this:

Operate OA1 an a linear amplifier with a gain of 2.  With a &quot;rail-to-rail&quot; opamp and a gain of slightly less than 2, the output will not clip and the circuit could be used to shift other waveform types, like a sine or triangle wave.

Operate OA1 as a comparator.  In this case the output swings between positive and negative saturation, and any input wave shape is turned into an output squarewave.


To do this with an opamp acting as a comparator, make these changes to the original circuit:

Delete Vref.

Connect the free end of R3 to V2.

Disconnect R2 from Vout.

Connect the free end of R2 to GND.


This will place a reference voltage of 6 V (V2/2) at the inverting input.  The comparator will slice the input signal at this voltage level.  Because there no is no negative feedback, the output will bang back and forth between the rails.
If there are small noise bursts at the output as the input crosses the transition level, you can add hysteresis to the circuit.