2
\$\begingroup\$

I am working on controlling a bi-stable latching solenoid with an H-bridge.

The microcontroller that I am using for my project doesn't have enough GPIOs for me to use four pins for the H-bridge, so I designed a circuit with PNP and NPN transistors:

enter image description here

I tested the circuit in simulation before making my board and it appeared to work. Setting H1B to high set the direction of the voltage correctly and vice versa.

I built my PCB and discovered that when 24 V is applied to the power rail, my power supply goes into constant current mode (even when H1D and H1B are both at 0 V). I added some control to the H1D and H1B lines but can't get either of them to close Q13 or Q10.

What could be causing this to short with H1D and H1B both low? Do you see any issues with this circuit?

Latest Simulation

I rebuilt the model in LTspice to get more accurate component models. I am seeing some strange behavior. The solenoid+ is seeing 12 V before any FETs are opened. How would that happen? I also moved the PNP resistors to below the NPN so that they don't pull any current and activate PNP. Changing the diodes to VS-E5TH1506 fast-recovery diodes helped bring the end voltage back to 12 V.

enter image description here

enter image description here

enter image description here

\$\endgroup\$
11
  • 2
    \$\begingroup\$ No pull-ups on H1A and H1D and no provision for dead time while switching. \$\endgroup\$
    – vir
    Commented May 6 at 2:13
  • 1
    \$\begingroup\$ Also need large electrolytic (1000μF?) in parallel with a ceramic (0.1μF?) from 24V to ground. \$\endgroup\$
    – RussellH
    Commented May 6 at 2:50
  • 2
    \$\begingroup\$ Edit in the screenshots to the original question. Please don't make people dig down through comments and click on a random link that could go anywhere. \$\endgroup\$
    – vir
    Commented May 6 at 4:18
  • 1
    \$\begingroup\$ Pull-up to 3.3V will leave your PNPs on constantly, as you saw; 24V is the correct voltage. You can try implementing this on a breadboard and see if it gives acceptable performance. You still have a lack of dead time issue but it might be good enough as is. I recommend using a dual half-bridge chip with integrated transistors. You can control them with two logic lines. \$\endgroup\$
    – vir
    Commented May 6 at 5:00
  • 1
    \$\begingroup\$ When the solenoid is turned off, the inductance will maintain the current as the field collapses. Since the transistors are turned off, the current will pass through a pair of diodes reversed into the power supply. To protect the power supply, and to reduce 24V fluctuation, a low and a high frequency capacitor must be placed between across the 24V close to the bridg \$\endgroup\$
    – RussellH
    Commented May 7 at 13:12

2 Answers 2

3
\$\begingroup\$

With only two more transistors (eight vs six in your circuit), only one GPIO pin is needed to drive the solenoid. The GPIO pin has three states: INPUT, OUTPUT HIGH, OUTPUT LOW.

  • INPUT: solenoid off, 150μW power consumption.
  • OUTPUT HIGH: solenoid +
  • OUTPUT LOW: solenoid -

The firmware has to be written such that direct transitions between the OUTPUT states are not possible, but rather the INPUT state is always transitioned.

schematic

simulate this circuit – Schematic created using CircuitLab

Q1 and Q2 are current switches that steer GPIO pin current through either R6 (OUTPUT LOW) or R7 (OUTPUT HIGH). Q3 and Q6 get turned on in the respective states. R8 and R11 drive the bridge switches Q4 and Q5 during the OUTPUT LOW state. R12 and R15 drive the bridge switches Q7 and Q8 during OUTPUT HIGH.

The flyback diodes can be back-to-back Zeners as shown, or switching diodes to rails as in your original design.

The solenoid can be driven with about 20-30mA of current. As shown, the driver thus supports 0.5W coil power rating. For higher coil power ratings, the resistors R8..R15 need to be adjusted.

\$\endgroup\$
2
  • \$\begingroup\$ This is very interesting. Is there any advantage to this design verse the above besides saving a pin? It seems more complex wrt qty of components and software. You mentioned the power consumption, i didn't measure my circuits consumption yet, but do you expect it to be >150 µW when the solenoid is off? Very interesting design regardless. \$\endgroup\$
    – sdolan
    Commented May 8 at 4:39
  • 1
    \$\begingroup\$ The advantage is it was fun to design, and uses only one pin. Software is easy, and complexity of this circuit in the days of cad is not making much difference. With two GPIO pins the circuit will be the same, just the front current switch will be split in two and polarity of control of one side of the H will need to change. Then it will treat INPUT and LOW the same. An additional transistor would protect from inadvertent cross conduction. As shown cross conduction is transient at most. \$\endgroup\$ Commented May 8 at 18:14
3
\$\begingroup\$

I tested the circuit in simulation before making my board and it appeared to work. Setting H1B to high set the direction of the voltage correctly and vice versa.

No, your circuit in the simulator does not work correctly. It appeared to work because you used the default diodes with a lot of leakage current. I suggest replacing them with 1N4004 diodes. Another bigger problem in your simulation is the use of a voltmeter in place of the solenoid. This makes the Solenoid+ and Solenoid- terminals open. To remedy that, put an inductor to represent the solenoid (see the image below).

![enter image description here

What could be causing this to short with H1D and H1B both low? Do you see any issues with this circuit?

You missed the base resistors on both PNP transistors. Without them, H1A and H1C are shorted to GND when both bottom-most NPN transistors are turned ON, as you have observed.

Here is the amended circuit.

enter image description here

Edit In your actual circuit, please avoid using 1N4004 diodes due to their slow reverse recovery time. Instead, consider using diodes like the ES1A. I suggested 1N4004 above because the Falstad simulator does not have many other options.

Adding a pull-up resistor at the base of each PNP transistor, as suggested by Vir (and highlighted by RussellH), can slightly improve turn-off time. This is due to faster removal of excess charge carriers in the base region through the resistor when the PNP transistor is turned OFF. However, it’s acceptable not to add the resistor if you’re using NPN like the 2N3904 and 2N2222 for those bottom most transistors (left and right). These NPN transistors have very low collector leakage current (5nA to 50nA). The resistor is needed if the collector leakage current is significant; otherwise, the PNP transistor might partially turn ON even when the NPN transistor is OFF.

Regarding the solenoid, I didn’t include coil resistance in my previous suggestion because my intention was to identify the issues and provide minimal adjustments to get the simulation running correctly.

\$\endgroup\$
14
  • 1
    \$\begingroup\$ The solenoid will have a series resistance as well. Dead time is still required. \$\endgroup\$
    – RussellH
    Commented May 7 at 12:54
  • 1
    \$\begingroup\$ You also still need the pull-ups suggested by @vir \$\endgroup\$
    – RussellH
    Commented May 7 at 13:17
  • \$\begingroup\$ @RussellH some deadtime could easily be added in the firmware right? \$\endgroup\$
    – sdolan
    Commented May 8 at 3:07
  • 1
    \$\begingroup\$ @RussellH Referring to my annotated schematic, if H1B and H1D are set to 3.3V and 0V, respectively, then Q3 and Q4 are ON and OFF, respectively. Also, Q5 and Q6 are ON and OFF, respectively too. Q5 and Q6 turn Q1 and Q2 OFF and ON, respectively. In short, Q2 and Q3 are both ON and Q1 and Q4 are both OFF. I don't see how shoot-through can happen. \$\endgroup\$
    – kaosad
    Commented May 9 at 19:05
  • 2
    \$\begingroup\$ Sorry, You are right. I withdraw my comments \$\endgroup\$
    – RussellH
    Commented May 9 at 19:59

Not the answer you're looking for? Browse other questions tagged or ask your own question.