I’m currently working on a project where I am utilizing PWM on an Arduino to control a solenoid proportionally. I am designing a device that will play the piano. I would like it to mimic hand movements as close as possible and PWM is my best chance at that.

I currently have a circuit in mind where I utilize 3 pins from the Arduino and have them daisy chained through 3 shift registers for a total of 24 outputs. I am having issues find an appropriate mosfet that can handle the PWM action. The solenoids are rated at 12v and 1amp. From what I found this circuit is pretty simple but from the other projects I have seen they are not utilizing PWM pins and are just turning the solenoids on and off with out the varing touch.

I am sorting through data sheets and I feel like the 5v coming from the Arduino wouldn’t be enough if the duty cycle was too low, as it would drop the voltage below the threshold.

I am sorry for not being more up on this, I’m a Mechanical Engineer, this Electrical Engineering stuff is black magic :). I linked a picture hopefully. It’s just a rough idea I had in fritzing so nothing is labeled but it should be semi ok to follow.

Thanks for any help you may be able to give. enter image description here

  • \$\begingroup\$ Do you need individual PWM control for each solenoid or can you use a single PWM stage that controls the PWM for all solenoids that are active at any one time? \$\endgroup\$ Feb 26, 2020 at 3:23
  • \$\begingroup\$ You can use a PROFET 12V family MOSFET switches (high side switch), but they are SMD. Then you have a lots of low side switches in a IC: IPS4260L, BTS133, ...There are also switches with SPI communication, faster than yours approach with shift registers. \$\endgroup\$ Feb 26, 2020 at 8:08
  • \$\begingroup\$ The catch diodes have the wrong orientation, this way you'll only fry the diodes with PWM \$\endgroup\$
    – Sim Son
    Feb 26, 2020 at 8:14
  • \$\begingroup\$ I'm not sure absolut your requirements, but usually stift registers vor multiplexers are not usefull if you want to multiplex PWM and use the channels simultaniously \$\endgroup\$
    – Sim Son
    Feb 26, 2020 at 8:17

1 Answer 1


It looks like there may be some issues with your schematic. There are no labels, so this is just a guess but it looks like your mosfets are on the high side. You're going to want to use N channel fets, they're better. Google "low side mosfet switch". Second of all, those diode are backwards. They should not not conduct when the solenoid is powered. Third, please consider using a regular schematic in the future, it's much more readable.

Now getting into the problem itself..

It will be difficult to create pwm signals of sufficient frequency while using a shift register for the output. You have enough pins to drive the outputs directly though so I would just do that.

Any mosfet can "handle" pwm. But driving them on and off can be a bit tricky. If you pick the mosfet carefully, and your PWM frequency is somewhat low (<1khz), you may be able to drive the mosfet gates directly using the arduino. The mosfet gate is basically a capacitor, and it takes time for your arduino to charge it up. If the pwm frequency is too high the mosfet will linger in the intermediate zone and overheat.

A not-cheap but very solid solution to this is to use a chip called a "gate driver". These are simple to use and can push/pull multiple amps into the mosfet gate to turn it on and off extremely fast. I often use the IXDN614PI.

If you want to drive the mosfets directly with the arduino, you will need to find a "logic level" mosfet. This is surprisingly difficult to do. Mosfets will list a Vgs(th), which is the turn on threshold, but you need to go higher than this for the mosfet to conduct efficiently. For example a mosfet with a Vgs(th) of 5v will not work well with a 5v signal. You'll need more like 2 volts. For each mosfet, you will have to look in the datasheet to figure out if it will work (goodby parametric search). If you're lucky the resistance (Rds(on)), will be listed for 5V, but more likely you will have to look it up in a chart. Like this:

Rds(on) vs Gate Voltage

Chart taken from the datasheet for the PSMN017-30PL,127

One last thing, you should always add a high value resistor 50~100k pulling the mosfet gates down. This will make sure the mosfets stay off unless you intentionally turn them on.

  • \$\begingroup\$ MOSFETs usually list a \$V_{th}\$; I don't think I've seen too many with \$V_{gs,on}\$ listed. \$\endgroup\$
    – Hearth
    Feb 26, 2020 at 4:06
  • \$\begingroup\$ @hearth you're right, I misspoke. I'll edit my answer \$\endgroup\$
    – Drew
    Feb 26, 2020 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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