# Converting DC Sq. Wave to AC Sq. Wave

Discussion in 'The Projects Forum' started by The Rick, Nov 29, 2008.

1. ### The Rick Thread Starter New Member

Nov 29, 2008
4
0
Greets all;

I'm not sure this descrip. defines what I'm after. I have a square wave signal, 5Khz, 0 to +15vdc. I want to make this signal go from 0 to +15vdc to -15vdc to +15vdc... keeping the frequency where its set at, and continue from there. I've looked at a lot of things for this, but can't seem to come up with the right circuit to do this job.

Anyone's help would be greatly appreciated. Thanx.
Rick L

2. ### Audioguru New Member

Dec 20, 2007
9,411
896
A coupling capacitor will block the DC but pass the AC so that the average voltage is 0V.
Then an opamp will amplify it with a gain of 2 and a power supply of about +18V and -18V.

3. ### KL7AJ AAC Fanatic!

Nov 4, 2008
2,040
287
Yes, this is the simplest method, and as long as the capacitor is large enough, the waveshape should be well retained. However, some applications might require a more deliberate clamping scheme...if the load impedance varies, the center poing of the AC wave could drift around. After the DC blocking stage, it might be useful to run it into a comparator.

Eric

4. ### KL7AJ AAC Fanatic!

Nov 4, 2008
2,040
287
Here's a good paper on the matter. As you can see, there's more to the subject than meets the eye.

eric

Mar 24, 2008
20,766
2,536

File size:
2.3 KB
Views:
57
6. ### Ron H AAC Fanatic!

Apr 14, 2005
7,050
657
If your input amplitude is constant, you can do it like this. If your duty cycle is not exactly 50%, AC coupling into a gain-of-two amplifier won't work.

File size:
18.5 KB
Views:
28
7. ### Audioguru New Member

Dec 20, 2007
9,411
896
A lousy old LM358 is one of the slowest opamps ever made. Its datasheet shows that it slews so slowly that at an output of only 14V p-p it barely produces a sine-wave at 5kHz and at 20V p-p barely a sine-wave at only 3kHz. It might not produce 1kHz at 30V p-p.
With a 5kHz square-wave input then the output will be a triangle-wave, probably at a reduced level.

8. ### Ron H AAC Fanatic!

Apr 14, 2005
7,050
657
I agree that LM358 is a crappy op amp. The datasheet (Voltage Follower Pulse Response graph on p.7) implies a typical slew rate of 0.5V/usec. For a 30 volt transition, the slew time would be Tslew=30/0.5e6=60usec. Since half the period of 5kHz is 100usec, it will indeed be more of a trapezoid wave than a square wave. Since there seems to be no spec on minimum slew rate, it could be considerably worse.

9. ### Audioguru New Member

Dec 20, 2007
9,411
896
I have been using MC33171 single, MC33072 dual and MC33174 quad opamps in circuits designed or the lousy old LM324 and LM358 opamps.
The Motorola (ON Semi now) opamps have exactly the same output voltage to zero volts, low supply voltage operation and exactly the same low supply current but do not have crossover distortion and have a full output response of 35kHz instead of only 1kHz.

10. ### The Rick Thread Starter New Member

Nov 29, 2008
4
0
Hello all;

That was my 1st post in any forum of this nature. I'm impressed with the fast and many replies. I will look into each one and hopefully find the "answer" to my quest. I appreciate this very much and will let you all know what I end up with. Any more ideas or suggestions are certainly most welcome. I'll check back in often.

Thanx:
Rick L.

11. ### Ron H AAC Fanatic!

Apr 14, 2005
7,050
657
Here are the results of the schematic I posted, just in case you can't imagine it.

File size:
13.8 KB
Views:
39
File size:
17.7 KB
Views:
30
File size:
1.6 KB
Views:
14
12. ### The Rick Thread Starter New Member

Nov 29, 2008
4
0
Hi Ron;

Thanx for the schematic. Eases things for me a bit. I haven't had the opportunity to act on the info given previously, so this will save me some time. If I knew guru's like you guys were out there, well, I'd have joined a long time back.

"If your duty cycle is not exactly 50%, AC coupling into a gain-of-two amplifier won't work."

The duty cycle is not exactly stable, its self adjusting. This is a PWM with automatic current control by lowering the duty cycle when the load wants to draw more current as it heats up. Therefor, the duty cycle starts close to 100% at turn on, then as this load heats up, it lowers the duty cycle.

The frequency is adjustable, 1khz to 10khz more or less. But thats not an issue with this quest. The current level is also adjustable, for varying load conditions. I can set it for 20 amps, for example. The load heats up and wants to draw more current, but this circuit won't let it go beyond the 20 initially set at.

While I do want the signal to remain as close to square as I can get it, the load is not too concerned with this, just the amount its allowed to draw.

I've already received much more help than I could have figured out any time soon, so thanx again guys.

Rick L.

13. ### Ron H AAC Fanatic!

Apr 14, 2005
7,050
657
My point about tha AC-coupled amplifier was as follows: If you had a 25% duty cycle, for example, your output voltage, instead of being ±15V, would be +20V, -10V, assuming your op amp had the supply voltage to handle that range.

14. ### Wendy Moderator

Mar 24, 2008
20,766
2,536
So would this work?

File size:
3.2 KB
Views:
40
15. ### Ron H AAC Fanatic!

Apr 14, 2005
7,050
657
I think your pot should be set for +15V.
The desired function is Vout=2*Vin-15.
Your circuit's Vout is 2*Vin-Vref, where Vref is the pot voltage.
To get the desired output, Vref=+15V.
Your supply voltages need to be at least ±18V. See the input common mode range and the output voltage swing in the datasheet.
By attenuating the input and using more gain, you could get around the common mode limit, but the output will still only go to within 1.6V of the positive rail over temperature.

16. ### Wendy Moderator

Mar 24, 2008
20,766
2,536
Thanks, this has been a good op amp refresher course for me.

From what I've seen your design is a bit more digital (the transistors will tend to switch), while this one is very linear (doing exactly what the OP asked, including keeping imperfections in the waveform).

File size:
3.2 KB
Views:
38
17. ### SgtWookie Expert

Jul 17, 2007
22,182
1,728
Perhaps I'm oversimplifying, but I don't see why the attached circuit wouldn't do what our OP wants.

Four resistors (actually, R3 could be omitted), an NPN transistor, a P-ch power MOSFET, and a 10v Zener diode. The P-ch MOSFET shown is only good to 12A; it really would be better to use an N-ch MOSFET on the low side.

• ###### ACLevelConverter.PNG
File size:
60.6 KB
Views:
27
Last edited: Nov 30, 2008