# LTSpice DC-AC

#### Gintoki

##### New Member
Hello,
I want to create the most simple, efficient way to change current direction in a circuit. essentially dc to ac. I don't want a sine wave. What I'm especially confused about is why the dc source has options for PWM and Sine wave. I need continuous dc from the source, then flip it. 1A to -1A; 5v to -5v. I understand this isn't going to be a perfect square wave, I just want a proof of concept. I can visualize doing this with switches and using something like a 555 timer. but I think I'm missing something with LTSpice. Any ideas? Most of what I've seen changes the voltage source to PWM or Sine for DC. I don't understand that.

#### eTech

##### Well-Known Member
Hello,
I want to create the most simple, efficient way to change current direction in a circuit. essentially dc to ac. I don't want a sine wave. What I'm especially confused about is why the dc source has options for PWM and Sine wave. I need continuous dc from the source, then flip it. 1A to -1A; 5v to -5v. I understand this isn't going to be a perfect square wave, I just want a proof of concept. I can visualize doing this with switches and using something like a 555 timer. but I think I'm missing something with LTSpice. Any ideas? Most of what I've seen changes the voltage source to PWM or Sine for DC. I don't understand that.

Hi

You can have simple...but not cheap. See below.
The L298 chip is designed for bipolar motor driving and can drive up to 3A, but it can drive a resistive load as well.
In the circuit below, the inductor would be replaced by a resistive type load and the diodes removed. The switch can also be replaced with a clock generator (astable multivibrator).
However, the L298 cost about 8.00 USD ea.

#### Gintoki

##### New Member
Looking at the transistor base voltages will help you see how it works.

Assume that Q2 is on and Q1 is about to turn on.
When Q1 turns on its collector goes from 5V to 0V.

This is coupled through the C1 to Q2's base, which had been turned from current through R3 on with about 0.7V Vbe.
The 5V-0V through C1 causes Q2's base to go to about -4.3V, turning it off.

(This generates a 0-5V pulse at Q2's collector which generates a positive pulse through C2 and into Q1's base, fully turning it on.)

C1 now charges through the 5kΩ resistor until it reaches 0.7V which again turns on Q2, which in turn turns Q1 off, to complete the half cycle.

A half cycle takes about 2/3 of an R2C1 time-constant.
okay I did a bit of testing on it and what you said makes sense. I am wondering though where you got the 2/3rds number from. Is that some kind of constant or based on an equation? Or did you just notice that it's roughly 2/3rds? The closest I've got is 49.7 hz (close enough for me).

#### Gintoki

##### New Member
Maybe I should have mentioned this but the entire reason I want alternating current is to create a small magnetic field in an inductor, maybe even single turn to induce very small currents in another wire (although this part is not necessary atm). I know there's a dozen ways to do this but the idea is as cheap as possible and as simple as possible. Now, I have no idea what the outcome of this is but I wanted to test it for myself. I have maintained an assumption that I should be able to get a magnetic field, the quality and efficiency is probably going to be poor or other problems will arise but I wanted to take small steps to see it for myself.

#### eTech

##### Well-Known Member
Maybe I should have mentioned this but the entire reason I want alternating current is to create a small magnetic field in an inductor, maybe even single turn to induce very small currents in another wire (although this part is not necessary atm). I know there's a dozen ways to do this but the idea is as cheap as possible and as simple as possible. Now, I have no idea what the outcome of this is but I wanted to test it for myself. I have maintained an assumption that I should be able to get a magnetic field, the quality and efficiency is probably going to be poor or other problems will arise but I wanted to take small steps to see it for myself.
Post #21 will do what you want, but your spec requires a high current driver, so it won't be cheap.

#### Roff

##### Well-Known Member
I'm attaching the .ASC file of an astable multivibrator (discussed earlier) driving a MOSFET bridge. The wire you want to reverse the current through is represented by the 1 milliohm resistor (Rwire). The simulation won't run if you try to make the value zero ohms, but you can pretty much make it arbitrarily small (I also tried 1u ohm). There is a little crossover distortion, but that shouldn't be a problem.
I picked MOSFETs from the LTspice library somewhat (but not entirely) arbitrarily.
This simulation was run on LTspiceXVII.

#### Attachments

• current reversal.asc
3.2 KB · Views: 14
Last edited:

#### Gintoki

##### New Member
It's sad how much time I spent on my h bridge. I learned quite a bit but this is exactly what I needed. I want to ask you a few questions about how you got this to work once I spend a little time on it. For now I'm interested in why you used 5 ohm resistors on the bottom H transistors.

#### crutschow

##### Well-Known Member
I'm attaching the .ASC file of an astable multivibrator (discussed earlier) driving a MOSFET bridge.
You can save a 5 ohm resistor if you put one in series with the bridge power instead of one in series with each of the N-MOSFET's source terminals.

#### audioguru

##### Well-Known Member
Your 1 Transistor circuit cannot work. It has no connection to the base terminal which is responsible for biasing the device into its active region.
No. The circuit works fine as a standard relaxation oscillator with avalanche breakdown of the reverse-biased emitter-base.

#### Attachments

• relaxation oscillator.png
44.2 KB · Views: 11

#### Papabravo

##### Well-Known Member
That may be the case for a real part, but his original simulation only charges the capacitor and fails to oscillate. Is the model not simulating the reverse breakdown characteristic of the 2N2222?

#### Gintoki

##### New Member
Here's my attempt using my values with npn and pnp bjt's that I have laying around irl. I'm getting about one third of an amp compared to the nearly 1 amp I got using the mosfets that Roff used. 300mA is good for me but I'm wondering why there's such a difference.

#### Papabravo

##### Well-Known Member
The Vce drop of a bipolar transistor exceeds considerably the Vds drop of a MOSFET with a low rds(on). One Ampere through an rds(on) of 20 mΩ gives a drop of 20 mV -- hardly noticeable. For the BJT 300 mA times 0.2V implies an impedance of 667 mΩ. As you can see that is more than 2 orders of magnitude difference.

#### rjenkinsgb

##### Well-Known Member
Here's my attempt using my values with npn and pnp bjt's that I have laying around irl.
The configuration looks like it cannot work; the lower transistor base-emitter junction will conduct from about 0.6 - 0.7V and prevent the upper transistor ever achieving any significant base (or emitter) voltage?

With two complementary transistors in each side of the bridge, they need to be either both emitters to output (NPN at the top) or both emitters to power/ground (and NPN to the bottom.

The same applies to complementary MOSFETS - sources together or power/ground.

Note that with emitters or sources to power and ground, the base or gate drive signals must be separated to avoid both devices turning on together and shorting the supply as the drive voltage passes through the mid supply range.

#### Gintoki

##### New Member
The configuration looks like it cannot work; the lower transistor base-emitter junction will conduct from about 0.6 - 0.7V and prevent the upper transistor ever achieving any significant base (or emitter) voltage?

With two complementary transistors in each side of the bridge, they need to be either both emitters to output (NPN at the top) or both emitters to power/ground (and NPN to the bottom.

The same applies to complementary MOSFETS - sources together or power/ground.

Note that with emitters or sources to power and ground, the base or gate drive signals must be separated to avoid both devices turning on together and shorting the supply as the drive voltage passes through the mid supply range.
I'm not really following what you're saying. If it doesn't work, could you please provide a way to satisfy your concerns that I could test in ltspice? It sounds like you're saying I need 4 npn transistors in my bridge.

Replies
18
Views
2K
Replies
33
Views
3K
Replies
28
Views
2K
Replies
6
Views
2K
Replies
21
Views
6K