I have recently designed my first PCB (forgive my poor understanding of electronics) and I'm having an issue with the pins that are supposed to be powering the 12v 2A solenoid.

Everything works as expected except I am getting no current from the 12v solenoid pins. When hooking up the boards power supply directly to the solenoid everything fires as expected, but when trying to power the solenoid through the board, I get 12v across the solenoid pins, but no amperage.

I tested the resistance of the pins and I have a connection from the 12v supply positive to a solenoid pin, I also have the expected ground connection from the 12v supply ground to the MOSFET Source pin. The MOSFET is also working as expected and closing the ground connection when 3.3v is applied to the gate pin.

Board Layout Schematic Board Render

  • 1
    \$\begingroup\$ We don't use hydraulic terms in electronics so, when you say the MOSFET is opening when 3.3 volts applied, you actually mean "activating" or closing as in closing a circuit. \$\endgroup\$ – Andy aka Feb 9 at 17:10
  • \$\begingroup\$ Thanks for the feedback. Edited. \$\endgroup\$ – Chris Bigelow Feb 9 at 17:16
  • \$\begingroup\$ Did you verify continuity from J4 toP4 to solenoid? \$\endgroup\$ – Tony Stewart EE75 Feb 9 at 17:28
  • \$\begingroup\$ On your next design I would add a resistor/mosfet so that Q1 can be driven at 12V. Have you measured the resistance of your solenoid? It could be broken. \$\endgroup\$ – Parker Feb 9 at 17:36
  • \$\begingroup\$ @ChrisBigelow It would be better if you could attach the links as images. \$\endgroup\$ – Voltage Spike Feb 9 at 22:56

You are trying to drive a non-logic level IRF540N MOSFET from the (max) 3.3 V logic output of the ESP32.

That ESP32 3.3 V GPIO output might just reach the Vgs(th) of the MOSFET, which is specified at 250 uA of drain current - but that's not enough current to drive your solenoid!

When hooking up the boards power supply directly to the solenoid everything fires as expected

That works because you are then supplying 12 V (i.e. the board's power supply voltage) to the MOSFET's gate, instead of the 3.3 V from the ESP32 GPIO pin.

You need to use a logic-level MOSFET instead, with a suitable specified Rds(on) at your ESP32's logic-level voltage of 3.3 V.

For example, the IRL540N (notice IRL540N, not IRF540N) could pass around 20 A at Vgs = 3.3 V according to its datasheet, but there are many suitable MOSFETs. Check with your suppliers. Just remember that those specified with Vgs = 10 V (like your IRF540N) are unlikely to be suitable, when you are driving the gate with only 3.3 V.

Not directly related to your question, but if I am interpreting your schematic correctly (a larger version of the image would make it easier to read, if you have one) then C1 is the only capacitor on the 12 V rail and it's only 100 nF. Since that 12 V rail powers both the solenoid and the logic (through a 3.3 V regulator) then additional bulk capacitance may be needed.

  • \$\begingroup\$ Ahh thank you so much! This is very helpful. I added a higher quality schematic, yes you are correct there is only one 100 nF capacitor on the 12v rail. What do you recommend in terms of capacitance? \$\endgroup\$ – Chris Bigelow Feb 10 at 0:44

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.