# Controlling forward/reverse current using arduino & shift registers

I'm trying to control multiple solenoids (home made) using a shift register controlled by an Arduino. Ideally I want to be able to direct them all together either inwards or outward using the current direction.

I had originally looked at using an H-Bridge, but I have about 200 solenoids to control so it was going to become too expensive. I figured I might be able to switch the direction of the current and send 2 sets of values to the shift register, using the first bit to specify the direction. By daisy-chaining 25 shift registers I can control all 200 (well 199 - but that would be enough).

Something like this:

• Bit 0 - connected to mosfet that controls relay that sets the current direction
• Bit 1 - connected to mosfet that switches solenoid 1 either on or off
• Bit 2 - connected to mosfet that switches solenoid 2 either on or off
• etc etc

Datasheets are as follows:

I've attached a diagram, I've omitted the connections to the arduino for simplicity but I do have a few questions.

1. Does this look like it will work? Am I totally off the mark?
2. Do 2n7000 mosfets allow current in reverse?
3. Would it be better to have 2 mosfets for each solenoid and keep everything separate?
4. If yes to 3 - do I need diodes in front of them or how do I go about protecting them from backflow?
5. What would be the best way to arrange the snubber diodes? (assuming that they are needed)

Thanks in advance for any help!

simulate this circuit – Schematic created using CircuitLab

• Some clarifications sought: Will all the "enabled" solenoids move in the same direction at a given point of time? Do they need to move absolutely simultaneously? (spike current drawn on activation would be huge, but worse, back EMF at turn-off would warp the space-time continuum). Can spring-loaded solenoids be used, such that activation is needed only in one direction? Are these (mechanically) latching solenoids, or do they need holding current to hold position? What is the solenoid activation (and holding if applicable) current and inductance specification? Jun 29, 2013 at 14:19
• Regards the cct diagram this wouldn't work - if you need to reverse the current direction to retract the solenoid then it needs a switch that is bipolar. MOSFETs, because they have a parasitic reversed diode will effectively always be "on" when the source is a volt more positive than the drain. This applies the NFETs and the reverse applies to PFETs. I think you need H bridges or a mechanical spring return like Anindo mentions. Jun 29, 2013 at 14:41
• The solenoids in question are super tiny (4mm x 6mm) so hoping the draw/emf isn't too crazy. Also they would be mechanically held so wouldn't need any holding current. I don't have any specifications as such as I will be making them myself. I can certainly tell you the wire length, gauge, number of coils etc. if that would help. Jun 29, 2013 at 16:15

There may be a way of avoiding full H bridges providing you have some leniency with the power supply: -

The power supply is a split rail type that is normally used for producing +V, 0V and -V for op-amps and amplifiers etc.. Because the secondary is floating (i.e. not earthed) you can tie the negative rail to ground and have a half rail (formerly 0V) that the solenoid return current can use.

Now, you only need two FETs; one P type and one N type. You still need protection diodes of course.

When N type activated current flows thru solenoid from left to right. When p type activated current flows right to left.

If you want to melt things try activating both at the same time (this is a normal H bridge problem anyway but you have to be "solid" in how your control circuit works)!! With neither fet activated the solenoid draws no current.

There is some complication in that the P channel is referenced to the highest voltage supply and this will need an extra transistor circuit to make it gnd-logic referenced and, in the end you might favour going full integrated H bridge drive because it's simpler to build.

• I'd implement the control by getting a shift register with open collector outputs, and forget about the ground reference. The shift register outputs are connected between +12V and -12V through a pull-up resistor, and the logic inputs are referenced to the -12V rail. Jun 29, 2013 at 15:24
• @PhilFrost sounds a good idea - can you get that type? Jun 29, 2013 at 15:26
• 74596 is identical to the 74595 specified in the question, but with open collector outputs. I'm pretty sure it can take 24V on the output, but some datasheet reading would be prudent. Jun 29, 2013 at 15:32
• I must have hit my head, because I was sure something like that was available, but it looks like all shift registers with open collector outputs are very expensive, non-stocked parts. Probably adding an external transistor to a CMOS shift register like you suggest is cheaper. Jun 29, 2013 at 15:41
• As you could probably tell, I'm still a bit of a noob with this electronics malarkey. However this looks very promising and certainly gives me something to play with. I couldn't get my head around the difference between n and p channel mosfets, but this has made it a lot clearer. Thanks! Jun 29, 2013 at 16:10

What you have drawn here won't work. When the current is reversed, you have this situation:

simulate this circuit – Schematic created using CircuitLab

The diode there is the diode inherent in all MOSFETs. You could instead use a solid state relay (SSR) or an electromechanical relay. The cheapest I could find stocked on Mouser is $0.48; I don't know if this is still "too expensive". You could probably put full H-bridges on each solenoid for a similar price. There are surface mount packages that have an N-channel and P-channel MOSFET in the same package that are very cheap. For example, Mouser sells Vishay Si1539CDL for$0.13 in quantities of 250. I'm sure, if you look, you can find some that have multiple pairs of P and N that may work out to be even cheaper.

You could control each H-bridge with 2 outputs on the shift register, one for each side. Or add some digital logic to reduce the shift register outputs required, but probably the cost will be about the same. Or, combine this with Andy's solution and you only need 1 shift register output and a half-bridge per solenoid.

• Hi, I've been hesitant to look at surface mount components because I thought you needed specialist equipment to use them. But I might just have to research if I can get set up on the cheap. I'm in aus so most components cost 3x what they do in the us. E.g. The vishay si1539CDL costs around 40c each :( Jun 29, 2013 at 16:13
• @Mookle don't be afraid of surface mount. If you stick to the larger packages (SOT-23, SOIC...) all you need is a good soldering iron and some solder that isn't too thick, and some tweezers. I prefer surface mount for my hobby work since it saves me the trouble of drilling holes in PCBs I make. Jun 29, 2013 at 16:54