Continue to Site

# LTSpice DC-AC

Status
Not open for further replies.

#### 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.

A voltage source in LTlspice can be assigned to be AC, DC, Pulse, etc. (but no PWM) as options.
You just pick the one you want.
Why is that confusing?

maybe that wasn't clear, I was confused why someone would create a dc-ac converter and then use pulse or ac as a source. forget that, I'm only interested in flipping the polarity of the voltage at some freq like 50hz

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.
It is quite simple to do what you have described. You can see both the current and the voltage changing directions. In addition this voltage source is parameterized so you can quickly change its properties. This voltage source does not have the intrinsic capability to do PWM. You need a behavioral source for that task. Do you need me to show you how that is done?

Last edited:
I was confused why someone would create a dc-ac converter and then use pulse or ac as a source. forget that, I'm only interested in flipping the polarity of the voltage at some freq like 50hz
Well that confuses me.
Who created a dc-ac converter with a pulse or ac source?
LTspice is designed to simulate all kinds of circuits, not just dc-ac converters, so there are options for other types of simulations.

it seems I have completely bungled this topic. My real world circuit has a single low voltage dc source. I would like to model in LTSpice a purely DC source and then try and change the direction of current. So, I must start with DC source. Almost all of the examples I've seen have used a non-DC input. So I'm struggling to even get an ideal ne555 timer to output correctly.

so, the idea was to use a timer to get a pulse that could flip switches, kind of like a bridge. but sadly I seem to be struggling with this first part and I'm really not sure that using switches with a timer would be the best option. maybe a cmos/pmos setup but I'm not smart enough with circuits so I thought I would ask for some ideas. It seems like this should be less complicated

I have read each of your posts very carefully and I'm still not certain what you are after. Look at the example in post #4 and tell me if you understand what is going on and we can move on from there. In post #1 you asked for a continuous DC source (actually an oxymoron) that periodically changes from +5V to -5V and +1A to -1A. You should be alert enough to realize that you cannot control both current and voltage independently. The reason the current in my simulation is 100 mA instead of 1A is because I chose the resistive load to be 50Ω. If I had chosen 5Ω instead the current would be going back and forth from -1A to +1A.

Please tell me you understand that if you do.

Last edited:
Yes, I am aware of ohm's law; they were just examples not requirements. You are using a source that outputs a square wave. That's pretty much exactly what I need. but from the perspective of this thread I have a set voltage source 5V DC. I cannot change that irl or in LTspice.

You could use a 555 configured as a 50Hz astable oscillator driving a bridge circuit (if the load can be floating (not connected to ground).
You would need a non-overlap driver for the bridge to prevent high shoot-through currents during switching (which can be done a couple NAND gate packages)

Last edited:
Ok, we're getting somewhere. The load would be floating so I'll be investigating this. I've read there is some issue with getting an oscillator to work in ltspice, I couldn't get an example circuit to work even using uic. I'll be trying this again though.

Here I have an inverter that starts with a +5V DC source and produces an AC output of 4.81V P-P or 3.4V RMS. Is this what you had in mind?

I couldn't get an example circuit to work even using uic.
Post you .asc file.

Post you .asc file.
I don't have this example in a standalone folder. I can make one up, but it may take me a while. Stand by
EDIT: Here it is. I'm using LTspice XVII so there may be some minor incompatibilities. I don't know if the MBR745 is in your standard.dio so I included it in the schematic as a comment.

#### Attachments

• Unipolar_Inverter.zip
6.4 KB · Views: 277
Last edited:
@Papabravo
yeah...that's kind of what I want except as simple as possible.. but that is generally what I had in mind for a bridge. The 555 timers are dirt cheap. I think crutschow's idea sounds good but I'll need some time to tinker with it. Going full on for a dc-ac converter is way outside of the scope of this project.

crutschow
I guess it wasn't uic, it was startup. It's not my file; found it on some forum, people said it worked. I tinkered with the source a bit but this is what I downloaded just to play around with. idk if it really didn't work or I did somethign wrong. edit; anyways I have no idea what he's doing with that transistor or why it would work that way. It's over my head.

#### Attachments

• 1 transister relaxation oscillator.asc
756 bytes · Views: 238
@Papabravo
yeah...that's kind of what I want except as simple as possible.. but that is generally what I had in mind for a bridge. The 555 timers are dirt cheap. I think crutschow's idea sounds good but I'll need some time to tinker with it. Going full on for a dc-ac converter is way outside of the scope of this project.

crutschow
I guess it wasn't uic, it was startup. It's not my file; found it on some forum, people said it worked. I tinkered with the source a bit but this is what I downloaded just to play around with. idk if it really didn't work or I did somethign wrong. edit; anyways I have no idea what he's doing with that transistor or why it would work that way. It's over my head.
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. All you are doing is charging the capacitor.

I have shown you the simplest possible DC-AC inverter. Please feel free to experiment with any other alternatives and let us know what you come up with.

Last edited:
alright so I saw a simple design on youtube for the astable oscillator and I just copied it and just played around with the values for the resistors and capacitors to get it around 50hz but I'm sure there is a relationship to these resistors and capacitors that isn't obvious to me. The video initially had the lower resistors at 440 ohms and the larger at 44k ohms, so 100 fold difference. with a 0.022uF capacitors. here's a pic and the file. also, If someone would be so kind as to explain how this works, I would be grateful.

#### Attachments

• astable_oscillator_5v.asc
1.2 KB · Views: 211

edit: I said it was youtube, which is true, the guy showed a circuit like this but I actually got an almost exact schematic off from Eric Gibbs on All About Circuits forum and that's where the values came from. but his was 15khz iirc.

Last edited:
If someone would be so kind as to explain how this works
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.

The circuit is called an astable multivibrator.

Status
Not open for further replies.

Replies
63
Views
6K
Replies
8
Views
1K
Replies
4
Views
347
Replies
21
Views
2K
Replies
2
Views
811