Go Down

Topic: Use a Transistor or MOSFET as a switch to control Solenoid (Read 157 times) previous topic - next topic

yakuparslan72

Jan 18, 2021, 09:14 pm Last Edit: Jan 18, 2021, 09:16 pm by yakuparslan72
I am working on a project to control a Solenoid (12 V/DC 12.96 W) with ESP32. I have attached 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 Solenoid via ESP32?


Thank you in advance
Yakup




septillion

Shoot

But I would say a little Googling will give you all the answers quicker...

But uhhhh, why is the 12V connected to a pin labeled 5V? And if that relay is really 12W it's quite a beast. A poor old 2222 can't supply that 1A. Switch to a logic level mosfet. But again, I'm repeating Google.
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

yakuparslan72

Hi, 
I tried google almost a month, but couldn't get any proper answer to be honest. ESP32 has voltage regulator built-in and it regulates up to 12v. 

But thanks anyway :) 

ShermanP

Could you provide links to the ESP32 module you're using, and the solenoid too?

I have no experience with the ESP32, but perhaps someone else can say whether you can apply 12V to a pin labeled 5V.


johnerrington

There are at least a squillion different esp32 boards so we need to know which you are using.

Quote
ESP32 has voltage regulator built-in and it regulates up to 12v.
Not on a 5V pin.  Perhaps on your board there is a Vin going to a regulator. 


Anyway its not good practice to use a 12V supply to power a switched inductive high current device AND a microprocessor.  I'd recommend an external regulator and decoupling caps everywhere.

I'm trying to help. If I find your question interesting I'll give you karma. If you find my input useful please give me karma (I need it)

MarkT

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

Would this circuit work properly?
You have a solenoid needing 12V and over 1A.  You are trying to power it from the ESP's 5V pin using a transistor rated for 0.6A.

So no, clearly isn't going to work well.

I'd strongly suggest use a separate supply for the microcontroller and the solenoid - heavy current inductive
loads are not friendly to logic chips.

A logic-level MOSFET is needed, the IRLB8743 you suggest will be fine.

Remember to decouple the 12V supply near the MOSFET.  A 10--100uF electrolytic or so would be a plausible
value.  This will reduce noise spikes significantly - together with the free-wheel diode.

[ BTW the high 1k base resistor in your circuit would have limited the 2N2222 to about 150mA
loads anyway - compute base current as 5 to 10% of collector current for a BJT used for
switching ]
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

Go Up