sharpie7 / circuitjs1

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

Diode behavior seems to be incorrect #563

Closed atomroflman closed 3 years ago

atomroflman commented 3 years ago

I've been creating a circuit to check if a 12V input is switched or not.

My expectation is, that the diode blocks voltage from the 12V line and the 3.3V should be measured at the output if 12V is connected. If the switch is open the measurement should be close to the diode voltage loss.

image

Correct me if I am wrong, but I think the calculation seems to be wrong.

pfalstad commented 3 years ago

Well, the position of the switch doesn't matter at all, since the left side of the 1k resistor is going to be at 0V no matter what. The switch position only affects the current through the 100 ohm resistor.

Because the 1 megaohm resistor is there, the current through the diode is going to be very small and a voltage drop of about 150 mV sounds about right. The diode voltage drop depends on current of course.