Why Is This Simulation Circuit Passing Negative Through Diode - Page 1
Forum section: electronics / projects

author: bostonman
author_rank: Super Contributor
timestamp: April 03, 2024, 03:45:11 am
content: The attached circuit is from Microcap. The input is +/-5V square wave and I'm measuring voltage at three nodes (input, base, and collector).As the waveform shows, the input waveform is correct, but I'm baffled why the base is going below 0v because the diode should block negative pulses. Also, the collector is going below 0v and spiking to 16v.The base still drops below 0v even if I place another diode between the base and ground (and the collector is always off).Did I do something wrong, or am I wrong about how this circuit should work according to my thoughts?

author: Berni
author_rank: Super Contributor
timestamp: April 03, 2024, 05:31:32 am
content: Yes anidealdiode blocks all reverse current, but what you have there is an 1N4001.Real world diodes also have leakage, capacitance, reverse recovery..etc This is why diodes have datasheets to tell you exactly how non ideal that particular diode is, helping you select the most appropriate diode for your application out of the many many diodes available on the market.

author: moffy
author_rank: Super Contributor
timestamp: April 03, 2024, 05:37:38 am
content: When a diode is forward conducting it has a lot of charge/carriers stored within it, before it can block in the reverse direction these carriers need to be removed by a reverse current flow and natural recombination. Until that happens it looks a bit like a short circuit.

author: Zero999
author_rank: Super Contributor
timestamp: April 03, 2024, 01:32:56 pm
content: The simulator is modelling the diode accurately. This is exactly what you should expect to happen, for the reasons mentioned by everyone above.The question is why is the diode there in the first place? The square wave only goes down to -5V, which the 2N2222A can handle with no problem. It's well below the maximum base-emitter voltage of 6V.https://www.onsemi.com/pdf/datasheet/p2n2222a-d.pdfRegarding the collector voltage spiking. The most likely explanation is there's some inductance in the model.

author: bostonman
author_rank: Super Contributor
timestamp: April 03, 2024, 05:57:46 pm
content: I'll watch the videos tonight - I didn't want anyone thinking their feedback was getting ignored.

author: iMo
author_rank: Super Contributor
timestamp: April 03, 2024, 07:02:19 pm
content: fyi - this is how the LTspice sees it..That sim results may depend on the type of diodes/transistors used, their models quality, math precision set, input signal edges rise/fall times, etc.

author: bostonman
author_rank: Super Contributor
timestamp: April 07, 2024, 02:50:31 pm
content: I watched the videos last week, but wanted to give it more thought before responding.Unfortunately I lack design experience. My background is electronics, my company titled me 'EE", but feel I'm not an EE, however, also know I'm more advanced than a "technician". Sadly I've been caught in this middle area for many years and it's issues such as this diode question that confirm I lack some basic design knowledge.In any case, the videos were a great help, but, now that I've absorbed them, have a few questions. First off, the reason for using the diode (ignoring I thought using just a transistor wasn't enough) was to demonstrate to someone the basics of an oscilloscope by using a function generator and an LED. This would allow a person to see the LED blinking and the pulses on the scope. Although alternatives probably exist to accomplish this, maybe it's best to stay on the topic of diodes. My goal was to block negative pulses and somewhat isolate these negative pulses from the generator.My "design" used a 1N4001, and, before watching the videos, didn't know/realize it had limitations. The datasheet shows 15pF and a 1N914 shows 4pF. Per the video and my new understanding, is this capacitance the only spec needed to consider for such a design? The frequency was only going to be a few Hertz up to maybe 100Hz (to show the LED no longer appears to blink, but a pulse is still present and the frequency can be measured).The 1N914 is titled "fast switching" whereas the 1N4001 is "general", but, as stated above, my lack of design experience forced me to not realize the differences between both diodes other than their titles.If the frequency is between 1 and 100Hz, am I to search for a diode with a specific capacitance and what is the best way to calculate whether it's fast enough?My other question is regarding the biasing voltage. Although I need to watch the videos again, it seems the biasing voltage allowed the signal to pass. If the input signal is already going 0 to say 12v, why would additional biasing voltage be necessary (ignoring the <0.7v isn't being passed)?

author: Berni
author_rank: Super Contributor
timestamp: April 08, 2024, 05:37:18 am
content: As said above, you don't really need a diode there since most BJT transistors can handle -5V applied to the base just fine, Using a MOSFET in place of the transistor would also work just fine.The issue in your circuit is that the diode has a reverse recovery time. It is a common fault of silicon diodes where if the diode is conducting and you swap the polarity it does not turn off instantly, but lets a bit of reverse current flow for a brief period before it properly shuts. You can imagine it as a one way valve for water that needs to have its flap inside swing back to actually seal in reverse again. Your particular circuit makes this effect particularly visible since you have a considerable amount of current flowing in the forward direction, but then when flipped there is nowhere for the current to flow because the BJT is blocking it, so the diode is free to pull the voltage to whatever with even a little bit of leakage. Having near 0 reverse current flow also makes the reverse recovery even longer (since the current can help turn off the diode)But say you had a +/- 20V signal(where the BJT could get damaged). If you want to optimize for fast reverse recovery you want a schottky diode (orders of magnitude faster reverse recovery times). However you can easily make this circuit work fine with any diode. Just move the diode to be between base and ground. That way as soon as you swing the base lower than -0.6V it sinks that into the ground. No fast reverse recovery needed.

author: bostonman
author_rank: Super Contributor
timestamp: April 09, 2024, 07:11:30 pm
content: QuoteThe visual helps and the videos, including explanations, have expanded my knowledge of diodes.The 1N4001 datasheet (or at least the datasheets I've looked at) don't specify a reverse recovery time, just the capacitance. If hypothetically I had to go exclusively by datasheets to select a diode (ignoring I don't need a diode in my application and/or can use a FET), which parameters would I look for and how would I calculate the correct diode to use?As an example, if I inject a 60Hz signal, the period is 16ms. If a diode has a reverse recovery time in ns, then it should turn off sooner than the 8ms of the negative swing and I'd select this diode. As the videos outline, it's also capacitance that dictates this and the difference of (rounding off) 10pF (7 on the 1N914 versus 16 or so on the 1N4001) doesn't seem significant enough to change things.When I replaced the 4001 with a 914 in my simulation, I still had poor recovery time and added a low value resistance to bleed the capacitance charge quicker which made a difference.

author: kevin.gibbs
author_rank: Regular Contributor
timestamp: April 10, 2024, 01:48:38 pm
content: Try putting just one diode between the base and the emitter. It should be a little better than what is currently on the graph. You can also use a higher-frequency diode.The resistors should be swapped.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: April 10, 2024, 03:58:29 pm
content: SPICE diodes are somewhat notoriously hacky; you simply don't have enough (any) current flow to discharge the nonlinear capacitor that's used to model recovery (you can read more about that here:https://ltwiki.org/files/SPICEdiodeModel.pdf). The B-E junction recovers first (compare TT parameters of diode and BJT) and the diode stays conducting thereafter.In the real world, 1N914 should be fast enough to recover before the BJT, but, keep in mind, that then means there's nothing to pull charge out of the B-E junction, and it'll linger on for some microseconds until slowly turning itself off (recombination).Incidentally, real 1N4001s are just 1N4007s with different markings; or maybe -5 or -6, but in any case Vbr and t_rr don't vary much across the series. If you had a real minimum-datasheet-spec series, the would-be important part, is that t_rr correlates positively with Vbr; but since they're basically all the same parts, t_rr is the same about 3 or 4 µs across the series.Tim

author: MarkT
author_rank: Frequent Contributor
timestamp: April 13, 2024, 12:52:11 pm
content: Basically the 1N4001 is sloooowwwwwwwww, and heavy duty (lots of capacitance, handles 30A pulses). Its designed for rectifying 50 or 60Hz, not responding to sub-microsecond edges.1N4148 or 1N914 as mentioned are appropriate for this sort of use, 4ns switching time and very little capacitance.

author: bostonman
author_rank: Super Contributor
timestamp: April 14, 2024, 02:47:37 pm
content: The feedback has helped.I was trying to keep the frequency below a few hundred Hertz and thought one of my simulations still had negative pulses.What calculation(s) are used to select an appropriate diode for a specified frequency so it switches fast enough? Until this thread, I thought the main parameters to look for with a diode was current, power, and voltage, so I'm on uncharted territory at the moment.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: April 14, 2024, 07:40:55 pm
content: What are you trying to switch? Input V, I? Output V, I? Rate?Possibly, your circuit is going down the wrong path, and you're now stuck optimizing parameters that no one needs to, because there's a better, as-yet-unrealized solution you can't find from here.Diodes are rated in capacitance, small-signal reverse recovery (fixed impedance), power reverse recovery (dI/dt commutated), and occasionally softness factor (time spent "on" but If reversed, vs. turning off (|If| falling, Vr rising)), and forward recovery (some dI/dt-dependent voltage overshoot, before settling to Vf).In the circuit above, the small-signal case would be the closest, but it's missing the fixed impedance environment: either the diode or B-E junction recovers first, and then the node is left floating. There needs to be a load (B-E) resistor to sink both junctions. But it's not clear what you're up to with the diode in the first place, hence the top questions.Tim

author: bostonman
author_rank: Super Contributor
timestamp: April 15, 2024, 01:38:57 am
content: This began with the desire to provide a visual for someone on what an oscilloscope does. I thought to connect a function generator to an LED and pulse it; this way the person can see the light blink and the pulses on the scope.As others have pointed out, this circuit isn't correct. The diode isn't needed, the generator can probably power the LED alone, etc.Ignoring the fact this circuit can be improved, at this point, I'd like to consider it being a practical circuit and therefore trying to understand more about how to find the correct diode for frequencies around 300Hz and below (I figure blink the LED from 1Hz to fast enough to make it appear on).Obviously the feedback in this thread provided has taught me a 1N914 is more practical for this design and the title of the datasheets specify "fast switching" versus "general purpose", but, as mentioned, I'd like to understand mathematically how I'd select the correct diode(s) that would switch correctly.

author: IanB
author_rank: Super Contributor
timestamp: April 15, 2024, 01:50:38 am
content: Going with the circuit you presented in your first post, why don't you put a pull-down resistor between the transistor base and ground, something like 10k? That will ensure the transistor base is at 0 V whenever the diode is not conducting. And when the diode is conducting, it will turn the transistor on.

author: bostonman
author_rank: Super Contributor
timestamp: April 15, 2024, 02:12:28 am
content: With the exception of about a 7us negative pulse at the base just after the input pulse goes negative, and a 400ns negative pulse on the collector, the 10k works fine.