pfalstad / circuitjs1

Electronic Circuit Simulator in the Browser
GNU General Public License v2.0
1.71k stars 286 forks source link

Simulation wrong for reverse diode? #75

Open smd100 opened 7 months ago

smd100 commented 7 months ago

Hi. I am teaching electricity to my high school students. I tried connecting 3 circuits to a 5V DC voltage source (attached as images). The first has a resistor, an red LED and a 1N4004 diode in series (forward biased). Voltage drops look fine. The second is the same but the LED is reversed. Voltage drops look fine still. The third is the same as the first one, but this time the diode is reversed. This time, there is only 4.488 volts across the reversed diode, not 5 volts as I would expect (like we get in circuit 2). Am I missing something, or is the simulation wrong? Thanks, Steve

circuit1 circuit2 circuit3

pfalstad commented 7 months ago

So in the 3rd one, the LED is forward biased, and the diode is reversed?

It seems right. The saturation current of the diode (roughly, its reverse-bias current) is 18nA. With the LED model I'm using, it has 512mV of voltage across it when passing 18nA of current. So the diode has to make up the difference.

I wouldn't expect the diode to be at exactly 5 V. Then the LED would have 0V across it, and there wouldn't be any current at all.

The diode LED model could be a bit simplified, or may not match the LED you're using, but you can replace it with another one that matches your device.