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.

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.
 

crutschow

Well-Known Member
Most Helpful Member
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?
 

Gintoki

New Member
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
 

Papabravo

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.
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?
1659130916378.png
 
Last edited:

crutschow

Well-Known Member
Most Helpful Member
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.
 

Gintoki

New Member
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.
 

Gintoki

New Member
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
 

Papabravo

Well-Known Member
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:

Gintoki

New Member
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.
 

crutschow

Well-Known Member
Most Helpful Member
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:

Gintoki

New Member
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.
 

Papabravo

Well-Known Member
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?
1659138823221.png
 

Papabravo

Well-Known Member
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: 13
Last edited:

Gintoki

New Member
@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: 18

Papabravo

Well-Known Member
@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:

Gintoki

New Member
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.
1659396985579.png
 

Attachments

  • astable_oscillator_5v.asc
    1.2 KB · Views: 7

Gintoki

New Member
1659397233763.png

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:

crutschow

Well-Known Member
Most Helpful Member
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.
 

Latest threads

New Articles From Microcontroller Tips

Top