Problem with DC offset of Signal

Thread Starter

Toni Rodri

Joined Dec 3, 2023
28
Hey
I work with DAC of STM32H723Z. I play some samples at 100KHz (every sample is 100KHz).
Because the Microcontroller I can work only between 0-3.3V.
This is (plus-minus) how signal looks like (the signal is periodic):
1715036969454.png
I want to "Down" the signal about 0V. get the same Signal but between -1.65V - 1.65V.
I try to use DC block, to put capacitor in series but this is not working well. I get the signal between -0.7V-2.5V.
How can I get my signal around the 0V.
To this Signal there is no meaning, I just notice to this "problem" when I worked with the DAC and I didn't understand why capacitor in series not removed the dc level of the signl.
Thank you very much
 
Last edited:

ericgibbs

Joined Jan 29, 2010
19,091
Hi Toni,
Do you have a negative supply voltage available on your project?
The usual method is to Sum a negative voltage with the positive going signal in order to reference the signal about 0v.

E
 

Thread Starter

Toni Rodri

Joined Dec 3, 2023
28
Hi Toni,
Do you have a negative supply voltage available on your project?
The usual method is to Sum a negative voltage with the positive going signal in order to reference the signal about 0v.

E
Hey
I don't have a negative supply.
and if I have, how can I sum?
 

DickCappels

Joined Aug 21, 2008
10,246
You can sum by using a pair or resistors, such as in the example below, or you can use an opamp (probably asking for trouble if you don't have a negative power supply).
1715066450786.png

If you don't have a negative power supply you can simply use capacitive coupling to make the average voltage equal to zero volts (or any voltage of your choice) as shown below.
1715066206745.png
 

ericgibbs

Joined Jan 29, 2010
19,091
hi,
One common method is to power an OPA with say +/-5v and Sum the signal voltage with a suitable negative voltage, so that the output of the OPA is at 0V with no signal input.
The signal voltage will the drive the OPA output through +/-1.65v.
E

Note the OPA method can be configured such that source and load impedances do not affect the summing.
A simple resistive method of offsetting means you have to consider the source and load impedances.
 

Thread Starter

Toni Rodri

Joined Dec 3, 2023
28
You can sum by using a pair or resistors, such as in the example below, or you can use an opamp (probably asking for trouble if you don't have a negative power supply).
View attachment 321817

If you don't have a negative power supply you can simply use capacitive coupling to make the average voltage equal to zero volts (or any voltage of your choice) as shown below.
View attachment 321815
Hey. I tried capacitive coupling but it is not working
 

BobTPH

Joined Jun 5, 2013
9,264
Where is the signal going to? Must it have a common ground with the micro circuit? If not, you could use a virtual ground at 1.65V.
 

Ian0

Joined Aug 7, 2020
10,269
Is it an audio signal? If so, you are not interested in the DC value, and you are probably not interested in any frequencies below 20Hz.
If so,bias the signal to half supply: connect a resistor from the ADC to ground, and another resistor of the same value from the ADC pin to the 3.3V supply. Then couple your signal to the ADC input pin with a capacitor.
Work out the value of the capacitor so that
C>1/(2πRf)
where f is the lowest frequency you want to measure
and R is the parallel combination of your two resistors.
Then, when you read your ADC subtract half the maximum value (2048 if it is a 12-bit DAC) to get positive and negative values of your signal.
 

Thread Starter

Toni Rodri

Joined Dec 3, 2023
28
Where is the signal going to? Must it have a common ground with the micro circuit? If not, you could use a virtual ground at 1.65V.
Hey, the signal going to another circuit that there I need the signal around 0V.
but now it is going direct to the scope
 

Thread Starter

Toni Rodri

Joined Dec 3, 2023
28
Is it an audio signal? If so, you are not interested in the DC value, and you are probably not interested in any frequencies below 20Hz.
If so,bias the signal to half supply: connect a resistor from the ADC to ground, and another resistor of the same value from the ADC pin to the 3.3V supply. Then couple your signal to the ADC input pin with a capacitor.
Work out the value of the capacitor so that
C>1/(2πRf)
where f is the lowest frequency you want to measure
and R is the parallel combination of your two resistors.
Then, when you read your ADC subtract half the maximum value (2048 if it is a 12-bit DAC) to get positive and negative values of your signal.
Hey this is not audio signal. I need the signal around 0V for another circuit. I don't need ADC. I just not understand why capacitor in series not working to do that.
 

crutschow

Joined Mar 14, 2008
34,837
I need the signal around 0V for another circuit. I don't need ADC. I just not understand why capacitor in series not working to do that.
A capacitor in series with a resistor to ground will indeed give an average signal value of zero if the time-constant is sufficiently high for the lowest frequency of interest.
Did you have a resistor to ground after the capacitor in the circuit you tested?

Example LTspice sim below:
The average output is essentially zero for the 0 to 1V pulse input.
Note that it takes at least 5 RC time-constants for the average to settle to it final value, when a signal is applied.

1715109968117.png
 

DickCappels

Joined Aug 21, 2008
10,246
Just a note: If you are using an electrolytic capacitor and it is backwards, the capacitor will conduct DC and the offset may be changed but it might not be removed.
 

Thread Starter

Toni Rodri

Joined Dec 3, 2023
28
A capacitor in series with a resistor to ground will indeed give an average signal value of zero if the time-constant is sufficiently high for the lowest frequency of interest.
Did you have a resistor to ground after the capacitor in the circuit you tested?

Example LTspice sim below:
The average output is essentially zero for the 0 to 1V pulse input.
Note that it takes at least 5 RC time-constants for the average to settle to it final value, when a signal is applied.

View attachment 321836
I will try. but why capacitor alone doesn't work?
 

LadySpark

Joined Feb 7, 2024
194
Hey
I work with DAC of STM32H723Z. I play some samples at 100KHz (every sample is 100KHz).
Because the Microcontroller I can work only between 0-3.3V.
This is (plus-minus) how signal looks like (the signal is periodic):
View attachment 321794
I want to "Down" the signal about 0V. get the same Signal but between -1.65V - 1.65V.
I try to use DC block, to put capacitor in series but this is not working well. I get the signal between -0.7V-2.5V.
How can I get my signal around the 0V.
To this Signal there is no meaning, I just notice to this "problem" when I worked with the DAC and I didn't understand why capacitor in series not removed the dc level of the signl.
Thank you very much
Looks like Vdda is connected to Vref+ which should be floating with a .1uf cap to gnd.
Looking at the datasheet:
If the Vdd is connected to Vref+, then output zero cossing is 1.65V. If the Vdd pin has a .1uf-1uf capacitor to gnd then zero crossing should be 0V on the DAC output.
 
Last edited:

LadySpark

Joined Feb 7, 2024
194
To this Signal there is no meaning, I just notice to this "problem" when I worked with the DAC and I didn't understand why capacitor in series not removed the dc level of the signl.
without loading on the other side of a coupling capacitor, it will always show DC offset.
 

ericgibbs

Joined Jan 29, 2010
19,091
Hi Toni,
Simple simulation showing the performance of the R/C coupling circuit.
Sample rate 100kHz, of a 5k Sine wave signal, works OK.
E
EG57_ 1721.png
 
Top