0
\$\begingroup\$

I am working on a project to control a solenoid (12 V/DC 12.96 W) with an ESP32. I have attached a circuit design as it is in picture.

I have couple of questions:

  • Would this circuit work properly?
  • Do I need to change the transistor (PN2222) to a MOSFET (IRLB8743PBF)?
  • Solenoid force varies between 30N,59N. How can I control the force of the solenoid via the ESP32?

enter image description here

\$\endgroup\$
6
  • 1
    \$\begingroup\$ Ok, so first of all, you're directly connecting your ESP32's 5V to 12V, obviously damaging your ESP32. The story ends here - this cirucit doesn't work. If you look any further: Have you determined what about the transistor matters for your application? Have you then checked that against the datasheet of your transistor? \$\endgroup\$ – Marcus Müller Jan 18 at 20:15
  • \$\begingroup\$ Please provide a link to the manufacturer's datasheet for the solenoid. We need more information about it. \$\endgroup\$ – Elliot Alderson Jan 18 at 20:16
  • 1
    \$\begingroup\$ A MOSFET is a transistor - MOSFET stands for metal oxide semiconductor field effect transistor. What you are calling a transistor is a bipolar junction transistor. \$\endgroup\$ – JRE Jan 18 at 20:19
  • \$\begingroup\$ @MarcusMüller, ESP32 is working up to 12V and i tried already and there was no any issue. I checked the transistor datasheet, it is because i am new to electricity from my understanding, it would work. \$\endgroup\$ – Yakup Arslan Jan 18 at 20:22
  • \$\begingroup\$ @ElliotAlderson, there is not much information but here is the link: link \$\endgroup\$ – Yakup Arslan Jan 18 at 20:23
1
\$\begingroup\$

Would this circuit work properly?

No. You are applying 12 V to the 5 V supply input of the ESP32 module, which will blow it up. You need a voltage regulator or DC/DC converter to drop the 12 V down to 5 V.

Do I need to change the transistor (PN2222) to a MOSFET (IRLB8743PBF)?

Yes. The solenoid draws 12.96 W / 12 V = 1.08 A. PN2222 is rated for 600 mA absolute maximum, so it is nowhere near sufficient. IRLB8743 can handle the current easily, but it is designed for 4.5 V or higher Gate drive. Since the ESP32 only puts out 3.3 V you will probably need a level converter to provide sufficient Gate voltage.

Solenoid force varies between 30N,59N. How can I control the force of the solenoid via the ESP32?

Solenoid force varies as it moves through the stroke, generally getting stronger as it reaches the end. You can vary the current using PWM, but that can only make the force less than it is normally, eg. at 50% PWM it would vary from 15N to 30N.

\$\endgroup\$

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