As part of a project I'm working on, I'm having a Raspberry Pi GPIO pin activate three solenoids, but the pin itself does not supply nearly enough current (each solenoid requires at least 1A, close to 1.5A optimally). I'm trying to set up some sort of switching system with a secondary power source. My first idea used a CMOS switcher, but I ended up using spare parts I had lying around and it didn't work perfectly.

Is a CMOS setup good for what I'm trying to do? If so, what specific MOSFETs should I look into; if not, what would be a more efficient way to tackle this problem?

  • \$\begingroup\$ What is the rail voltage for the solenoid? \$\endgroup\$ – jonk Jan 21 '17 at 7:12
  • \$\begingroup\$ \$3.3\:\textrm{V}\$ I/O voltage and a current gain of at least \$\frac{1.5\:\textrm{A}}{16\:\textrm{mA}}\approx 94\times\$. I think Passerby nailed the precise boundaries of any reasonable approach. You'll need a small signal NPN BJT (TO-92 or TO-18 package) and either a high current PNP or else an PMOS (either in TO-220 or similar package) for the high side switch. A complication might be if you were to say that your solenoid requires exactly \$10-12\:\textrm{V}\$ for operation and that you only have access to \$24\:\textrm{V}\$ as a power source and that you want only a simple linear design. \$\endgroup\$ – jonk Jan 21 '17 at 7:30
  • \$\begingroup\$ People are assuming a high side drive. Any reason - I MAY have missed something. IF switches on the "low" or negative side are OK then the easy way is to drive an N Channel MOSFET that is fully on at rated current with Vgs = 3V. Place a reverse polarity diode across the solenoid for spike protection. (1N400x usually OK) \$\endgroup\$ – Russell McMahon Jan 21 '17 at 7:57
  • \$\begingroup\$ @jonk The rail voltage for the solenoid is 9V, and we are trying to use some sort of relay/switch to turn it on and off because it consumes a LOT of current. \$\endgroup\$ – Jashaszun Jan 24 '17 at 21:02
  • \$\begingroup\$ @Jashaszun A little late on the details. But it looks like you have an answer. \$\endgroup\$ – jonk Jan 24 '17 at 22:07

Typically you want to use a NPN driver circuit, using a 2n3904 or similar. The NPN drives your p channel mosfet or PNP driver circuit. Logic will be inverted but it will work it the max 16mA output of the RPi.


simulate this circuit – Schematic created using CircuitLab

Schematic shown has a 6mA load on the RPi output. Resize the resistors as needed. Left Q2 could be a BJT PNP or a P-Channel Mosfet. Right Q5 is NPN and N-Channel Mosfet. Size for your solenoid power.

  • \$\begingroup\$ If it's not too much trouble, could you provide a sample schematic? I'm very new to transistor circuits, so I apologize for being a little slow on the uptake. Thank you for your answer! \$\endgroup\$ – Dinesh Jan 23 '17 at 3:11
  • \$\begingroup\$ @Dinesh general schematic shown. Resize resistors as needed. When Output is high, Q1 is on, and Q2 is on. If you need to drive a NPN or N-Channel instead, move the solenoid and Q2 around. \$\endgroup\$ – Passerby Jan 23 '17 at 4:14
  • \$\begingroup\$ @Passerby do you have any suggestions for specific relays that work here? I wouldn't know how to check if one that I found would work in this circuit. \$\endgroup\$ – Jashaszun Jan 24 '17 at 21:05
  • 2
    \$\begingroup\$ @jashaszun this is a general schematic. You would size all components based on your needs. The relay or solenoid required current would be the design specification for Q2's C-E current, which would inform what R2 resistor needed for the base, and which q1 transistor is needed for that current that also meets the input current limit. Since q1 or q3 are general purpose 200mA transistors it will work for most any Q2 or Q4. \$\endgroup\$ – Passerby Jan 24 '17 at 21:51
  • 2
    \$\begingroup\$ Oh, and the relay represents the solenoid, as both are electrically the same. You don't need a relay. Don't forget a flyback diode across the solenoid. \$\endgroup\$ – Passerby Jan 24 '17 at 22:00

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.