7

I need to generate a +/-12 V square wave, +/-0.4 V tolerance is allowed. The purpose is to drive the pilot signal of an electric vehicle level 2 charger, for those curious.

EDIT (clarification): what I'm trying to design here is the EVSE controller depicted below (the part enclosed in red). As you can see, the output of the circuit is +/-12 V PWM signal in series with a 1 KΩ resistor that is normally open-ended if no car is connected, or pulled to ground through different resistance values by the car to signal different states when it's connected to said car.

enter image description here

END OF EDIT

This is both a hobby project and brain exercise for me, so I would like to use discrete components that I already own, namely BJTs and resistors, while avoiding opamps since the ones that can achieve rail-to-rail outputs within the desired specs are hard to source for me. I'm also aware that a simpler solution would be a MOSFET push-pull stage but as I mentioned before, this is also about trying to understand BJTs better.

This is the schematic I came up with:

schematic

simulate this circuit – Schematic created using CircuitLab

Note that I used a common-emitter push-pull output as opposed to the more usual common-collector because the 0.7 V dropout of the emitter followers would be out of the required specs (+/-0.4 V around rails)

Q1 takes its input signal (0..3.3 V) from a microcontroller and drives Q2 between cutoff/sat.

When IN is 3.3 V, Q2 is off and node A has ~11 V which saturates Q4 while keeping Q3 "almost" off. As a result, OUT has a voltage of -11.8 V, which is well within the desired +/-0.4 V tolerance.

When IN is 0 V, Q2 is on, A has around -11.8 V, which saturates Q3 while keeping Q4 off. In this case OUT shows +11.8 V, which is also good.

However I can see two minor problems:

  1. As you can see in the plot below, V(OUT)'s high to low propagation delay is about ~4 µs longer than that from low to high, and I can't really grasp why. As a result, OUT's duty cycle is higher than that of IN so it needs to be compensated from software, which I'd rather not do.

    Enter image description here

  2. There's some shoot-through current through Q3 and Q4, though not alarming, I'd prefer to not have it. An inductance + fly-back diode might be necessary, but I wonder if this problem is derived from the previous one and fixing it would also fix this.

    Enter image description here


Simulation of various solutions provided below

For study and comparison purposes. Input is set to 200 KHz to better display propagation delay. Plotted:

  • input and output voltages
  • \$I_{c}\$ of the output BJTs.

Jonk

This is the currently accepted answer because of its simplicity, low shoot-through and propagation delay symmetry.

schematic

simulate this circuit

enter image description here enter image description here

This has the problem of both output BJTs being active when IN floats, which could be solved by feedback resistor R8 which latches the circuit in its last status and, additionally, replacing the output resistor R6 with two 1 KΩ between the output collectors.

Also, note: propagation delay symmetry in this circuit depends on the choice of NPN/PNP transistors and, more specifically, their junction capacitances. Try simulating with different transistors or sweeping their capacitances to see the effect.

schematic

simulate this circuit

Hacktastic

schematic

simulate this circuit

enter image description here enter image description here

Kuba

schematic

simulate this circuit

enter image description here enter image description here

AnalogKid

schematic

simulate this circuit

enter image description here enter image description here

MicroservicesOnDDD
  • 2,557
  • 1
  • 13
  • 48
jamarju
  • 311
  • 1
  • 2
  • 10

4 Answers4

8

Shoot-through current, the problem is that there is a current path through R5 and R6 in series with the two transistors (basically, diodes) whenever the Q2 collector voltage is between +11.4 and -11.4, which is most of the time during a transition.

Solution - two 15 V zener diodes, one in series with each base. Now the series string is

+12 V > 0.6 V drop > 15 V drop > 15 V drop > 0.6 V drop > -12 V.

Adding this up, it comes to 31.2 V, which is greater than 24 V. Thus, there is no time when both base-emitter junctions are forward biased at the same time.

Connect the junction of the two zener diodes to the Q2 collector with one resistor; it acts as the current limiter for both Q3 and Q4. Let's call that a re-purposed R5. Note that the voltage drop across this resistor is way less than before because of the additional 15 V drop. You probably will have to decrease the value of R5.


Time lag - A saturated transistor turns off more slowly than it turned on. This is caused by charge stored in the base. The capacitance charges up after the base current exceeds the level required for saturation, so you don't see the effect at turn on. However, at turn off the excess charge must be depleted before the transistor begins to turn off, so you do see a delay.

The common solution is to put a small capacitor in parallel with the base resistor. At turn off this capacitor acts as a charge pump to drive the base below (for an NPN) the emitter. The excess base charge is dumped into the added capacitor more quickly that it would be dissipated in the resistor.

Another method is to prevent "hard" saturation by clamping the base to the collector through a Schottky diode; this is called a Baker clamp, and is the basis of Schottky TTL logic components.

https://en.wikipedia.org/wiki/Baker_clamp

AnalogKid
  • 16,865
  • 1
  • 13
  • 25
  • "A saturated transistor turns off more slowly than it turned on". Thanks for explaining this. I tried to implement and simulate your solution but I was not able to see an improvement over other solutions. – jamarju Apr 29 '22 at 20:38
7

I'll keep it fairly simple. (And it is very similar to hacktastical's approach except that the input isn't DC-blocked and I've tied the input stage's emitters just slightly differently.) Consider the following:

schematic

simulate this circuit – Schematic created using CircuitLab

Personally, I'd put resistors in the emitters of the output BJTs to limit the output current. But I don't know what you are driving or care about, so I left them off for simplicity.


Just did a simulation to make sure I wasn't a complete idiot:

enter image description here

That includes a \$60\:\Omega\$ to \$100\:\Omega\$ source impedance, which is likely for any MCU pin drive, and also \$10\:\Omega\$ emitter resistors for the driver BJTs. (But a very light \$10\:\text{k}\Omega\$ load, as I'm just giving it a whirl for now.)

jonk
  • 77,059
  • 6
  • 73
  • 185
  • Neato. I like it. +1. I’d be careful about biasing that lower pre-driver though. Instead of 3.3V I’d choose 2.5V or so to make sure that the input will turn it off. – hacktastical Apr 28 '22 at 15:58
  • Would you mind explaining how this prevents shoot-through current, and what the role of C1 is? Thank you! This looks great in ltspice, both propagation delays and shoot-through. – jamarju Apr 28 '22 at 16:40
  • @jamarju I suggested in the text, using emitter resistors. I still recommend doing that. And there will be some shoot-though. (C1 helps remove charge from the driver BJTs and lower shoot-through, but will need adjustment for specific situation.) So that can be readily adjusted to a nice minimum. Did you check in your simulation to see what it was there? And if you really want *hard* current limits added, that can be done, but you'll pay about 450 mV for the privilege. – jonk Apr 28 '22 at 16:45
  • Thanks for the explanation. I added 200 Ω resistors between the emitters and their respective rails (without modifying anything else) and that caused the output to drop to around +/-9 V, which I can't afford as the specs state a maximum 0.4 V drop. Without the resistors, the shoot-through is below 1mA. The load should always be around 2 KΩ – jamarju Apr 28 '22 at 16:52
  • @jamarju So your load is about 800 Ohms? – jonk Apr 28 '22 at 16:57
  • The charger's output is an open-ended 1 KΩ resistor, which the car pulls down with different resistances (from ~200 Ω to ~2.7 KΩ) to signal different states, which can be measured at the center of the resulting divider. Hence, the overall load ranges 1.2 KΩ .. 3.7 KΩ – jamarju Apr 28 '22 at 17:03
  • @jamarju Then I suspect 10 Ohms would be fine. Try it? – jonk Apr 28 '22 at 17:05
  • With 10 Ω and a load of 1K, I get +/-11.8 V output and 0.5 mA shoot-through. – jamarju Apr 28 '22 at 17:16
  • @jamarju How wide is the shoot-through? Hopefully, it's short duration. (I should check but I threw the schematic away.) – jonk Apr 28 '22 at 17:23
  • Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/135895/discussion-between-jamarju-and-jonk). – jamarju Apr 28 '22 at 17:30
  • @jamarju Looks like you may not be in chat. Since I'm working right now and can't sit in chat, you'll have to ping me to let me know when you add something there. – jonk Apr 28 '22 at 17:33
  • @jonk could this be a good refinement? an open-ended 1 KΩ output should be equivalent to two 1 KΩ resistors between the output collectors taking the output at the junction of both, and that should take care of shoot-throughs, what do you think? simulation: https://tinyurl.com/yy7yz95l – jamarju Apr 28 '22 at 21:49
  • @jonk I see a problem though. As the input signal swings, there is a flow through both input bases (path from 3.3 -> emitter -> base -> base -> emitter -> gnd. With no signal connected, both Q1 and Q2 turn on. – hacktastical Apr 28 '22 at 22:38
  • @hacktastical Perhaps add a pull-down or pull-up for the "unattached" or "MCU is still powering up" case? – jonk Apr 28 '22 at 22:59
  • @jamarju If your load is also as little as 1.2 k as I think you mentioned, your addition would pose a problem, wouldn't it? – jonk Apr 28 '22 at 23:01
  • @jonk: is the problem you're referring to a big output voltage drop when connected to a load in the order of KΩ's? that's actually how the car signals different states through the charging process, so it's actually an expected and desirable behavior. I've added the charge controller's block diagram for clarification. – jamarju Apr 29 '22 at 16:18
  • @hacktastical: I would also appreciate your input on https://tinyurl.com/yy7yz95l as I believe it fixes jonk's original shoot-through problem when the input is high-z. – jamarju Apr 29 '22 at 16:21
  • @jamarju yes, the design I posted today fixes that issue. With no input connected it will not shoot through. – hacktastical Apr 29 '22 at 16:34
6

First, let's note that this circuit is never going to perform exceptionally well as-is. Without adding semiconductors, that is. I'll try and tweak it somewhat below, but it'd be much easier to use any of the fully symmetric architectures to achieve inherent symmetry. This circuit has asymmetry due to Q1 and Q2 having no complementary devices to work with.

The simulation was not set up correctly. Both the Offset and Ampltiude of V1 should be set to 3.3/2. Yes, such formulas can be used.

schematic

simulate this circuit – Schematic created using CircuitLab

Let's look at their base currents (timestep=10ns), with V(IN) and V(OUT) below them for timing reference:

Base currents of Q3 and Q4 Input and output voltages

Q3 never fully turns off - it has about 3uA flowing through the base in the off state. Q4 does turn off fully. But this isn't the problem.

Let's observe how those transistors are driven, then. Let's speed up the square wave a bit, and sweep R3 from 400ohm to 10kohm:

schematic

simulate this circuit

Output voltage vs. R3

At 200kHz, R3 above about 5kohm makes the circuit too slow to switch. That's because Q2 is driven deep into saturation. So, to speed things up, generally R3 needs to be lower. The lower the value, the faster Q2 turns off, but also the slower it turns on. The asymmetry grows the deeper Q2 is driven into saturation. When Q2 operates in very light saturation, the turn-on and turn-off times become almost equal. Just below R3 of 500 ohms, Q2's turn-on and turn-off become equally quick at about 600ns.

We can now see if negative feedback might make things less sensitive. Let's set R3 to 1kohm, and add an emitter degeneration resistor.

schematic

simulate this circuit

Output voltage waveform for several degeneration resistor values at R3=1k

We can see that for R3=1k, R8=120 gives a reasonable degree of symmetry without changing anything else. For R3=600, R8=40 is the limiting value:

Output voltage waveform for several degeneration resistor values at R3=600

We can also check the sensitivity to Q2's beta - it's insignificant across the range of beta=50 to 150.

Output voltage waveform for several Q2 beta values

Let's now add a bypass capacitor to Q2's input resistor R2:

schematic

simulate this circuit

Output voltage waveform for several C1 values

The relationship is nonmonotonic: the minimal falling edge delay is for C1=100pF. Values lower or higher give higher delays. We're now solidly in the 0.3-0.5us propagation delay territory.

We can improve symmetry now by letting Q4 turn on faster, by lowering R6.

schematic

simulate this circuit

Output voltage waveform for several R6 values

Best propagation delay symmetry is around R6=50k. We can now see if R5's value can be improved as well.

Let's choose R6=10k for fastest falling edge, and select R5 for equal rising edge delay:

Output voltage waveform for several R5 values

Reasonable symmetry is achieved with R6=10k, R5=20k. We note that at lower R5/R6 values, there's a bit of a raised pedestal before the rising edge. We could get rid of it by slowing things down a bit.

We can also evaluate the performance when faced with varying capacitive loading, as expected in a more realistic model:

schematic

simulate this circuit

The behavior is reasonable across a range of load capacitances:

Output voltage waveform for several load capacitance values

We can now guess that R1 will need a speed-up capacitor as well. Due to the time scales involved, we need to get the simulation time step down to 4ns to avoid numerical artifacts.

The optimized circuit looks as follows:

schematic

simulate this circuit

The propagation delay is below 0.1us, and is fairly symmetric:

The input and output waveform of the "final" circuit

The performance is quite acceptable at 100kHz, and should be well-suited for operation at 10kHz. The the rise/fall propagation delay will further vary up to 50ns due to Q3/Q4 beta mismatch. 50ns over 100us is about 0.05% duty cycle error due to mismatch, and it's relatively stable otherwise, so for any particular selection of components, it's a constant error term.

The load resistance can go a bit below 1kohm, but not much:

enter image description here

The various optimization steps are shown below:

enter image description here enter image description here enter image description here enter image description here

  • 1
    Thanks for the excellent analysis and explanation. But isn't the light saturation's sweet spot too dependent on Q2's beta? – jamarju Apr 27 '22 at 22:50
  • 1
    This is an incredibly educative and detailed response, I'm learning a lot from it. Thanks again! – jamarju Apr 28 '22 at 09:00
4

Here's a version that uses a dual Sziklai driver (simulate it here):

enter image description here

This design will render the full duty cycle range and provide strong +/-12V drive.

How it works: the pre-driver pair emitters are biased to 3.3V/2. As the input swings above and below that threshold by +/- Vbe, it activates the upper or lower transistor. So the input signal requirement is 3.3V/2 +/- Vbe, or about 2.25V / 1.05V.

The 100pf cap provides some negative feedback to control the slew rate. The 100k resistor provides some hysteresis.

[A short postscript. The Level 2 charger pilot signal is 1kHz, 10-90% duty cycle. Design accordingly.]

hacktastical
  • 49,832
  • 2
  • 47
  • 138
  • 1
    This circuit's symmetry is simply beautiful. I'm going to simulate the crossover distortion as it's actually a PWM signal where the duty cycle carries information. All of you guys' explanations are helping me a lot! – jamarju Apr 27 '22 at 23:32
  • 1
    +1 Great solution. As the delay happens in both edges it works at much faster switching rates without affecting the PWM duty cycle. – devnull Apr 27 '22 at 23:45
  • 1
    Varying the duty cycle will vary the average DC offset seen at the first pair, so be forewarned. If your PWM can’t tolerate that then revert to using a level shifter. – hacktastical Apr 27 '22 at 23:53
  • Thanks. I've noticed it takes some time to settle after starting the simulation. Also trying to reduce the current during switchover at the output pair. – devnull Apr 27 '22 at 23:54
  • 1
    If this is for a charger circuit, and there is some possibility of noise kick-back to the controller, one thought would be to use optocouplers for the predrivers. This would break up a potentially troublesome ground loop. – hacktastical Apr 28 '22 at 16:02
  • I deleted the AC coupled version as it proved troublesome at the extremes of duty cycle. The update uses a level shifter. – hacktastical Apr 29 '22 at 00:44
  • I wish you hadn't deleted the AC coupled version as I didn't mention anything about PWM in the first place so it's not your fault that it didn't work with PWM and from the educative standpoint it was a superb (and beautiful) solution. Also, please can you please elaborate on the noise kickback and ground loop? I can't imagine any troublesome situation. I was planning on adding bi-directional TVS diodes to the output and a two fuses to the overall +12V/-12V rails, but no optocouplers. – jamarju Apr 29 '22 at 15:37
  • 1
    The AC-coupled version didn't work. SAE J1772 specifies a 10 - 90% duty cycle for the pilot signal. I know you didn't mention PWM, but the spec is clear about this. As for noise kickback, that's always a concern, especially given that very high currents are sent alongside the pilot signal. There's also the possibility of a defective cable, receptacle, etc. leading to a short. – hacktastical Apr 29 '22 at 15:45