# DC to AC Square wave question

• posted

Hey, all, I thought this would be easy but it's not been so far. What I want to do is take a DC power supply and output an AC voltage. The power supply I'm using puts out 6 volts DC and is marked that it can handle 1.66 amps output. All I want to do is take that and turn it into square-wave AC; not sinusoidal AC, but strictly square-wave AC and at the same 6 volts as the input. The mechanism needs to be able to handle the maximum of 1.66 amps and the 6 volts. The load is NOT inductive and, to the best of my knowledge is NOT capacitive; I believe the load is STRICTLY resistive. Many Bothans died to bring us this information. :)

What I've done is search for: buck converters, buck-boost converters, dc ac converters, dc ac inverters, dc chopper, dc square wave ac, and similar but most of what I find falls under either some patent site, or dc to ac inverters for taking 12 volts dc and making 120 volts ac sine-wave for driving appliances, or taking dc voltage up or down to DC.

All I want is to take my DC source and alternate the polarity like AC but I want it to be square-wave and I'd like to be able to vary the frequency. The oscillator like I'm using now (555-based) should handle the frequency variations (but I'm always open to suggestions, of course, or I wouldn't be posting here); what I'm hoping for is a "chopper" circuit to turn this output into square-wave AC.

What I've done is create an oscillating circuit using a 555 timer and a pot that allows me to vary the frequency of output from about 160 Hz to about 10.86 kHz at roughly 50% duty cycle. What I would like to do is use that to drive a circuit that can alternate the polarity of my DC power supply at the same frequency. It would seem that I need a MOSFET to control the power (several, in fact). I have used this timer circuit to drive a MOSFET (a BUZ11) and it works; I get variable frequency, pulsed DC power. That is, use the 555 output to drive the gate of the BUZ11, the power supply positive at the Drain, the power supply negative at the Source, and what I get is pulsed DC. But what I want, again, is square-wave AC.

I have found that in DC motor control (particularly for robotics) people use H-Bridge's to control electric motor direction which would seem to do what I need to have done; the schematics I've seen use 4 MOSFETs (two P channel, two N channel) to apply source voltage in one polarity or another. I could use the output of the 555 timer (or another oscillator) with an inverter of some kind (I'm NOT an expert at this stuff by any means, so some technicality will be lacking in anything I say but I try to be accurate) to take the output and make one MOSFET gate low (N channel) and one MOSFET gate high (P channel) when one polarity is required and reverse it for the other.

That leaves me using one 555 timer to control oscillations, 4 MOSFETs to control power (two of each channel), some number of logic comparators (I'm not educated enough in electronics to know what the component would be called) to make the output high for one MOSFET and low for another (for the gates), and maybe some transistors if the 555 output couldn't handle the brief current of charging the gates.

I have an old froo-froo LED flasher kit I put together years ago that uses two transistors and some caps and resistors; this makes me think there has to be a simple way to do what I'm trying here using just two MOSFETs but I cannot find it and, quite honestly, I think I may be too much of an amateur to know what the right terms are to search for it.

Anyway, sorry for the length but I wanted to explain what I was after and that I did try to find the answer before posting. Of course, if it goes like it does when I ask where the restroom is in a business then someone will point right over my shoulder behind me and say, "There.". :)

--HC

• posted

{ Snip }

While I'm not the one to answer this question, those people who can would likely want more details about the load. What, specifically, are you trying to do? There might be an easier and/or better way to do whatever it is you are trying to do.

Regards,

Mark

• posted

Use an h-bridge. An LMD18200T can handle 3A continuously. It's \$14 from digikey. You can get a pc-board to break out the weird pin spacing from

for ~\$2. You just feed the signal from the 555 to the "direction" input of the h-bridge. The outputs will flip-flop accordingly. There are probably other parts, but I happen to be using one of these right now to do precisely what you are describing.

• posted

By "square wave AC" do you mean you want a square wave output that goes 6 volts peak to peak or do you want it to go positive 6 volts, then negative 6 volts, for

12 volts peak to peak?

Ed

• posted

Hello, Ed. I want the latter; I want it to be +6 volts on one lead at one moment with ground/negative on the other lead at that moment, then swap them quickly (hence my use of the term square-wave) to reverse the polarity taking the first lead and making it ground/negative and the second lead +6 volts. The +6 volts comes from a wall-wart that converts 120 VAC to 6 VDC. I want the device I am looking for to just switch the positive output from the wall-wart with the negative output of the wall-wart so at one moment one lead from the device is connected to the positive 6 volts and the other lead is connected to the ground/negative of the wall-wart, and at the next moment swap them.

--HC

• posted

Take wall wart apart and bypass the diode thats converting the 6VAC to DC.

• posted

If by "the 6 volts", you mean from 0v at the bottom to 6V at the top, all you need is a switch.

To normalize it, i.e., make it zero-center, you'd just need a MONGO capacitor in series. The bigger the cap, the less the "signal" will droop between cycles.

I'm sure you can calculate the cap value needed to give an acceptable droop - just use that time constant formula; I'd also use a pretty hefty transistor - maybe even a complementary switch so you get a good solid pullup and pulldown.

Good Luck! Rich

• posted

fromwww.sparkfun.comfor ~\$2. You just feed the signal from the 555 to the

Thanks, Anthony. That is probably what I'll wind up doing.

--HC

• posted

I like that idea; it's simple and would probably work great. My only reservation in this application is that I want to be able to vary the frequency. But that's a good enough idea to maybe try to see if going to AC instead of DC will do what I want to do. Thank you.

--HC

• posted

Hey, Rich, yes all I want to do is switch "poles" from the wall-wart. I was hoping to use a couple of MOSFETs for the switches (like what you are saying about complementary switches) but when I search for DC AC inverters I keep getting inundated with results about commercial rigs for use in driving small appliances in your car, boat, etc. The next most common thing I find is when I search for MOSFETs and power switching I get H-bridges which are a bit more complicated than what I need (not by much but I like things to be as simple as possible). I read somewhere that a person can use two transistors to chop DC into AC but I do not know how to do it and have yet to find a design that seems that it would do it. I feel there should be an elegant and simple solution to do what I'm doing. Anthony posted about using a single package H-bridge controller which would work, it seems, no sweat, but I'd kinda like to make this device from scratch. Ultimately I need the solution so if I need to use a commercially produced H-bridge (like the one Anthony suggested) then I'll do it, but before I break down and do that I'm going to hold out for something just silly simple. :)

Thank you.

--HC

• posted

=A0

As others have said, the output stage is going to be a bridge (two P MOSFETs and two N MOSFETs). Easiest drive would require true and inverse square waves, and your timer only gives one of those, so I'd add a CD4013 flip-flop.

The flip-flop will divide the clock by 2 (you'll want to change the '555 range to 320 -21700 Hz), and has Q and not-Q outputs so there are no missing drive signals. It also makes a precise 50% duty cycle, which is important for several effects: (1) electrolytic corrosion (2) inductor saturation (3) speaker distortion

You should know that this kind of bridge output CAN get troublesome if the transition of the transistors takes significant time (because it shorts the power supply during the transition). There are tricks to prevent this effect, but your wallwart supply will just droop for a microsecond... if you filter the power into the '555 and flip- flop, it shouldn't hurt anything else.

• posted

Hey, Whit3rd, thank you for your reply. Okay, an H-bridge it is. Is it important which MOSFET I use for the P channel and the N channel in regards to whether or not they are "complementary" (a term I've seen)? I have BUZ11's to use for the N-channel (and some others like an IRF520, IIRC), and I have some IRF9540's for P channel. All of them, as I recall, will easily handle my 1.66 amp load, but I've heard the term "complementary" in a variety of locations. Any worries there?

What the CD4013 does sounds like exactly what I've been missing for driving both an N channel and P channel MOSFET; the ability to take a high output pulse and drive both kinds. That helps a lot. I'm going to grab the datasheet on that and see if I might have one somewhere in my odds-n-ends box.

Electrolytic corrosion? Like in electrolysis of water like we did in school? That takes me back. I thought we did that with just DC. It's off topic, sorry, but what impact does 50% duty cycle square-wave AC have on electrolysis (if that's what you're talking about with 'electrolytic corrosion')?

Thanks again.

--HC

• posted

Probably not in this application; if there were linear-amplifier application of the bridge amp, there'd be distortion if the transconductance of the output transistors didn't match. For switching, that won't be a problem.

If you ran outdoor lights with wet wires and DC, the (+) wire would corrode away to nothing very fast. Same wet wires and AC, you should expect less corrosion (and symmetric corrosion of both wires). The use of shock-safe voltages and AC is common in wet locations, because that's a backup plan if waterproofing and/or insulation fail.

• posted

Hey, Whit3rd, thanks for the answer. Sorry for the delay in response.

That makes a lot of sense about the wire degrading. I remember rusting out a few alligator clips when they got submerged in solution for electrolysis.

I did build an H-bridge (finally). It took a while for me to get the parts together (I buy all of my stuff about a hundred miles from here so I'm not there as often as I'd like). I got it to work after a little bit of a problem: apparently, while the rest of the electronics universe uses the convention for schematics of "top side is positive voltage" and "bottom side is ground" the world of MOSFET documentation deviates. The "drain" on the top of the schematic diagram for the p- channel MOSFET in the datasheet (http://www.ortodoxism.ro/datasheets/ fairchild/IRF9540.pdf) goes to ground while the source goes to positive. In retrospect I can see how to understand this from the names; SOURCE, um, where the positive power comes from, DRAIN, where it's going. But it would have been easier if the diagrams followed what I believe to be standard (it's a given here, by the way, that Fairchild knows a lot more about this stuff than I do so when there is a discrepancy between what I think should be done and what they do, they're probably right and I'm most certainly wrong; i.e. I'm not saying they're wrong by any means). It also would have helped if I had looked at the test-circuit schematics at the end of the document more closely (which is what ultimately straightened me out) and saw that the battery was depicted with negative at the top and positive at the bottom.

In any case, nobody's fault but my own and my lack of experience with these things. I put that little bit of info in here in case anybody reads this later on and has similar confusion to my own. There is a little blue cloud still hanging around in my electronics room from my frustration at why what should have been so simple just bloody wouldn't work and why the little suckers were getting so hot. :-) Live and learn. At least I didn't blow up any of the MOSFETs, I caught them in time before they got too hot.

When I got it working it worked very well, thank you. I ran it up to about 10kHz with no problems. The CD4013 was what I needed.

Thank you, and all who helped, again.

--HC

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.