Arduino MOSFET project

If you’ve been working with the Arduino, you probably know how often it is required to use a motor with it, especially in robotic projects. In one of our previous tutorial, we learned how to control small motors with a transistor, but what if you want to control a much bigger one? The answer for your need is a MOSFET. According to Wikipedia, a MOSFET is:

A type of field-effect transistor (FET). It has an insulated gate, whose voltage determines the conductivity of the device. This ability to change conductivity with the amount of applied voltage can be used for amplifying or switching electronic signals.

In other words, a MOSFET is just a type of transistor that has a Gate instead of a Base (as compared to the bipolar transistor) and this Gate is isolated so it is much safer to use with the Arduino. There is more behind the MOSFET which we won’t cover in this session. We are going to use the IRF44N MOSFET, a really cheap and popular field effect transistor.

Arduino Mosfet

Here is the list of parts we will need for this project:

  • 1 x Arduino Uno board
  • 1 x IRF44N MOSFET
  • 1 x 775 motor (or other)
  • 1 x Breadboard
  • 1 x jumper wires
  • 1 x 12V power supply

You can use any other transistor, just check out its pinout and datasheet to make sure that it can be used with the rating needed in this project.

If you have all of the components that we need, you can connect them together using the schematic below.

To power this circuit, we need an external power supply of 12V but a 9V should be ok as well. You can connect it to Arduino with the DC jack.

It is very useful to use cables with crocodile clips to connect jumpers to the motor, they will hold safely and help you avoid soldering.

We can use the analogWrite function to control the motor speed with a PWN signal.

If you use a relay to control your motor, you would not be able to control it with the PWM signal. Relays responses will be too slow for such applications.

The code will increase the motor speed, will slow it down and do that over and over again. Here is the code:

void setup() {
pinMode(9, OUTPUT);
void loop() {
for(int a = 0; a< 255; a++) 
analogWrite(9, a); 
for(int a = 255; a > 0; a--)
analogWrite(9, a);

As you can hear, when it is not moving it makes odd sounds. That’s because of the current that flows through the motor coils.

And here we go! Don’t hesitate to drop a comment below in case you need further information about this project.

Feel free the check other projects here.


Related Posts