Тёмный

P-Channel MOSFET as a Switch. Turn ON a 12V Motor with Arduino. (Step-By-Step Guide) 

Indrek
Подписаться 14 тыс.
Просмотров 70 тыс.
50% 1

This is a tutorial about using a P-Channel Enchantment Type MOSFET as a switch to turn ON and OFF a 12V Motor.
UPDATE:
You should also add a 100-ohm resistor between the Arduino pin and the Gate terminal of the MOSFET. The MOSFET has a small capacitance that starts to charge/discharge when you switch the Arduino pin. This creates a short current spike that can be bad for the Arduino pin. Especially if you plan to do high-frequency switching.
Diagrams and code:
circuitjournal...
I am using an IRF9540N, but you can use some other logic level P-Channel Enchantment Type MOSFET.
Buy from AliExpress.com:
IRF9540N: s.click.aliexp...
Disclosure: Bear in mind that some of the links in this post are affiliate links and if you go through them to make a purchase I will earn a commission. Keep in mind that I link these companies and their products because of their quality and not because of the commission I receive from your purchases. The decision is yours, and whether or not you decide to buy something is completely up to you.
Music from RU-vid library.

Опубликовано:

 

30 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 85   
@marcov9581
@marcov9581 2 года назад
Connecting the Arduino 5V to the 12V supply really threw me off at first. But I realize you are basically using that as the Reference instead of letting Ground be the common reference point. This way when the arduino output is Low (0V from the Arduino perspective) it is -5V on the Gate with respect to the Source. When Arduino output is HIGH (5V from Arduino perspective) then the Mosfet sees 0V at the gate with respect to the Source. You went over this at ~55 seconds on the Video, but seeing 5V connected to 12V throws me off until I remember voltage would be relative and depend on the common reference point which doesn't Have to be 0V/Ground. We're so used to connecting Grounds to make everything relative to 0V Ground, it seems backwards to leave grounds disconnected for circuits to act relative to the High Side instead.
@alejandroperez5368
@alejandroperez5368 Год назад
Yes, it's a ground-shaking moment for us noobs. Thanks for commenting
@michalaugustyniak6449
@michalaugustyniak6449 Год назад
How to solve it if you have a common ground ? Add another diode between Arduino 5v and the S to block current from the battery ?
@shabbee
@shabbee 2 года назад
If you connect the 12v to the arduino VIN pin, my understanding is that the regulator will provide 5v to the Atmel device. At that point you should be OK to connect the grounds?? This is a question rather than advice. I would also recommend using a NPN transistor to to drive the MOSFET gate, with the collector biased at 12v via 10k resistor, the emitter connected to ground, and the base going to the arduino via a 10k resistor.
@leynardvillagracia6036
@leynardvillagracia6036 2 месяца назад
AFTER 4 YEARS OF UPLOADING THIS YOU ARE STILL HELPING!!
@Learnelectronics738
@Learnelectronics738 4 года назад
Hello brother Ilike your video thank you very much
@Nobody-hs9cl
@Nobody-hs9cl Год назад
"P-Channel MOSFET as a Switch. Turn ON a 12V Motor with Arduino. (Step-By-Step Guide)" ??? Regrettably you DO NOT explain how to turn on a 12 V motor with Arfuino and a P-Channel Mosfet in this Video. Rather, you are just warning that this will damage the Arduino. Pitiable!
@fredd8881
@fredd8881 3 года назад
Can we use analogWrite 0-255 ? In P channel mosfet . I thought that use negative to work in gate
@IndrekL
@IndrekL 3 года назад
Yes, the P-channel Mosfet is controlled with negative voltage on the Gate relative to the Source. That's why it is connected to the 5V instead of GND. If it is connected like that, you can use analogWrite with it.
@winastom811
@winastom811 5 дней назад
This is bullshit explanation, non sense you connect directly no turn on and turn off during operate with transistor
@JacobStevenson
@JacobStevenson Год назад
Could you use a photocoupler (opto-isolator) like PC817 to drive the MOSFET and eliminate the problem with sharing grounds?
@muflah
@muflah Год назад
I generally suggest not only using an optocoupler but using a power transistor as well. May cost a bit more but I've not found these low rated transistors to be very reliable with motors.
@GameAndJokes
@GameAndJokes Месяц назад
Well done video, Appreciate the efforts, you earned a sub, just please dont use music in your videos or atleast keep it very low
@Creative_Electronics
@Creative_Electronics 4 года назад
Good Explaining!! ;)
@IndrekL
@IndrekL 4 года назад
Thanks!
@bakulplastik
@bakulplastik 13 дней назад
sir , I connected 5v Arduino to source in minutes 3, the Arduino emitted smoke
@HS-hz4fx
@HS-hz4fx 4 месяца назад
lets say te power supply for motor is 60 volts, would this circut still works ?
@cuf_
@cuf_ 2 года назад
Thank you so much helped me out man! Btw you sound like an estonian. Am i right? Im from est.
@ljmeng
@ljmeng 3 года назад
I like it. It gives all details.
@phuonganh6445
@phuonganh6445 8 месяцев назад
dùng nguồn khác cũng như không
@brunoperezmedellin7000
@brunoperezmedellin7000 Год назад
Your video is really comprehensive and helped me getting started with MOSFET driving, however i have a doubt about Arduino and it's ground, in case i needed to add sensors or anything that needs a ground with the configuration shown on the video would burn the Arduino? Even if the Arduino was powered with a different source to the motor?
@denizsogutlu2070
@denizsogutlu2070 8 месяцев назад
Thanks Indrek for an amazing explanation. You helped me to solve my 48hrs challenge with correct Mosfet wiring! It's very difficult to simplify and explain stuff like this, really appreciate it!
@greggpierce4077
@greggpierce4077 4 месяца назад
I added 1 component to the circuit and could do away with the Arduino, exactly what I was looking to do! Thanks again Indrek
@awaazmatroko5972
@awaazmatroko5972 Год назад
Hi, nice video, Q: is there MOSFET as a switch, when gate has 0v it switches on, need for 12v ups router
@bigmac9712
@bigmac9712 11 месяцев назад
If my motor runs with 5v then I can use the same power supply for the arduino and the mosfet/motor right?
@charleyandsarah
@charleyandsarah 4 года назад
Good info, thanks, I had only seen people talk about the n channel. Any way to isolate the GND for a single power source? I need to power an arduino off a 12v truck, was planning to use a 5v stepdown converter to power arduino, but I need to PWM the 12v signal to control some hydraulic valves
@IndrekL
@IndrekL 4 года назад
But why can't you use an N channel MOSFET on the ground side of the 12V load? It would make things so much easier. As far as I know all the step down converters expect to share the Ground. So if you step it down to 5V it will be relative to the negative output of the battery.
@charleyandsarah
@charleyandsarah 4 года назад
@@IndrekL I'm controlling hydraulic valves with onboard electronic actuators. They call for a fixed GND and 12V supply with a variable voltage signal wire to control direction and amplitude, with 6V being neutral, and over 6v is one direction, under 6v is the opposite direction. I have potentiometers setup to work it fine, but I want to use an arduino so I can make a wireless control
@gregg2597able
@gregg2597able 4 месяца назад
very good, your the first that I can understand what is going on with these p and n mosfet's 👍
@matteogamer2606
@matteogamer2606 2 года назад
the diode
@gholiamirza7102
@gholiamirza7102 4 года назад
Nice discribed. Thank you.
@IndrekL
@IndrekL 4 года назад
Thank you for the feedback!
@traptown7507
@traptown7507 4 года назад
Indrek
@orides5976
@orides5976 Год назад
Are there any driver chip for P Mosfet?
@netrapatil2169
@netrapatil2169 4 года назад
brother..I want to use a push button to switch a motor ON and off..With mosfet..Can i connect gate to a switch and pther to source with resistor
@IndrekL
@IndrekL 4 года назад
Hey! Yes you can replace the Arduino with a simple switch. How high voltage does the motor need? If you need to turn on a 60V motor, but the maximum gate-source voltage for the MOSFET is 20V then you should use a separate lower voltage source to turn the MOSFET on. If the Motor is 12V then you probably can just connect the switch to the power supply.
@ozkantuzemen
@ozkantuzemen 3 года назад
Hi, if I want to use depletion type mosfet for this project, which component you suggest?
@juntendo6104
@juntendo6104 4 года назад
thanks so much! very simple to understand and solved my problem
@41_ahwaszargar73
@41_ahwaszargar73 3 года назад
The video is misleading when you say connecting 12 V to a 5v from arduino should actually send 7 v inside the arduino leading to frying of arduino .Also Tysm for the information of potentially frying up of arduino and I really loved the fact you used the concept of Vgs Rather than saying give Vg negative using a npn transistor
@muhammedfatihsaruhan7532
@muhammedfatihsaruhan7532 2 года назад
it is not actually . i thought the same at first. but arduino ground is not connected to the ground of power supply . he uses separate power supply for arduino
@tattoome_eu
@tattoome_eu 2 года назад
hi Indrek what's your email or FB I have a few question ?
@happycrayon7621
@happycrayon7621 4 года назад
How come you have so low subscriber. Gonna stay to climb up the ladder to millions.
@IndrekL
@IndrekL 4 года назад
Thanks! The sub count is ramping up slowly. I have to work on my delivery (improving my accent and thing like that).
@muhammadbilal2000
@muhammadbilal2000 2 года назад
Thanks for the simple video. I am still thinking that when the gate is given 0 volt then how Vgs is -5 volt?
@alejandroperez5368
@alejandroperez5368 Год назад
Because you have a +5V cable coming from the Arduino to the transistor's source pin. You apply voltages with two cables, not just one. And it's -5V with respect to the Arduino's ground signal, not the motor power supply.
@StefanoZamprogno
@StefanoZamprogno 4 года назад
Great video thanks! does it work also for 3.3v signal from eg ESP8266 ?
@IndrekL
@IndrekL 4 года назад
It denepnds on the MOSFET. If you find a logic level MOSFET that fully switches ON below 3.3V then you can. The one I am using switches fully ON at around 4V (according to the datasheet). So you could not use exactly the same one I was using. If it is not fully switched on, then the MOSFET will get hot.
@yassindahmen203
@yassindahmen203 3 года назад
thank you everything is well explained. However i have a question about the fly back diode what are its specifications ?
@IndrekL
@IndrekL 3 года назад
Hey! I used a 1N4007
@CURIOSIDADEOUCRIATIVIDADE
@CURIOSIDADEOUCRIATIVIDADE 3 года назад
what is the model of the channel p mosfet used in the video?
@IndrekL
@IndrekL 3 года назад
I used a IRF9540N
@CURIOSIDADEOUCRIATIVIDADE
@CURIOSIDADEOUCRIATIVIDADE 3 года назад
@@IndrekL ok obrigado
@caffeinatedinsanity2324
@caffeinatedinsanity2324 4 года назад
That's a good video. Also thanks for the warning part :) I recently saw that you can avoid that power supply problem by controlling the P channel mosfet with another transistor (like an NPN or an N channel mosfet). That way you have two isolated circuits
@IndrekL
@IndrekL 4 года назад
Hey! Thank you for the feedback! Yes, with another mosfet/transistor it is possible to fix ground connection problem.
@elliot1784
@elliot1784 4 года назад
@@IndrekLAny good resource for this 2 mosfet approach?, thanks. great video!
@elliot1784
@elliot1784 4 года назад
Could you provide where you saw this, hoping to implement the 2 mosfet method. thanks!
@hardcoregaming4118
@hardcoregaming4118 2 года назад
@@IndrekL bro you deserve a 100millions years of electronics and our world thankyou I'm from India
@salahuddintarar6539
@salahuddintarar6539 10 месяцев назад
@@IndrekL AS the same Inductive load (Motor) You used in case of N -channel MOSFET ,then why you did not use flyback diode in that case (N-Channel MOSFET )?
@shivamdeshpande1959
@shivamdeshpande1959 4 года назад
Thanks for the very nice video and clear cut explanation. I am looking for the P channel (D-S) MOSFET for one of my project and its part number is Si2309CDS by Vishay Siliconix. I am not getting exactly what the D-S MOSFET is and how it is different from a normal P channel MOSFET. Can you please help me with this
@IndrekL
@IndrekL 4 года назад
Hey! I am guessing that the "D-S" is referring to Drain and Source. As in "the current is flowing through the Drain and the Source". I tried to google it but didn't find any significance of that marking.
@shivamdeshpande1959
@shivamdeshpande1959 4 года назад
Okay thank you 👍 And thanks for the video, it was really helpful
@jonathanvanbuskirk5326
@jonathanvanbuskirk5326 4 года назад
This is sending 5v to a 12v motor
@IndrekL
@IndrekL 4 года назад
No, it is not. The only place to get 5V out of this circuit is between the Arduino 5V pin and Arduino GND. But Arduino GND is not even connected to the motor.
@dogeeatsveggies
@dogeeatsveggies 3 года назад
its basically the same with the N-channel, but works differently. thank you!
@RichardKuivila1947
@RichardKuivila1947 Год назад
"Same" "But Works" "Different" .... ? ?
@rehmanazhar6517
@rehmanazhar6517 6 месяцев назад
@@RichardKuivila1947 😂
@sunilkumar-ls2yb
@sunilkumar-ls2yb 4 года назад
Bro can you explain Why you connected 12 volt to power arduino 5v pin pin
@IndrekL
@IndrekL 4 года назад
Because a P-Channel MOSFET is a "high side switch" and must be connected to the VCC side of the circuit. To achieve this I need to pull Arduino 5V and the positive side of the 12V power source to the same level (note that the grounds are NOT connected). An N-Channel MOSFET is actually a bit simpler. Then you connect the grounds and it is easier to understand.
@sunilkumar-ls2yb
@sunilkumar-ls2yb 4 года назад
@@IndrekL thanks broo.. It was really helpfull
@biasedbit
@biasedbit 3 года назад
@@IndrekL thank you for the great tutorial! I've applied this to my project and it worked out great! 🙌 But I confess I'm still a bit confused by this step -- joining the 12V and 5V. I'm very new to this type of thing, would you mind helping me understand what's going on here (is the 12V side pushing current to the 5V side, are the voltages adding up/being subtracted?) and what you call this kind of merging of two different voltages without a common ground? Thank you!
@faizmajeed409
@faizmajeed409 3 года назад
You use 12volt battery and how many amperes?
@IndrekL
@IndrekL 3 года назад
Hey! I didn't use a battery. I used a power source that is plugged into the wall. I don't remember exactly, it was probably somewhere between 0.5 and 1 amper.
@faizmajeed409
@faizmajeed409 3 года назад
How many volt that the mosfet need to on the gate?
@IndrekL
@IndrekL 3 года назад
@@faizmajeed409 The Vgs(th) = -4V. According to the datasheet, the optimal for ON position is -10V, but it didn't get hot at all with Vgs = -5V and sub 1A load.
@faizmajeed409
@faizmajeed409 3 года назад
Okay bro thanks👍
@melkerper
@melkerper 4 года назад
Good video!
@IndrekL
@IndrekL 4 года назад
Thanks!
@make6689
@make6689 4 года назад
How much current does the motor consume?
@IndrekL
@IndrekL 4 года назад
Hey! I don't remember exactly. It might have been somewhere around 1A
@BegginersGuidetoCode
@BegginersGuidetoCode 3 года назад
12V @ 0.1A
@gaurabpokharel6373
@gaurabpokharel6373 2 года назад
There is no negetaive 5 v in Arduino , its 0 v that turns on mosfet , because you are turning on and off it worked
@IndrekL
@IndrekL 2 года назад
The voltage is always relative. If you use the Arduino's 5V as 0V from the perspective of the MOSFET then Arduino's GND is -5V.
@ConspiracytardHunter420
@ConspiracytardHunter420 4 года назад
my adafruit esp32 feather died, i guess i did something wrong, rip im broke, so much for this robotics bs, back to reddit
@exessd7051
@exessd7051 Год назад
12V into arduino 5v output ??? what the hell !
Далее
ХОККЕЙНАЯ КЛЮШКА ИЗ БУДУЩЕГО?
00:29
Свадьба Раяна Асланбекова ❤️
00:12
MOSFETs and Transistors with Arduino
40:50
Просмотров 1 млн
#BB4 MOSFETs - From an Arduino Perspective
15:10
Просмотров 22 тыс.
I Made My Own Computer | Let's See How It Works
7:51
Просмотров 788 тыс.
How to Build a High Side Switch
13:34
Просмотров 71 тыс.
ХОККЕЙНАЯ КЛЮШКА ИЗ БУДУЩЕГО?
00:29