Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

circuit desgn need help. volt bias to sine wave

Status
Not open for further replies.
If you make a circuit like this, it should do what you want

Sine-Shift..png
 
Here is the Bode plot of the EDN circuit compared to a conventional opamp Low Pass Filter. Note that it is almost a 2nd-order Butterworth response with a cutoff frequency of 2388Hz.

View attachment 96838

In order to properly filter PWM, the frequency of the PWM would have to be at least 10X the filter cutoff freq. Here is the time-domain response of the two filters to 20Khz PWM that suddenly switches from 10% duty-cycle to 90% duty-cycle at 1ms. Note the settling time, the residual 20KHz ripple, and the -2.5V DC offset intrinsic in the EDN circuit.

View attachment 96839

thanks
so you think this circuit is to slow?
im sorry its a bit out of my knowlege

my sinewave output should only variyng between -0,5v and +1,5v after summing dc voltage with the input sinewave
so the dc voltage should vary only +500mv to -500mv to shift the sinewave at the summing stage, it would make the fall and rise time shorter?

my PWM frequency is fixed at 2,4khz
 
Last edited:
maybe i dont have a PWM signal?
it is a fixed frequency at 2,4khz and the pulse length is warying
maybe it will make a difference?
 
Here is what it takes to convert your PWM signal to a smoothed offset voltage: You have to solve this part of the problem first, before worrying about offseting the Sine Wave.

I generate a 1.4V 2400Hz PWM signal that switches from 10% duty cycle to 90% duty cycle at 20ms in the simulation. You would expect a filter to convert the PWM signal into a DC level which is proportional to the duty cycle. 10% of 1.4V = 0.14V and 90% of 1.4V = 1.26V. I show what happens if you use two different types of filters; the first a simple 1-pole Low Pass Filter with a cutoff freq of 50Hz (~0.02 of the PWM freq) and a 2-pole Sallen Key Butterworth active LP filter with a cutoff of 100Hz using an opamp. Note the improved rise time of the active filter and the reduction in feed-through of the 2.4kHz PWM carrier frequency.

The upper pane shows the PWM signal, changing duty cycle at time=20ms. The lower pane shows the response of the 2 low-pass filters. Obviously, the active filter does a better job of converting the PWM to a varying offset voltage...

343b.gif
 
If you make a circuit like this, it should do what you want

According to post #5, the PWM signal does not represent an absolute DC value. It represents the percentage of the DC voltage between two adjustments. That percentage is the DC value summed with the input sine (unless something has changed since I last checked this thread).
 
Assuming you have a signal that ranges from 0V (0% duty-cycle of a 1.4V PWM) to 1.4V (100% duty-cycle of a 1.4V PWM), here is a circuit that offsets a 1Vpp Sine wave +- 500mV.

V(offset) lite blue trace represents the smoothed PWM I showed in post #25; ranges from 0V to 1.4V.
V(sine) green trace represents the reference Sine wave, in this example, 10Hz.
V(out) red trace is the Sine Wave offset by +-500mV, as a function of the smoothed PWM.

343c.gif

To make the effect of the offset variable, replace R4 with a 20K pot wired as a rehostat. This will make V(offset) produce shifts of the Sine wave that are bigger than +-500mV or smaller than +- 500mV, but still centered such that no shift occurs when the PWM is 50%, i.e. V(offset) = 0.7V.

If the amplitude of V3 is externally variable, you can eliminate the voltage divider R6/R7. If V3 is fixed amplitude, you can vary just the Sine amplitude at V(out) without affecting the shift by replacing R6/R7 with a 20K pot.
 
Last edited:
Assuming you have a signal that ranges from 0V (0% duty-cycle of a 1.4V PWM) to 1.4V (100% duty-cycle of a 1.4V PWM), here is a circuit that offsets a 1Vpp Sine wave +- 500mV.

V(offset) lite blue trace represents the smoothed PWM I showed in post #25; ranges from 0V to 1.4V.
V(sine) green trace represents the reference Sine wave, in this example, 10Hz.
V(out) red trace is the Sine Wave offset by +-500mV, as a function of the smoothed PWM.

View attachment 96871

To make the effect of the offset variable, replace R4 with a 20K pot wired as a rehostat. This will make V(offset) produce shifts of the Sine wave that are bigger than +-500mV or smaller than +- 500mV, but still centered such that no shift occurs when the PWM is 50%, i.e. V(offset) = 0.7V.

If the amplitude of V3 is externally variable, you can eliminate the voltage divider R6/R7. If V3 is fixed amplitude, you can vary just the Sine amplitude at V(out) without affecting the shift by replacing R6/R7 with a 20K pot.


great work but will it work with my positive signals sine: +0v to +1v pwm +0v to +1,4
 
Yes. Here it is again, this time with a 1Vpp Sine centered on 0.5V. I slightly modified R4 to get closer to +-500mV shift. I also show the shift for three values of the smoothed PWM V(offset): 0V (0% duty-cycle), 0.7V (50% duty-cycle), and 1.4V (100% duty-cycle).

343d.gif
 
Assuming you have a signal that ranges from 0V (0% duty-cycle of a 1.4V PWM) to 1.4V (100% duty-cycle of a 1.4V PWM), here is a circuit that offsets a 1Vpp Sine wave +- 500mV.

V(offset) lite blue trace represents the smoothed PWM I showed in post #25; ranges from 0V to 1.4V.
V(sine) green trace represents the reference Sine wave, in this example, 10Hz.
V(out) red trace is the Sine Wave offset by +-500mV, as a function of the smoothed PWM.

View attachment 96871

To make the effect of the offset variable, replace R4 with a 20K pot wired as a rehostat. This will make V(offset) produce shifts of the Sine wave that are bigger than +-500mV or smaller than +- 500mV, but still centered such that no shift occurs when the PWM is 50%, i.e. V(offset) = 0.7V.

If the amplitude of V3 is externally variable, you can eliminate the voltage divider R6/R7. If V3 is fixed amplitude, you can vary just the Sine amplitude at V(out) without affecting the shift by replacing R6/R7 with a 20K pot.

V3 amplitude is externally variable yes and the sine output need to be the same amplitude as the input.

im not understanding the first point too well. Is the 0% and 100% offset adjustable by 2 different pots?

i mean the 0% offset shold be adjustable by pot from -500mv to +500mv (not critical values but in that naberhood)
The same for 100% offset shold be adjustable by pot from -500mv to +500mv
 
Last edited:
...
im not understanding the first point too well. Is the 0% and 100% offset adjustable by 2 different pots?...

No. The shifting of the Sine wave by +- 500mV is directly controlled by changing the PWM duty cycle from 0% to 100%. Hence you need the low pass filter of post #25 to convert the PWM signal to V(offset), which is shown in the simulation of post #29 as V4.
 
No. The shifting of the Sine wave by +- 500mV is directly controlled by changing the PWM duty cycle from 0% to 100%. Hence you need the low pass filter of post #25 to convert the PWM signal to V(offset), which is shown in the simulation of post #29 as V4.

so how to adjust 0% offset and 100% offset at the circuit in post #25?
example: if I want to adjust the 0% to +10mv and 100% to 200mv
(millivolts added to the sinevawe out)
 
so how to adjust 0% offset and 100% offset at the circuit in post #25?
example: if I want to adjust the 0% to +10mv and 100% to 200mv
(millivolts added to the sinevawe out)

I told you in post #27. Here it is again:

To make the effect of the offset variable, replace R4 with a 20K pot wired as a rehostat. This will make V(offset) produce shifts of the Sine wave that are bigger than +-500mV or smaller than +- 500mV, but still centered such that no shift occurs when the PWM is 50%, i.e. V(offset) = 0.7V.

If the amplitude of V3 is externally variable, you can eliminate the voltage divider R6/R7. If V3 is fixed amplitude, you can vary just the Sine amplitude at V(out) without affecting the shift by replacing R6/R7 with a 20K pot.



The bottom line: Varying R4 with a pot shifts the center of the Sine Wave up and down. Varying R6/R7 with a pot changes the peak-to-peak amplitude of the Sine Wave.
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top