4
\$\begingroup\$

I'm trying to operate a solenoid push pull motor with a shift register. It works fine with LEDs, but when I try to use the shift register to trigger my solenoid it doesn't work. I suspect it's a power issue, but I'm using an external 6 V battery for the 6 V solenoid.

I'm using a Raspberry Pi to shift bits into the shift register also, but I don't think that would be an issue.

I have a feeling this is a very basic problem, but I'm having trouble wrapping my head around the data sheets for (potentially) higher voltage shift registers. I'm wondering if a shift registers act as a bottleneck for voltage, and if so are there options for higher voltage usages?

Here's a link to the parts I'm using:

Shift eegister: SN74HC595N

Solenoid: GANGBEI 0530


OK, so 35 minutes after asking this question it's apparent how out of my depth I am with this stuff. I have recorded a video to show what I'm seeing.

https://youtu.be/OP3iYP2QCuA

\$\endgroup\$
9
  • 4
    \$\begingroup\$ Give us a schematic. What are you using as a switch? \$\endgroup\$ – Hearth Apr 11 at 20:03
  • 4
    \$\begingroup\$ The solenoid draws 300mA, I trust you’re not expecting a logic IC to drive it directly? \$\endgroup\$ – Frog Apr 11 at 20:06
  • 5
    \$\begingroup\$ @conor_b Oh please not fritzing. That produces horrible, unreadable "schematics" that aren't schematics at all. This site has a built in schematic editor, it's the button next to the "insert photo" button in the question/answer editor. \$\endgroup\$ – Hearth Apr 11 at 20:13
  • 2
    \$\begingroup\$ @conor_b That's your problem then. Solenoids need a lot of current, logic ICs can provide only a little current. \$\endgroup\$ – Hearth Apr 11 at 20:15
  • 5
    \$\begingroup\$ @conor_b Please draw a schematic. A video doesn't help at all, when I'm not able to watch videos at the moment! \$\endgroup\$ – Hearth Apr 11 at 21:04
7
\$\begingroup\$

Use any power transistor ( BJT or Nch FET) as a low side switch, that can easily drive 300mA, which the CMOS SR cannot.

Use a switch rated for low power dissipation (I^2R) or very low Ron on the low side plus a flyback diode from the Switch (drain or collector) to the opposite rail (Vbat) to continue the current but decaying to zero with the back EMF reversing polarity.

6V/300mA = 20 Ohms + tbd mH inductance. So for 99% efficiency use a switch that is 1% of 20 Ohms or ~ <= 0.2 Ohms at 6V = Vdd = Vgs

From the datasheet sect 7.5 for that Sh.Reg., the Vol @ Vdd=6V at 7.6 mA Vol= 0.15V typ. @ 25’C and 0.26V max

Thus computing Ron (low is usually better than hi) Ron= 0.15V/7.6mA= 19.7 ohms typ. (Or the same as your solenoid ( no good) and Ron=0.26V/7.6mA =34.2 ohms max.

Bad example

If one used a PN2222A computed as 2 ohm switch with Ic/Ib=10 in order to drive 300 mA you need 30 mA base current from (6-0.7V)/30mA =33.3 Ohms which in theory only needs 10 ohms added from CMOS to Vbe but 300mA*2 Ohms =600mV Vce(sat) and Pd(sat)=300mA * 600mV approx. 180 mW with 10% more from Vbe power with Rja thermal resistance =200’C/W means Tj rises 40’C and similar another rise in CMOS temp.

So this might work in a pinch but not with much margin.

\$\endgroup\$
8
  • 2
    \$\begingroup\$ Flyback diode across solenoid! en.wikipedia.org/wiki/Flyback_diode Transistor BJT is tautology. \$\endgroup\$ – user263983 Apr 11 at 20:15
  • \$\begingroup\$ Doh that’s what I meant but from the Switch drain to Vbat is better for EMI than across coil. transistor is general for both BJT and FET , not tautology \$\endgroup\$ – Tony Stewart EE75 Apr 11 at 20:28
  • \$\begingroup\$ Hey @TonyStewartEE75 thanks for your response, whoah reading that is like a whole new language, I'm going to take this massive knowledge dump and work through it googling bits I don't understand :) \$\endgroup\$ – conor_b Apr 11 at 20:53
  • \$\begingroup\$ @TonyStewartEE75 Isn't a switch from drain to Vbat the same as being across the coil? Or are you referring to direct physical connections with real traces/wire? And why would one result in less EMI than the other? \$\endgroup\$ – DKNguyen Apr 11 at 20:56
  • \$\begingroup\$ Hi @DKNguyen the EMI depends on the loop area of the drive and return wires to the solenoid and the difference in loop area directly across the coil. As the switch turns off if the diode is remote then the switch radiates more dI/dt over that difference in loop area. while if the diode is direct from drain to Vbat the loop area from switch to ground and switch to Vbat must be kept small and then the dI/dt is reduced in BW by slowing rise time T=L/Rd electronics.stackexchange.com/questions/554561/… \$\endgroup\$ – Tony Stewart EE75 Apr 11 at 21:31
7
\$\begingroup\$

Use either of the circuits below taken from this answer; just take the output from your shift register as an input to the MOSFET gate or BJT base to greatly increase the available solenoid current.

Example from that answer using a BJT. The schematic calls out a Darlington transistor (effectively a two stage transistor); given that the solenoid requires 300mA that's probably wise unless you select a "super beta" transistor.

enter image description here

Example from that answer using a MOSFET. If you use a MOSFET, be sure to use a logic level FET (i.e., one that's specified for a gate voltage equal to your shift register's VCC).

enter image description here

\$\endgroup\$
3
\$\begingroup\$
  1. I don't see, and you don't mention a ground connection between the Pi and the protoboard. Without it, operation will be unpredictable.

  2. A standard TTL or CMOS shift register IC (as opposed to some power shift registers from TI), can barely drive an LED, and won't drive a solenoid. You need one driver transistor per solenoid. Your part draws 300 mA at 5 V, about 100x what the chip is rated for.

To start with, I would add a darlington transistor per solenoid output. If the voltage drop across the transistor is an issue, there is a 2-transistor circuit that will reduce the voltage drop across the driver to less than 0.1 V.

\$\endgroup\$
1
\$\begingroup\$

schematic

simulate this circuit – Schematic created using CircuitLab

I would use a TIP122 transistor, with an 220 Ω - 1 kΩ basis resistor with a general-purpose diode (1N4148 or 1N4001) reversed biased for protection. As any overvoltage from the TIP122 would get shunted away from the Raspberry Pi's logic circuit.

the tip122 saturates 100% because it is designed specifically for this application. So almost all the applied voltage is across the coil. The 100V rating is the maximun voltage you can apply to the transistor. That is why they are commonly used as 12V-70V solenoid drivers. There are other ones like that, but this is the common one used. I've seen many pinball machines using the 74hc595 feeding a tip122 to drive their coils.

\$\endgroup\$
6
  • 1
    \$\begingroup\$ The coil is the main culprit, not the transistor. Shouldn't the transistor be protected as well? The absolute maximum for the emitter-collector voltage is 100 V. Is it guaranteed to stay below that voltage (when switching)? \$\endgroup\$ – Peter Mortensen Apr 12 at 17:16
  • 1
    \$\begingroup\$ The switch time is on the order of 200 ns. What is the approximate maximum voltage over the relay coil? \$\endgroup\$ – Peter Mortensen Apr 12 at 17:31
  • \$\begingroup\$ Tip122 has an internal dampening diode. That is why they were used in pinball machines to drive their coils with voltages up to 40V, and some of those pinball machines used 74hc595 to drive them too. \$\endgroup\$ – David Mikeska Apr 12 at 18:37
  • \$\begingroup\$ Oh btw, the tip122 saturates 100% because it is designed specifically for this application. So almost all the applied voltage is across the coil. The 100V rating is the maximun voltage you can apply to the transistor. That is why they are commonly used as 12V-70V solenoid drivers. There are other ones like that, but this is the common one used. \$\endgroup\$ – David Mikeska Apr 12 at 18:49
  • 1
    \$\begingroup\$ almost @conor_b You would have to get new resistors. 2.2K would be too much resistance. I usually just buy my stuff at Mouser, but that is interesting that people are selling grouped parts. 1K should work well enough. \$\endgroup\$ – David Mikeska Apr 13 at 1:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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