Control 12v LED strip from Arduino using a Mosfet

Ғылым және технология

A simple guide to controlling 12 volt LED strips from your Arduino using an N Channel Mosfet.
In my example I'm using PWM to fade the 12v LED strip, but you could just as easily turn the LED strip on and off instead of fading it. Also it doesn't have to be an LED strip and it doesn't have to be 12v!
If you're going to drive a motor or a relay (or any inductive load) using this setup, you should add a diode across the positive and negative input of the motor/relay to avoid any back voltage.
I've over simplified things in terms of my description and the circuit, but it should be enough to get you up and running and to give you a basic understanding of how an N-Channel Mosfet works.
Pretty much any N Channel Mosfet will be fine, but ideally you want to go for an L series, because the gate can be reliably driven at lower voltages, such as the 5 volt from the Arduino.
If you're curious, a MOSFET is a metal-oxide-semiconductor field-effect transistor. The benefit of a MOSFET over the traditional relay is that it can turn on and off extremely quickly, meaning it's suitable for PWM, compared to the old coil relay which can't turn on and off so quickly. Of course a modern solid state relay can compare against a mosfet or transistor.
SUPPORT ME: If you enjoyed this video, please remember to give a LIKE and click here to subscribe to my channel - kzread.info_c...

Пікірлер: 434

  • @GadgetAddict
    @GadgetAddict7 жыл бұрын

    You might prefer the simplicity of an Arduino relay board.. kzread.info/dash/bejne/onWs2MeRdpS9Zrg.html

  • @Lot10Games

    @Lot10Games

    6 жыл бұрын

    Not when need low consumption in Arduino. Take my case, I am powering nano from sun(as a battery controller and house automatization), relay module uses 30mAh each, and my project without relay on consumes

  • @AlejandroCastiblanco171

    @AlejandroCastiblanco171

    6 жыл бұрын

    which mosfet did you use? what resistance ?? can you share a diagram? is a IRF540N

  • @gg-gn3re

    @gg-gn3re

    5 жыл бұрын

    @Alejandro did you eve read the IRF540N? What are you trying to power, an entire building? Holy shit that is a big mosfet. That can barely even be driven by the low voltage of arduino LOL

  • @BillyNoodles

    @BillyNoodles

    4 жыл бұрын

    relays ew

  • @mangalaabewardana197

    @mangalaabewardana197

    2 жыл бұрын

    @@gg-gn3re pls help me give me example for n channel L series mosfet

  • @CraigMansfield
    @CraigMansfield2 жыл бұрын

    Clear. Intelligent. Nothing superfluous. No annoying music. What a joy And how wonderful that is the missing part of my project.

  • @jonathanm9436
    @jonathanm94368 жыл бұрын

    Really impressively paced, clear, logical, explanatory and complete. I'm relieved to have found your video so early in my search - to dim about 9m / 7.5A of LED ribbon using an Arduino instructed by the circuit dimming function provided by my house's Dynalite automation system. That second bit is the next challenge - I suspect by analogue sampling. I look forward to exploring the rest of your videos.

  • @christianeriksson4733
    @christianeriksson47334 жыл бұрын

    A genuine thank you from Sweden for this hands-on and effective explanation of the concept.

  • @SmartLifeEnthusiast
    @SmartLifeEnthusiast8 жыл бұрын

    The amount of RedBull in this video is too damn high!

  • @GadgetAddict

    @GadgetAddict

    8 жыл бұрын

    +ThatCoder I

  • @chillzwinter

    @chillzwinter

    8 жыл бұрын

    +ThatCoder He'll be an insulin dependant diabetic by the time he is 30, if he's not already.

  • @aidanmeyer7825

    @aidanmeyer7825

    8 жыл бұрын

    If he's not already 30, or if he's not already a diabetic?

  • @loukask.9111

    @loukask.9111

    7 жыл бұрын

    holy moly just saw it :D

  • @vitpodstavka7103

    @vitpodstavka7103

    5 жыл бұрын

    Depends on the time in which he drank them. If it took him 3 months he is probably fine, if it took him 3 days it is a diffrent story

  • @JSROOKS
    @JSROOKS7 жыл бұрын

    GREAT video! So well thought-out, and wonderfully presented. Top marks. I am building a 4-bank led controller right now, and I think that the Mosfets and pots(inputs) will do the trick nicely.

  • @dogsborodave
    @dogsborodave6 жыл бұрын

    Simplicity rules the day! This is a fantastic tutorial and exactly what I needed. Thank you.

  • @johnberry5339
    @johnberry53394 жыл бұрын

    Another Great tutorial, I cant believe its taken me 6 years to find it lol. Thanks John 👍😁

  • @RallyGeek12
    @RallyGeek128 жыл бұрын

    Really easy to understand. Perfect inspiration for beginners to get a handle on how to do this. I like how you keep the detail for later follow up. My electronics knowledge is quite lapsed and I needed a quick guide how to drive an Ikea Ledberg strip. Thank you for the excellent posts! :)

  • @FrozoWolf
    @FrozoWolf8 жыл бұрын

    Watched over 10 video's nether of them let me understand how a mosfet works. This one is just great! I directly understood it and how I can take use of it! Thank you so much! You earned the like!

  • @GadgetAddict

    @GadgetAddict

    8 жыл бұрын

    +FrozoWolf I'm glad it helped you! It took me awhile to wrap my head around the topic so I figured I'd try make an easier to understand video!

  • @mcbbcn
    @mcbbcn2 жыл бұрын

    I love this video. It's one of the simplest and most effective explanations I have ever seen. That was amazing. Thank you for what you do!!!

  • @kwisatzhaderach1458
    @kwisatzhaderach14585 жыл бұрын

    Simplicity is exactly what we need. Great video

  • @MrRobertpn
    @MrRobertpn9 жыл бұрын

    excellent video - finally found this after reading lots of technical stuff that assumed a lot of prior knowledge. you are a great teacher!

  • @alcidesmarcano
    @alcidesmarcano4 жыл бұрын

    Thank you so much for your great video, I was stucked in my project with N Channel Mosfet and you light me about the need to bridge my ground to esp8266 and 12v source, thank you so much, I appreciate that... You have one more subscriber!!!

  • @josephke20
    @josephke206 жыл бұрын

    this video is so clear, simple and concise that i cant even not even, good show, old chap

  • @ekopurnomo325
    @ekopurnomo3257 жыл бұрын

    Your expalanation about mosfet is the clearest. Thank you very much...

  • @jasonorozco1587
    @jasonorozco15879 жыл бұрын

    Excellent! Like you said, I was able to find a lot of videos that just explained the physics behind the mosfet, and I get it, but they all left me unable to figure out how exactly to control some LEDs from my arduino. As soon as you pointed out that the ground of the arduino needed to connect to the ground of the power supply, my problem was solved. I was really concerned about how the gate would be controlled without a ground connection in the first place. Thank you!

  • @GadgetAddict

    @GadgetAddict

    9 жыл бұрын

    I'm glad it helped you out. Once I finally got it working, I realised that it's really very simple. I'd watched so many videos and tried to follow along without any luck. So once I finally understood it, I wanted to create a video that explains it as simply as possible, so other people can get up and running without too much bother.

  • @seditiousmonkeyart
    @seditiousmonkeyart2 жыл бұрын

    You did a good job. You explained everything well and did a pretty good job on the production too.

  • @matron_gaming
    @matron_gaming6 жыл бұрын

    I want to thank you. You did great video without cuts and show that there is nothin else to do. greayt

  • @Holoduke9
    @Holoduke98 жыл бұрын

    Thanks mate, i researched some days without a solution. I try to manage high voltage motors with mosfet. At min 3 when you explain the problem of connection between ground of power supplies i got the solution to my problem. Thanks for publishing.

  • @GadgetAddict

    @GadgetAddict

    8 жыл бұрын

    +Holoduke9 I'm glad you found a solution :D

  • @electrichorror6642
    @electrichorror66425 жыл бұрын

    You are a legend mate. Very nice fellow connecting up the MOSFET

  • @Mrtfrimet
    @Mrtfrimet9 жыл бұрын

    I found your video very helpful, clear and easy to understand. Thank you!

  • @MillaeGiuliano
    @MillaeGiuliano7 жыл бұрын

    Great lesson, clear simply and communicative! You are the Sheldon Cooper of the Electronic science, but more pleasant, Thaks for publishing. Roberto.

  • @GadgetAddict

    @GadgetAddict

    7 жыл бұрын

    Thanks Roberto :)

  • @ofekpearl
    @ofekpearl7 жыл бұрын

    Thanks for the explanation! May the force be with you!

  • @yoramswiers
    @yoramswiers3 жыл бұрын

    Really nice video explaning the workings of a arduino pwm and a mostfet!

  • @karlgerardmiclat2137
    @karlgerardmiclat21373 жыл бұрын

    Simple, basic, crystal clear... Also a fan of Manny..

  • @trinathon36
    @trinathon369 жыл бұрын

    Exactly what I was looking for. Thanks a bunch!

  • @cathalbr1
    @cathalbr18 жыл бұрын

    Well done. You made a big difference to me and my project. Made a complicated issue very easy. Thanks again. Its appreciated.

  • @GadgetAddict

    @GadgetAddict

    8 жыл бұрын

    +Cathal Brennan I'm glad it helped! :)

  • @Nastaliss
    @Nastaliss9 жыл бұрын

    Simple, but effective. Nice job there.

  • @sized4spills
    @sized4spills8 жыл бұрын

    Wow thanks, you made it very clear and simple.

  • @KraKaKrwa
    @KraKaKrwa5 жыл бұрын

    Thank you. A simple example of mosfet

  • @michaelurwin2526
    @michaelurwin25264 жыл бұрын

    Great explanation. I'm very new to this and you just helped me out tonnes! Cheers

  • @ChipHirn
    @ChipHirn9 жыл бұрын

    Thanks buddy! :) straightforward - perfect.

  • @makerjason1034
    @makerjason10347 жыл бұрын

    Encouraged to use mosfets now. Thanks.

  • @robertgrain7368
    @robertgrain73688 жыл бұрын

    Thank you very much just learning about these things and gave me a great grounding tutorial.

  • @Slozkins
    @Slozkins7 жыл бұрын

    Thanks, this video is exactly what I was looking for

  • @SK-cp5eh
    @SK-cp5eh6 жыл бұрын

    Thank you very much, great tutorial! This worked perfectly with a BUZ11 N-Channel MOSFET

  • @MrMegamok

    @MrMegamok

    2 жыл бұрын

    I'm using a buz11 transistor as well. However, the LED's are significantly dimmer compared to when I connect them directly to the power source (With %100 duty cycle). Is this something you have encountered or do you know why this happens?

  • @CraigMansfield
    @CraigMansfield2 жыл бұрын

    Absolutely perfect for my project!! Thank you 👊🏻

  • @summa8435
    @summa84357 жыл бұрын

    thanks for your video, it is really nice for newbies like me to understand and i am now possible to try on my own

  • @WhoWantsToKnow81
    @WhoWantsToKnow819 жыл бұрын

    It's Sheldon!!!

  • @PirateGamINC
    @PirateGamINC8 жыл бұрын

    Best tutorial out here :)

  • @nasirillasarie3664
    @nasirillasarie36648 жыл бұрын

    Do you have a link for the exact MOSFET that you used?

  • @julinaut
    @julinaut6 жыл бұрын

    that actually helped me a lot! thanks!

  • @ninety85
    @ninety859 жыл бұрын

    You have awesome videos mate, keep it up.

  • @GadgetAddict

    @GadgetAddict

    9 жыл бұрын

    Thanks for the feedback :)

  • @mohammadibrahimkhan5754
    @mohammadibrahimkhan57549 жыл бұрын

    video was really helpful thanks

  • @richardhalling4398
    @richardhalling43987 жыл бұрын

    great video, very clear and easy to follow, thanks!

  • @GadgetAddict

    @GadgetAddict

    7 жыл бұрын

    I'm happy you found it useful :)

  • @electricrainbowness
    @electricrainbowness9 жыл бұрын

    you're amazing! thanks this really cleared things up!

  • @mohammedalenezi3807
    @mohammedalenezi38077 жыл бұрын

    I don't give like that easy but, you really deserve it Excellent explanation 👍🏻 And I subscribed 🤝

  • @GadgetAddict

    @GadgetAddict

    7 жыл бұрын

    +Mohammed AlEnezi excellent, thanks !

  • @star_dax
    @star_dax6 жыл бұрын

    Very well explained.. Thank you so much!

  • @carlylea
    @carlylea8 жыл бұрын

    Thanks for posting this video!

  • @guidopiotrowski7900
    @guidopiotrowski79007 жыл бұрын

    Thanks for the video mate!

  • @markcurd8899
    @markcurd88997 жыл бұрын

    Great video, thanks for sharing!

  • @BlitzHopB
    @BlitzHopB5 жыл бұрын

    Great explaining, subscribing! Keep up!

  • @anonymouse7290
    @anonymouse72907 жыл бұрын

    Thank you so much!! this video helped a ton! i love you

  • @wolfpack4128
    @wolfpack41286 жыл бұрын

    Going to use this to control the lighting I've added in the interior of my truck by the stock OEM dimmer so it will dim with the backlighting.

  • @KevinBritain
    @KevinBritain8 жыл бұрын

    Great explanation.. Great job man..

  • @JethroGillgren77
    @JethroGillgren775 жыл бұрын

    Thanks, clearest tutorial online, and it works! But my N Channel MOSFET quickly overheats while idle (ie the gate is closed), so i think anyone reading this needs to order a 'Logic' N Channel MOSFET..

  • @Estudio322

    @Estudio322

    5 жыл бұрын

    Yes, always look the datasheet for the Threshold Voltage, that is when the MOSFET is fully turned on in the Saturation Region. Or you could simply make a proper voltage polarization circuit for the gate of the MOSFET with just a general purpose BJT transistor and some resistors.

  • @raskjaerbo
    @raskjaerbo8 жыл бұрын

    Nice one, brother. You just saved me from buying a relay ;)

  • @edisonmecaj769
    @edisonmecaj7698 жыл бұрын

    great tutorial for newbies like me... thanks

  • @xyzatin
    @xyzatin2 жыл бұрын

    Simply Amazing. Thank you so much.

  • @melbournepangilinan4836
    @melbournepangilinan48364 жыл бұрын

    wow, bro! nice shirt...Manny and amazing video tutorial.

  • @outcry27
    @outcry279 жыл бұрын

    Thank you very much for making this video. I'm currently working on designing a prop FX package around an Adafruit "Pro Trinket" mini Arduino board, and needed a way for the 3v Trinket to control a muzzle flash LED running on a much higher voltage. I was wondering if I could use a MOSFET to do it, and not only did your video confirm my theory, it showed me exactly how to set it up. Again, thanks.

  • @arichitkumarpatha8514
    @arichitkumarpatha85145 жыл бұрын

    Thank you bro.. its very helpful tutorial...

  • @boydbros.3659
    @boydbros.36596 жыл бұрын

    Loved this, thank you

  • @guidopiotrowski7900
    @guidopiotrowski79007 жыл бұрын

    Great video! Thanks!

  • @barryward1698
    @barryward16986 жыл бұрын

    Thank you for the video! It helps a lot! I am trying to program an LED light strip to chase the lights with the Ardunio Fleather board. Will the Mofset work for this?

  • @aekidna
    @aekidna8 жыл бұрын

    Nice video! Do you reckon that this kind of approach could work to attach high current drawing stepper motors like NEMA34 to low current stepper drivers (like grbl shield)? Would the mosfet be fast enough for CNC accuracy? Cheers!

  • @marcetigreshark
    @marcetigreshark8 жыл бұрын

    THANKS FOR THE VIDEO, IT WAS OF GREAT HELP TO ME BEST REGARDS

  • @ernestosastre7555
    @ernestosastre75558 жыл бұрын

    00:00 sheldon cooper Btw, great video

  • @senne8556
    @senne85568 жыл бұрын

    Great video! it really helped me to understand the work of mosfets in combination with arduino. I have a question though: Sometimes I read on the internet that the mosfet doesn't need a connection to ground. You hook up the ground of the arduino to the negative (ground) of the powersource, is that really necessary?

  • @CaptainsDrydock
    @CaptainsDrydock6 жыл бұрын

    Superb and easy to follow guide. Worked great thanks :) I had a issue when applying it when the pin has code where the light needs to be completely off i.e. When power is applied, the LED strip comes on instantly before going to it's lowest dim level. But I need it to not light up when power is applied until my code tells it to. I'm assuming this is a MOSFAT issue circuit issue as it happens with any code I use, as the code works when I use single LED(S).

  • @dukesnyder3607
    @dukesnyder36075 жыл бұрын

    Good video, thank you!!

  • @TaffoVelikoff
    @TaffoVelikoff6 жыл бұрын

    In other videos but with RGB strip they also use a resistor between the arduino and the transistor. The light is more bright without it, so is it safe not to use one (1kresistor)?

  • @Mr_ToR
    @Mr_ToR7 жыл бұрын

    Thnx a lot for this great video. I have a couple of questions. Since LED illuminance is driven with current, how do you calculate min and max current supplied? Also, if my led strip requires 1.5 Amps, what should the power supply be and which mossfet should i use? Thnx a lot.

  • @Inesophet
    @Inesophet7 жыл бұрын

    My god, i have tried for bloody 8 months to understand mosfets. Problem was i had gotten a bad batch, nearly none where working. the Mosfets just didnt do what they where supposed to. Got a new batch and FINALLY they are working. I thought i was going MAD.

  • @mohanadobaid8285
    @mohanadobaid82857 жыл бұрын

    Thank you! very simple, but i tried this with led spotlight and it's flickering when the analog value of the arduino under 100, any suggestions?

  • @brdane
    @brdane9 жыл бұрын

    Thank you for the tutorial bud. This really opens some doors for programming 12v leds with the arduino. You could basically make your own animated light show and sync it with music tracks or live. It's like DMX lights but cheaper and you get the same effects, if you know how to code it right.

  • @GadgetAddict

    @GadgetAddict

    9 жыл бұрын

    brdane Yep! Although for big light shows you might want to buy a cheap 8-relay arduino compatible board. That's what I did for my halloween light show (its on my channel). Be sure to buy the solid state relay board because I found the standard mechanical relays would become 'sticky' if you ran them too fast.

  • @brdane

    @brdane

    9 жыл бұрын

    Gadget Addict can those type of relay boards support PWM?

  • @GadgetAddict

    @GadgetAddict

    9 жыл бұрын

    brdane Ah sorry, no they wont be any good for PWM.

  • @brdane

    @brdane

    9 жыл бұрын

    Gadget Addict gotcha gotcha. I think just mosfets by themselves should do the job. I'm not doing really long light shows, it's just for live bands, pre-programmed to go synced up to the band.

  • @deadlykiller27

    @deadlykiller27

    5 ай бұрын

    @@GadgetAddict Your entire channel is now dedicated to traffic stops?!?? And for some reason they have a lot more views than videos like this? What is going on.

  • @oresteselias
    @oresteselias6 жыл бұрын

    Well explained !!! Fianally

  • @SrgjanLDTeam
    @SrgjanLDTeam8 жыл бұрын

    ive been asking how to use external power source with arduino for a year, finnaly i got simple answer in 5 minutes, the mosfet shit..... just ordered online.. thanks.

  • @GadgetAddict

    @GadgetAddict

    8 жыл бұрын

    +Srgjan XXI No problem :)

  • @m810203
    @m8102038 жыл бұрын

    Thanks for your video !!! :D

  • @maxpagel8951
    @maxpagel89519 жыл бұрын

    great video thanks for that

  • @MrSomeDude
    @MrSomeDude7 жыл бұрын

    nice video!

  • @habeshaentertainment9845
    @habeshaentertainment98459 жыл бұрын

    nice job keep it up

  • @2gigahijau
    @2gigahijau3 жыл бұрын

    Hallo, your video' helped me a lot, so thanks man! I have a quick question though, What if im gonna use 2 Led tape? can i just add the LED To a PWM arduino pin, or should i add another power supply first?

  • @vasanthvasee9206
    @vasanthvasee92064 жыл бұрын

    Hello, can I know the exact number of MOSFET you used for tutorial???

  • @mangalaabewardana197
    @mangalaabewardana1972 жыл бұрын

    So please tell me for example to N type MOSFET. I can buy. I m beginner to electronics so i need help me.

  • @meowman8958
    @meowman89589 жыл бұрын

    Hello Sheldon Cooper.

  • @BrutalGames2013

    @BrutalGames2013

    5 жыл бұрын

    The same thing I was thinking :D

  • @LedControllers
    @LedControllers3 ай бұрын

    Is it possible to provide signals to both the anode and cathode from a microcontroller, and then obtain a 15 amp output from the MOSFET? Can the MOSFET accommodate giving an anode signal to the drain pin?

  • @hodpath1632
    @hodpath16323 жыл бұрын

    I did exactly as you said. II'm using an IRF 540 MOSFET. The LED strip lights up but does not blink while the onboard arduino blinks. Any guesses what is wrong

  • @treborsmith7416
    @treborsmith74169 жыл бұрын

    Well done kabayan!!! Cheers. ...

  • @aerobots4947
    @aerobots49475 жыл бұрын

    Thanks my attraction to using a mosfet is that it's smaller and more efficient than using a relay. I want to turn on and off a GPS. Does it matter if I connect positive in stead of negative via the source and drain? Can you give us a link to the "fade sketch"? Thanks again!

  • @Umby73you
    @Umby73you8 жыл бұрын

    Hi, many compliments for Your video. Just a info: i need to make a counter up/down to realize a volleyball scoreboard. I want to use a LED strips (35 led for digit for a total of 4 digits). Do You think is it possible using mosfet instead rele? How about to use a PC power supplier? Thaks a lot, Umberto.

  • @damichl9684
    @damichl96842 жыл бұрын

    I want to fix my led Controller. There is one mosfet defect. I would like to build not the same one but a larger one. How do I find out which mosfet I need.

  • @SCARREDMTBER
    @SCARREDMTBER7 жыл бұрын

    +Gadget Addict where can i buy an N channel Mosfet suitable for controllings something 3V? It draws 250mA so i need to power it separately.

  • @Lot10Games
    @Lot10Games6 жыл бұрын

    Good video.Good example. Don`t drink that poison from the window!

  • @wilfriedvanhees
    @wilfriedvanhees6 жыл бұрын

    I use a 12v power supply for the arduino. Can i use the Vin pin instead of a separate 12v battery, to power the ledstrip?

  • @shusterme
    @shusterme6 жыл бұрын

    Hi, nice video! Can you please put the links to the harware you've used? Moset nad led strip. Just to check the specs and be sure that I'm buying the right things. thanks

  • @deathmetallica2nd
    @deathmetallica2nd4 жыл бұрын

    Few questions here.. Which MOSFET are you using in the circuit? Don't we need a pull down resistor connected at gate of the MOSFET? In case to avoid misreadings at the gate due to capacitive discharge and turn ON the gate/LED when we actually need it turn OFF. Also, does MOSFET's Vds respond to PWM in the same way as the PWM at Vgs? That's really cool if it does. I thought MOSFET could just be used to turn off and/or on.

  • @bradleybauer7874
    @bradleybauer78749 жыл бұрын

    I've been reading a lot about this type of stuff recently, while just trying to get a couple of 12v LED's to light. I should be able to give this a try in a week or so since my LEDs will finally come in. I've a Raspberry Pi though not an arduino,

  • @GadgetAddict

    @GadgetAddict

    9 жыл бұрын

    You can do the same thing with your raspberrypi :) I've done something similar using servo motors and python on the Pi :)

  • @bradleybauer7874

    @bradleybauer7874

    9 жыл бұрын

    Nice!, well thanks for the video man, it really helped.

  • @imanh92
    @imanh929 жыл бұрын

    Thank you so much!

Келесі