Solid State Relay simulation

Hello,
I’m pretty new in using Spice Simulator with Kicad and I started simulating a really small part of my actual circuit. For now what I want to test is the behaviour of VO14642AT (Datasheet: http://www.vishay.com/docs/81646/vo14642a.pdf) when I power it with a square wave (0-5V, pulse width 2ms and period of 33ms). This relay works as a switch, and when it is powered with 5V it allows the current to flow through the MOSFET (which is on the output side). I put a resistance on the output connected to a 5V power source, such that the voltage on the resistance should be 0V when there is no current on the output, while it should be -5V when the output current is enabled. What I observed running the simulation is that the current on the resistance is always 5V, meaning that I am doing something wrong.
This is my schematic:


I took from here the Spice model for the relay: http://www.vishay.com/ppg?81646&designtools-ppg

Additionally, when I run the simulator an error appears:
Error: unknown subckt: xu1 in 0 0 nc_01 net-r1-pad1 vo14642_ct

Thank you in advance!

3 Likes

The error message tells us that the model has not been added properly.

Please have a look at the data sheet for the dc usage of this device.

The input is a LED to be driven in forward mode. You cannot use 5V pulses forward on a diode! Use a suitable input current instead, e.g. by adding an input resistor in series to the pulse source.

1 Like

This is the Spice Netlist:
This is the Spice netlist:
.title KiCad schematic
.include “/Users/giuliacrocioni/Desktop/prova_spice/led/VO14642.lib”
Vin in 0 PULSE 0 5 1u 1u 1u 2m 33m
Vcc Vcc 0 dc 5
XU1 in 0 0 NC_01 Net-R1-Pad1 VO14642_CT
R1 Net-R1-Pad1 Vcc 10
.save @vin[i]
.save @vcc[i]
.save @r1[i]
.save V(0)
.save V(GND)
.save V(Net-R1-Pad1)
.save V(Net-U1-Pad5)
.save V(Vcc)
.save V(in)
.tran 1u 200m
.end

This is a somewhat strange error:
The files VO14642.lib and VO14642.txt offered by Vishay are not readable by ngspice, because both are encoded in UCS-2 Little Endian.

This can be repaired (under Windows) by opening either file in notepad++ and changing its encoding to UTF-8.

Do you know why this thread in KiCad Info is hidden? I think it is valuable enough to be openly visible.

I have a Mac, do you know how to change the encoding in iOS?

I changed the pulse voltage to 1.3V and now I have an output signal which makes sense. Thank you!

When I reopen Kicad and the project (also loading it and opening the file .pro) the simulator tells me that there are no circuits loaded. I have to delete one component and when I put it again in the schematic everything works. How can I give the right path to the simulator?

No I am sorry, I have no idea about that.

Not sure what happened or who flagged the lead post. I’m not sure if that hid the thread or a software error did. Generally you see an indication on who did what but I see nothing indicating the thread was purposefully marked ‘hidden’. But, I don’t know this software that well.

Sophisticated newbies (posting like a ?-week member) are automatically suspected of being spam-bots - should be back to normal now.

@giuliacrocioni
I sped up the process and pushed you to level 1 user. Welcome to the forum. :wink: :crazy_face:

1 Like

I changed the encoding to UTF-8, but now the problem is that the output current is really really low (nA) and this shouldn’t be since this relay is used to have high output current.
This is the spice model .lib that I am using:

.SUBCKT VO14642_CT A C S1 DC S2
W1 DC S2 Vsensor SSR_switch
R2 DC C1 100Meg
W2 S1 DC Vsensor SSR_switch
F1 C C1 V1 1
V1 A C 0
Vsensor C1 DC 0
.model SSR_Switch CSW(Ron=0.125 Roff=500Meg It=2mA Ih=0.5ms)
.ENDS VO14642_CT

Is there something wrong in the model? How can I check it?

No, besides the encoding the model seems to be o.k. I took your netlist given above, added a 1k resistor between the pulse source Vin (node in) and the SSR (XU1, node in), included the model from your previous post and ran this in standard ngspice (I have no KiCad at hand here). Watching Net-R1-Pad1 or @r1[i], the result seems to be o.k. as well.

1 Like

Now I put a resistor of 3k in input in series with Vin, and the result in the input side makes sense.
This is the circuit that I am using now:

I used R2 on the output side, with a value of 10 Ohm, but when I plot I(R2) (output current) I obtain a very low current. I need 200 mA minimum on the output to power a high efficiency LED. This is the plot of I(R2) that I obtain:

And finally this is my SPICE netlist for this new simulation:
.title KiCad schematic
.include “/Users/giuliacrocioni/Desktop/prova_spice/led/utf-8-encoded-relay.lib”
XU1 Net-R1-Pad2 0 0 NC_01 Vout VO14642_CT
Vin Vin 0 PULSE 0 1.3 0 0 0 2m 33m
R1 Vin Net-R1-Pad2 3k
Vdd Vdd 0 dc 5 ac 0
R2 Vdd Vout 10
.save @vin[i]
.save @r1[i]
.save @vdd[i]
.save @r2[i]
.save V(0)
.save V(GND)
.save V(Net-R1-Pad2)
.save V(Net-U1-Pad5)
.save V(Vdd)
.save V(Vin)
.save V(Vout)
.tran 10u 0.5
.end

I used this relay, I measured output current with an oscilloscope and instead I obtained really high output current. I’m really confused!

Datasheet, page 3:

Max turn-on current 2mA
1.3V/3k < 2mA!
Better use 5V pulse and 1k resistor to fully switch on the device.
And use the “DC only configuration” for best output performance (lowest on-reistance).

1 Like

Thank you so much, with that values it perfectly works. Still, it’s not clear to me why. I mean: from the Datasheet pag. 3 I read max forward current 2mA and max forward voltage 1.5V, and I interpret it by placing lower values of both current and voltage (ex 0.5mA and 1.3V), and not higher. What am I missing?

It is the maximum current that may be needed to switch on. Some samples need less, but there may be some needing 2mA. So to safely switch on, add some more.

And you may have a look at the model, that simplifies the internals of the circuit a lot. There is a current controlled switch CSW with a 2mA threshold current It.

2 Likes

@giuliacrocioni Where did you find the nice symbol for the VO14642? I got the spice model from the link you provided but no symbol.

I’m not sure if giuliacocioni is still here, however, if you press ‘a’ for add in Eeschema and then type “relay” you find a few libraries with relay related stuff, including a library with the name “Relay_Solidstate” which has about 80+ symbols for different solid state relays.

You can use any symbol that matches the pin numbers of the footprint of your relay and can change the “value” field of the relay symbol after placement to change the device name. If you change such things, then also make sure to check the Footprint link of the schematic symbol.

1 Like

@paulvdh Oups sorry, in fact I’m using LTspice and I landed on the wrong forum :smiley: Well, I also use KiCad for my PCBs but never used its simulator, maybe this is the good opportunity to start using it :wink: I’ll check it out

Since this got bumped, I thought I’d take a look at Vishay’s subcircuit model for this thing.

* VO14642 CT SSR SPICE MODEL
*                           LED ANODE
*                           | LED Cathode
*                           | | Pin 4 SSR contact
*                           | | |  Pin 5 CT
*                           | | |  |  Pin 6 SSR contact
*                           | | |  |  |

.SUBCKT VO14642_CT          A C S1 DC S2
W1 DC S2 Vsensor SSR_switch
R2 DC C1 100Meg
W2 S1 DC Vsensor SSR_switch
F1 C C1 V1 1
V1 A C 0
Vsensor C1 DC 0
.model SSR_Switch CSW(Ron=0.125 Roff=500Meg It=2mA Ih=0.5ms)
.ENDS

It’s easier to analyze if you “decompile” the code back into a schematic, so that’s what I did and also made sure the “re-compiled” netlist matches the original.

This is actually my first time encountering F-sources and W-switches, so I had to study up on those. Therefore, I have to admit that it’s totally possible I might be missing something…but I don’t understand what they are trying to do with this model. At the minimum, it doesn’t properly model the LED voltage drop so the current between A and C is going to be way off. Additionally, the scheme with the F-source makes no sense to me and nothing ever flows through that 100meg resistor because Vsensor is always shorting it out. The hysteresis current on the W-switches are too high so they don’t turn on until 2.5mA through the non-existent LED.


If I slightly modify their scheme to something that makes more sense to me, I get something that works much better when hooked up in its intended operation.

.subckt VO14642
W1 DC S2 V1 SSR_switch
W2 S1 DC V1 SSR_switch
V1 A C 1.3
.model SSR_Switch CSW(Ron=0.125 Roff=500Meg It=2m Ih=10u)
.ends

Then, you can take it step further by putting in an actual LED model, voltage controlled switches, and a couple resistors to model isolation resistance.

.subckt VO14642
D1 A C LED
S1 S1 DC A C SSR_Switch
S2 DC S2 A C SSR_Switch
R1 S1 C 2t
R2 S2 A 2t
.model LED D(Is=10u Rs=2 N=8 Cjo=1n Tt=1n Xti=100)
.model SSR_Switch SW(Ron=0.125 Roff=500Meg Vt=1.1 Vh=10m)
.ends

Of course, you can take it even further by using actual FETs for the switches (to model sub-threshold conduction; useful for power dissipation) and also using non-throwaway values for the LED’s Cjo & Tt (to model turn on/off time). As the circuit designer, it’s up to you to know what you need modeled and if those properties are actually included in the model or not.

Anyway, the point of posting this is I thought it was a good example to show that manufacturer-supplied SPICE models shouldn’t be taken as gospel. Especially if it’s a subcircuit with only a few lines, it might be worth taking a closer look at before using it.

1 Like