0

I wanted to simulate an LDR and a specific case where I have a bright LED using PWM.

This is the schematic:

Schematic

I was changing the resistor as stated here which comes from a previous discussion stackexchange link.

However, this is not producing the same results as show in the first link:

transient response

As you can see in the picture there is no linear relationship between the voltage in the pulse and the resistance value (282V doesn't correspond to 282 ohms,etc...) and the resistance value doesn't stay on despite the pulse showing a correct form.

I am trying to simulate the voltage between the capacitor.

Is there any other way to do this? I know about the method of putting the expression on resistor value but as it is a pulse it quite difficult to do this.

1 Answers1

0

First of all, you need to draw your circuit a little better so it's not confusing to people trying to look at it. Here's my version of it:

enter image description here

Second, I believe the problem you're having is you want to plot the resistance of R2 but you're not defining your plot expression correctly. To make it easier, I labeled points on each side of the resistor (IN and OUT) because the resistance should equal the voltage across the resistor divided by the current through it. To do a differential voltage measurement in SPICE you separate two nodes with a comma. So in this case the resistance of R2 should be: V(OUT,IN)/I(R2)

enter image description here


In SPICE, pin 1 and 2 of resistors are slightly different so you can get negative results doing this calculation. If you don't want to deal with the nuances of this, I recommend taking the absolute value using the abs(x) function. For example:

enter image description here

Ste Kulov
  • 3,771
  • 10
  • 22