Centering a square wave

bertus

Joined Apr 5, 2008
22,277
Hello,

When the square wave is 50% on and 50 % off, then you may use a C-R network.
If it is not 50/50, you can subtract 2.5 Volts using an opamp adder circuit.

Bertus
 

Thread Starter

rfpd

Joined Jul 6, 2016
101
Hello,

When the square wave is 50% on and 50 % off, then you may use a C-R network.
If it is not 50/50, you can subtract 2.5 Volts using an opamp adder circuit.

Bertus
It is, but it would take 120ms to center, and it can't take that long.

I thought about the opamp but I thought it wouldn't be able to reproduce negative voltage if it has 0V on V-.
 

MrChips

Joined Oct 2, 2009
30,806
Use a 9V supply.
Create a 4.5V bias point by using a voltage divider with two 10kΩ resistors.
Use this to bias your input signal. Use a 1μF coupling capacitor. This will give a time constant of 5ms.
 

Thread Starter

rfpd

Joined Jul 6, 2016
101
Use a 9V supply.
Create a 4.5V bias point by using a voltage divider with two 10kΩ resistors.
Use this to bias your input signal. Use a 1μF coupling capacitor. This will give a time constant of 5ms.
I tried to bias the square signal, can't get it to work.

I only can get the flip flop to output 5V (in this simulation), so I reduce that to 1V before the capacitor, after that the signal gets all screwed up.
 

Attachments

dl324

Joined Mar 30, 2015
16,918
Just 9V, I don't have any negative voltage, that's the problem.
If it's a 9 volt battery, you can use another for a negative supply.

Otherwise, you can use a voltage inverting switching regulator.

From On-Semi app note using the venerable MC34063:
upload_2017-7-12_10-15-57.png
 

EM Fields

Joined Jun 8, 2016
583
It is, but it would take 120ms to center, and it can't take that long.
How much time do you need?

I thought about the opamp but I thought it wouldn't be able to reproduce negative voltage if it has 0V on V-.
You're right. It can't unless you cheat and use AC coupling.
In my opinion, the simplest way to bypass all that nastiness is to determine how much current your load needs when the output signal swings max negative and to use a negative supply which can supply that current.
 

crutschow

Joined Mar 14, 2008
34,432
It is, but it would take 120ms to center, and it can't take that long.
If this is for your divide by 2 audio circuit, the output will be going between 0V and 5V in a somewhat random fashion so I don't see that the initial settling time of the RC circuit is a significant factor.
You are unlikely to hear the effect.
 

MrChips

Joined Oct 2, 2009
30,806
If this is for your divide by 2 audio circuit, the output will be going between 0V and 5V in a somewhat random fashion so I don't see that the initial settling time of the RC circuit is a significant factor.
You are unlikely to hear the effect.
+1
Agreed. We are showing you how to bias the input to ½ supply voltage.
Will this work to shift musical notes to a lower octave? I don't think so.

The way to do this is to use a DSP (digital signal processor) and do the frequency shift digitally.
This allows you to do other effects such as adding chorus.
 

Thread Starter

rfpd

Joined Jul 6, 2016
101
If this is for your divide by 2 audio circuit, the output will be going between 0V and 5V in a somewhat random fashion so I don't see that the initial settling time of the RC circuit is a significant factor.
You are unlikely to hear the effect.
Just affraid that it will mess with my amp, but I guess those values won't be high enough. I mean everytime I play a note, that effect happens, so it might saturate (clip the signal) or something.
 

Thread Starter

rfpd

Joined Jul 6, 2016
101
+1
Agreed. We are showing you how to bias the input to ½ supply voltage.
Will this work to shift musical notes to a lower octave? I don't think so.

The way to do this is to use a DSP (digital signal processor) and do the frequency shift digitally.
This allows you to do other effects such as adding chorus.
I prefer analog effects, I like to learn the basics and put it to work ahah. Also they have more quality (not in this case ofc).

Just out of curiosity and slightly off-topic, by DSP you mean like an arduino?
 

MrChips

Joined Oct 2, 2009
30,806
I prefer analog effects, I like to learn the basics and put it to work ahah. Also they have more quality (not in this case ofc).

Just out of curiosity and slightly off-topic, by DSP you mean like an arduino?
By DSP, I mean a microcontroller. Arduino does not have the speed to do this. You need a faster MCU.
 

AnalogKid

Joined Aug 1, 2013
11,043
There are dedicated charge pump ICs that can turn +9V into around -8 V with a lot less effort and noise than a traditional switching regulator. Since you don't need for the negative voltage to be regulated and the current requirement is very low, a 555 plus 6 external components (1 R, 2 D, 3 C) will be fine for this. Once you have an opamp powered by +/- V, the waveform can be shifted a fixed DC amount and will stay put no matter what the duty cycle or frequency, with no startup offset.

ak
 
Top