# LTspice 2 grounds for AC PWM control by mosfets

I'm working on a AC PWM controller with 2 mosfets. It took me a long time to get this to work in LTspice but i still can't get it to work. I send pulses to the mosfets to generate the PWM modulation on the AC side. Everything works until i want to implement an optical galvanization. For this i would need to define 2 grounds in LTspice and this is the point where things start to get weird. I've already looked on the internet for more information about this topic. In LTspice you can only define 1 ground node, this is the reference voltage from where LTspice starts to calculate. If i want to use a second ground i have to use the COM node. I tried to do this but it still doesn't work. I know my mosfet part works and i know my opto coupler part works. When i try to connect both LTspice starts to behave strange. I've connected the COM node and GND node with a 99M resistor( this was a solution i found online) but this doesn't work at all. How can i get this simulation to run? Attached are 2 print screens. The first is a working mosfet switch, the second is with the opto coupler. I hope somebody here can help me to get this to work.

Thank you all!

• you need to simulate everything with one GND... there is no galvanic isolation in spice. Sep 30, 2020 at 14:33
• What do you hope to achieve with the 2nd schematic? Do you really intend to drive two power MOS with an optocoupler in series wth a 100k resistor (connected to mains, by the look of it, even if rectified)? Sep 30, 2020 at 14:42
• @aconcernedcitizen yes, the 100K and 10K resistor act as a voltage divider so my opto doesn't blow up. It's not going to be a product that i'm going to sell but i don't see a reason why this won't work? I might need to choose other voltage divider resistors that can deliver more current. Sep 30, 2020 at 14:47
• @MichielReyntjens Not only the optocoupler is strongly dependent on the current collector, but the time constants -- even without the transistor -- will be in the tens of microseconds, if not more. Think of what that will do to the power dissipation. Try reading this and other similar documents about this, because your words "i don't see a reason why this won't work" are on the worrying side. Sep 30, 2020 at 15:18
• @aconcernedcitizen i didn't thought about this. Rise time according to spice is 50ns so that shouldn't be a problem. Fall time is 250micro seconds so i should find a solution for that. Sep 30, 2020 at 15:34

• Just a note, this is the behaviour of SPICE since 40+ years ago: everything needs to be referenced to the global node zero (0). Also, no need for such extreme values (1G || 1p), when even in real SMPS you find connections of 1Meg || 1n (or similar) between primary and secondary. Sep 30, 2020 at 14:40