Hi. Today I'm going to show you
how to drive a 12V LED strip
from an Arduino.
And to accomplish this, we're using
an N-Channel Mosfet.
Now, obviously the Arduino cannot power
the LED strip directly.
First of all, the Arduino can only put out
a maximum of 5V
Secondly, it can only draw a small
amount of power from each pin.
So obviously it wouldn't be enough to
light up this whole LED strip.
Now I'm going to keep this video quite
basic
because there's already quite a lot of
videos and information out there
about Mosfets and the Arduino.
So I'm really just keep it basic,
and let you set it up
and get going in a couple of minutes.
And then if you want to know more about
it, you can always do more research.
Now an N-channel Mosfet has 3 pins:
The Gate, The Drain, and The Source.
So it's Gate, Drain, Source.
Now Source is where our power's
going to come in
for instance, from our battery.
The drain is where it's going to go out
and the gate is how we're going to
control those pins there
basically connect it together.
So what do you need to do this?
Well, you need your Arduino obviously
which I'm just running from a USB
powerpack.
You need your N-Channel Mosfet. Pretty
much anyone would do.
Just check to make sure that it can
handle the amount of amps
you want to push through it, and ideally
go for the L-series, which is 'logic'
Which means that the gate can be driven
from a low voltage
for instance the 5V of an Arduino.
You need your 12V LED strip.
You need your 12V power source. In my case
I'm using a 12V battery.
and then you just need some wires to
connect everything together.
Now you can do this on a breadboard, but
to keep things simple, I'm not going to.
So the first thing you want to do is take
your positive from the battery
your 12V source, and you connect that
to the positive of your LED strip.
The next thing you want to do,
is take your negative
from your 12V power source
and connect that to the gate drain source.
So this pin here, which is your source.
Next, you want to connect your drain,
which is the middle pin
so that's this one here...
but this tab here is also
considered middle pin
So I'm going to connect it there, and
you'll take that over to your LED strip.
Now you need to connect the ground of your
Arduino to the ground of the battery
so I'm just going to use this
jumper cable to do that.
You can see that the lights
are flickering a little bit
That's because the gate is actually
picking up a little bit of charge
which is left inside...a static charge.
Once we connect it, we'll be
able to control that.
So, ground from the Arduino
to ground of the battery.
There you go.
And then, I've already flashed the
fade sketch onto here
so you can see pin 13 is fading on and off
I'm not sure how easily you'd
be able to see that
so we'll connect the jumper
cable to pin 13
and we'll connect that to the
gate pin of the Mosfet
which is the one on the very left.
And now you can see that it's
making the 12V LED strip fade
the same as pin 13 on here.
And it's really that simple.
So what's actually happening here?
Well, the negative from the battery comes
through the source pin, right here.
then it drains out through the
drain pin to the LED strip
and basically, we're connecting these
two pins, or opening them, closing them
by telling the gate, 'Hey open,
close, open, close...'
and we're creating the fade
effect using standard PWM
So, I'll bring the camera closer and give you
a good look at what's actually going on here
So let's take a closer look at what's
going on here.
You have the positive of the battery going
through to the positive of the LED strip
and you have the negative of the battery
coming through to the source pin
of the N-Channel Mosfet
and then it's going out to the
drain pin, which is the middle pin here
and that's going through to the LED strip.
So basically, the negative is
coming through here
going to the N-Channel Mosfet, and
then going out the N-Channel Mosfet.
and we're controlling when
these two are connected
or when it's opened or closed by using
this pin here, which is the gate pin
and that's connected to the Arduino
via pin 13 here.
and because we have the
fade sketch on pin 13
when it fades, pin 13, it's sending that
signal to the Mosfet
which is then opening and closing
this connection very fast
and that's creating the PWM
fade right here.
So you can consider it
kind of like plumbing
when you tell this pin to open it
It's going to let everything flow
between these two pins
and when you tell it to close,
it stops it.
And because it's opening
and closing it so fast
it's varying the amount of power that's
going through to the strip
and it's creating this nice
PWM fade effect.
So I hope this video has helped you
understand how to use an N-Channel Mosfet.
I've watched a lot of different videos
and I really found it quite confusing,
It had so many wires going everywhere,
that I couldn't easily understand it
and I'm over-simplifying things
in this video
but it's enough to actually get
you up and running
and then later on, you can find out
enough ways you can do things better.
Now an important thing to remember is to
join the ground from your 12V power source
to the ground of your Arduino.
If you don't do that, you won't
be able to drive the Mosfet.
Now there is a difference between
P-Channel Mosfets and N-Channel Mosfets
and I'm not going to go into the
difference but basically
a P-Channel Mosfet is going
to make your life hell
and the N-Channel Mosfet is going
to make it super easy
so, unless you have a specific reason
why you need to use the
P-Channel Mosfet, don't bother.
So just remember: Gate, Drain, Source.
Whenever you put a positive
voltage on the gate
it's going to make the drain
and the source connect
and the power will flow through.
So I hope you enjoyed this video
Please remember to give
a thumbs up, and subscribe!
And if you have any questions, leave
them in the comment section below.
