Arduino Motor Interfacing using MOSFET and PWM

แชร์
ฝัง

ความคิดเห็น • 223

  • @Fredster9984
    @Fredster9984 8 ปีที่แล้ว +2

    I want to thank you for putting together a excellent example of how to use the MOSFET. I really like the clear instructions and the way you step through these simple circuits. I'm using this to help get the kids interested in electronics, and you do a great job of explaining the steps, and the reason for the steps.

  • @plaije
    @plaije 8 ปีที่แล้ว +2

    And suddenly it works. Thank you Dorian for including enough information to pull me all the way through a tutorial with results. This video is a great help.

    • @DorianMcIntire
      @DorianMcIntire  8 ปีที่แล้ว

      j. plaiss I'm glad you had a happy ending. Electronics can be very frustrating at times for both the student and instructor. It can be very difficult to help people at a distance when things don't go quite right.

  • @VaderDarth512
    @VaderDarth512 8 ปีที่แล้ว +1

    thanks! i was confused and all the other videos didn't explain step by step. But you cleared up the confusion and helped me make my first transistor motor!

  • @colinmj.jalbert5436
    @colinmj.jalbert5436 6 ปีที่แล้ว +2

    Thanks man, you really helped me out, by far the best video ive found on this subject

  • @Frank_The_Tank22
    @Frank_The_Tank22 5 ปีที่แล้ว +5

    Great step by step video, you're a time saving badass thanks for the video, cheers!

  • @yoursinger4014
    @yoursinger4014 8 ปีที่แล้ว +4

    Best video in youtube regarding motor control...it was extremely helpful for me! Thanks Dude...Thanks a lot :D

  • @krzysztofkwiecien4245
    @krzysztofkwiecien4245 7 ปีที่แล้ว

    Thank you, I'm starting out with electronics and this was really helpful, I was looking for a PWM motor controller that is easy to build and doesn't require too many components, finally got to understand what a common ground is, very good video.

    • @DorianMcIntire
      @DorianMcIntire  7 ปีที่แล้ว +1

      You are very welcome. Hope you enjoy electronics as much as I do.

  • @djjjozsi
    @djjjozsi 4 ปีที่แล้ว +1

    worked like a charm :) I tried many great tutorials without a success. Thank you very much!

  • @TheBmboone
    @TheBmboone 4 ปีที่แล้ว +2

    "I wonder if I can use a MOSFET and PWM to modulate the speed of a motor" I no longer wonder! What a great video, especially for 2014. Thanks! (The kids I've promised robots to will thank you!)

  • @Reflections2013
    @Reflections2013 7 ปีที่แล้ว +1

    Thanks again Dorian for another great video. I also do allot with spreadsheets, and logic programming with IF statements - The Mosfet is actually starting to sound like a physical IF statement the more I learn about them. Unless you have done any work with spreadsheets or databases, you probably wouldn't know what I mean by saying that, but like I say, the more I learn about Mosfet's, the more they appear to be a big IF statement in a circuit board...
    Source - Gate - Drain or IF - THEN - ELSE. When I think of it that way, the possibilities go on and on, because you could actually use multiple Mosfet's to create (in a since) nested IF statements to create something much more complex (if that made any since at all).
    Steven

  • @j3s0n
    @j3s0n 3 ปีที่แล้ว

    A really well made tutorial! I liked how you explained every step.

  • @eriklaken1025
    @eriklaken1025 5 ปีที่แล้ว +1

    Thank you, and a diode is important but this shows a basic process, very good.Thank you Again.

  • @handang9165
    @handang9165 8 ปีที่แล้ว

    Your video is tremendously helpful. Thank you!

  • @givenfirstnamefamilyfirstn3935
    @givenfirstnamefamilyfirstn3935 3 ปีที่แล้ว

    Your response to comments is wonderful, you are so helpful and generous with your time. Subscribed after my first viewing. Don’t reply!

  • @mirosawh.1600
    @mirosawh.1600 8 ปีที่แล้ว

    It is very nice and simple tutorial. Thanks Dorian.

  • @wellyntongbreton8227
    @wellyntongbreton8227 8 ปีที่แล้ว

    Great!, Dorian........ Thank you man!.... Most of other videos are either too fast, or explained using terms nobody understands.... So I appreciated this one very much. I subscribed to your channel since I think it may help me a lot with my arduino projects. :-)

    • @DorianMcIntire
      @DorianMcIntire  8 ปีที่แล้ว

      Wellyntong Breton You're welcome. Glad you enjoy the videos. Thanks for commenting.

  • @hamilton185
    @hamilton185 7 ปีที่แล้ว

    Genius! You saved my job!

  • @KaelinatorPVP
    @KaelinatorPVP 6 ปีที่แล้ว +1

    Oh my goodness! I actually understood!! Thank you!

  • @dbright038
    @dbright038 6 ปีที่แล้ว +1

    Dorian, this tutorial was amazing. I looked far and wide for someone to explain (step by step) how to use the Arduinio to power a high voltage item (like this). The mosfet was a little tricky to find. Had to drive 30 minutes to find it but it was worth it. Worked like a charm! Thank you. Thank you. You saved a girl's school project invention. If you've gotta PayPal, I will donate to your efforts.

    • @DorianMcIntire
      @DorianMcIntire  6 ปีที่แล้ว

      Always happy to hear stories like this - especially about future engineers and inventors. Thank you for your comment.
      I do have a Paypal account for the channel and every little bit helps. My Paypal id is dorianmc@gmail.com. Thanks.

    • @dbright038
      @dbright038 6 ปีที่แล้ว

      Thanks again. Do you have any demonstrations of lighting up different colored LED lights using an Arduino?

    • @DorianMcIntire
      @DorianMcIntire  6 ปีที่แล้ว

      Check out the following link. arduinostem.blogspot.com/ and click on "Knight Rider (Using Array)"
      This is a blogger site I created for projects that I share. You can use any color LEDs you like to create the "Knight-Rider" effect with the LEDs and you can change the speed by changing the delay numbers. Simply connect the components as shown on the breadboard and copy and paste the code into your Arduino.
      There are many different projects to choose from. Let me know what you think.

    • @DorianMcIntire
      @DorianMcIntire  6 ปีที่แล้ว

      Make sure you use the Chrome browser to avoid any problems with the code copy.

    • @dbright038
      @dbright038 6 ปีที่แล้ว

      Thanks for the link. Here is the project if you're interested.
      th-cam.com/video/gqxlQ_Gl52Q/w-d-xo.html

  • @KarolinasKrafts
    @KarolinasKrafts 8 ปีที่แล้ว +1

    Enjoyed your video!

  • @mikeyz8775
    @mikeyz8775 4 ปีที่แล้ว +1

    Im excited lol... this was perfect.

  • @benjmeistah
    @benjmeistah 4 ปีที่แล้ว +1

    I thank you Sir, all the way from sweden land!

    • @DorianMcIntire
      @DorianMcIntire  4 ปีที่แล้ว +1

      Hej and thanks for commenting

    • @ayushvaidande5579
      @ayushvaidande5579 3 ปีที่แล้ว

      How far it took for your "thank you" to reach this guy's home?

  • @user-yo1pe4xb8y
    @user-yo1pe4xb8y 6 ปีที่แล้ว

    Thank you just solve a big problem in my project

  • @amitkanswal6874
    @amitkanswal6874 7 ปีที่แล้ว +1

    Thank u,This video was very helpful

  • @eastern815
    @eastern815 5 ปีที่แล้ว

    thanks man this video is very great helpful for me.

  • @jfredricks2394
    @jfredricks2394 7 ปีที่แล้ว

    You sound like John Goodman!!!! Long live Monsters Inc!!!! Love your videos!!!

    • @DorianMcIntire
      @DorianMcIntire  7 ปีที่แล้ว

      Thanks on both counts really appreciate your comment.

  • @pedrofer
    @pedrofer 6 ปีที่แล้ว

    thank you for this simple but precise and detail how to setup nmosfet ill using this way to hook a laser in a cnc machine

  • @saavedra358
    @saavedra358 7 ปีที่แล้ว +1

    Very nice, good explanation, is there a way to incorporate time? To have the motor spin for 10 seconds and then shut off?

  • @Miata822
    @Miata822 9 ปีที่แล้ว

    Thanks! Just what I was looking for.

  • @ArcanePath360
    @ArcanePath360 8 ปีที่แล้ว

    Nice video. I have an existing 19v DC motor that is controlled by a trimpot. I'm wondering if I can tether off the control pin of this trimpot and add a MOSFET so I can control the motor with an Arduino, but still use the trimpot in the circuit as a limiter?
    Thanks

  • @keetor13
    @keetor13 9 ปีที่แล้ว

    Great videos. I've been binge watching your stuff. A big help. Thanks for the effort you put forth to make these.

    • @DorianMcIntire
      @DorianMcIntire  9 ปีที่แล้ว +1

      Zachary Keeton Thanks. It's great to know these videos are making a difference. Comments like yours really make it worthwhile.

    • @keetor13
      @keetor13 9 ปีที่แล้ว

      Dorian McIntire Yes a big difference. I had stalled in my electronics self-education until now, thanks to your lessons. The main huge helps from your videos were 1) the electron visualization in the circuit construction kit software (was forever banging my head against understanding how current behaves with a capacitor in parallel. Was using Yenka, but CCK was more helpful here). 2) Interfacing Arduino with larger circuits using MOSFET (opens up a whole new world). 3) Your great explanations/presentation - adding the onscreen arrows, graphics, etc. and 4) Your great demonstration of circuit analyses. THANKS A MILLION... re-invigorated me to whip out the bread boards again.

    • @DorianMcIntire
      @DorianMcIntire  9 ปีที่แล้ว

      Zachary Keeton Great! This kind of feedback really helps me develop new and better ways to deliver material. I really wish more viewers would provide such feedback, positive or negative, to help keep me on track. Thanks.

  • @joro8604
    @joro8604 3 ปีที่แล้ว

    Well done!

  • @medchaouechi842
    @medchaouechi842 6 ปีที่แล้ว

    Well done , nice video

  • @mazdalorean
    @mazdalorean 10 ปีที่แล้ว

    Good stuff. I think my biggest problem with trying to keep up with the video is I don't know what the abbreviations stand for . I don't have too much of a background in electronics , but still try to follow. Thanks for sharing.

    • @DorianMcIntire
      @DorianMcIntire  10 ปีที่แล้ว

      Glad you liked it. I originally made this video as a set of instructions for my students and I didn't do any editing like I usually do.
      I'll insert some annotations to explain some of the terms and ideas in the video for future viewers
      Thanks for commenting..

  • @RTOHIO
    @RTOHIO 7 ปีที่แล้ว

    Great video and much appreciated. Can you use a Mosfet to control a stepper motor, albeit in only one direction?

    • @DorianMcIntire
      @DorianMcIntire  7 ปีที่แล้ว +1

      MOSFETS are frequently used to drive stepper motors but you must create a bipolar driver to drive a bipolar stepper motor. For a bipolar motor you would need two sets of MOSFETS per phase (a set would be one P-Channel and one N-Channel) for a total of eight MOSFETS . To drive a Unipolar stepper motor you would need 4 MOSFETS.

  • @yengamatic
    @yengamatic 8 ปีที่แล้ว

    Hi and thanks for your illustrative videos. I watched this one and the "Power MOSFET Motor ontrol with Arduino" one. I am more a software engineer, although I have some electronics understanding. I plan to control a water pump, rated at 3-6v (sorry, no idea of the current it uses until I receive the pump), by means of an esp8266 (3.3v). I have watched many videos and I have two kind of doubts:
    1) What kind of MOSFET should I be using? I see lots of them, with lots of numbers... I don't want to buy a 2-chanel motor driver, as I consider a waste of money given that I don't have to control the speed, although I would be a nice feature to have.
    2) In many videos/schematics I've seen, there is usually a diode in the motor, also a resistor between the gate and GND, and sometimes a capacitor somewhere else. Why is your setup lacking those, or why do other people have them?
    Thanks and keep up the good work!

    • @DorianMcIntire
      @DorianMcIntire  8 ปีที่แล้ว +1

      +Green Magic To select a MOSFET can simply do a search on Ebay or Amazon for MOSFET and select a MOSFET with a current rating and voltage rating around twice what your device needs. A BUZ111S or IRF2807 is a good choice if your voltage is less than 50 volts.
      A low resistance resistor can help keep the Gate inrush currents low but is not necessary if a high current GATE driver is used. Too high a resistance will slow the MOSFET switching speed down and could cause overheating of the device.
      The need for Snubber Capacitors or Diodes (Google the term for more information) depends on the application. These devices prevent potential voltage spikes, from inductive loads such as motors, from possibly destroying the MOSFET.
      Good luck

  • @TCPPERFORMANCE1
    @TCPPERFORMANCE1 7 ปีที่แล้ว

    Dorian, thanks for the video and others you have done! Great job of explaining! I am wanting to program an ATMEGA328 on an Arduino uno then move the chip to a bread board or proto type board using the pwm functions. Is this possible? And if so is it something you would be interested in doing a video tutorial on it? Thanks again for your great videos!

    • @DorianMcIntire
      @DorianMcIntire  7 ปีที่แล้ว

      Yes, you can move the chip to a breadboard but you will need the following:
      1 bootable chip (or burn your own bootloader per the video link)
      www.amazon.com/gp/product/B00P5IRS9I/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1
      (1) 16 Mhz crystal
      www.amazon.com/16-000MHz-AT49S-Quartz-Crystal-Oscillator/dp/B005MN8FPW/ref=pd_bxgy_147_img_2?_encoding=UTF8&psc=1&refRID=98RKY5HX65KRXV06FH3B
      (2) 22 pf capacitors
      www.amazon.com/uxcell-22pF-Voltage-Ceramic-Capacitors/dp/B0087ZBK4K/ref=pd_bxgy_328_img_3?_encoding=UTF8&psc=1&refRID=V4AJGW8H9JAFZYGTH7H7
      The following video shows how to hook up the components to the chip and burn your own bootloader using another Arduino. Once this done the chip can stand alone. BEWARE you must add a 5 volt regulator to power the chip if you want it to stand alone.
      th-cam.com/video/g90xb0nNX50/w-d-xo.html
      I may make my own video eventually with more explanation about the process.
      Dorian

  • @vikkalkat4523
    @vikkalkat4523 6 ปีที่แล้ว

    Hey, thanks for sharing!
    I am wondering about the efficiency of using a mosfet. When no voltage is applied to the gate, there exists an infinite resistance between the source and drain, right? So, doesn't this mean that all of the power in the "second" circuit must be dissipated as heat? That is, 100% inefficiency? If we wish to have a slow motor speed, we would apply a small voltage to gate, and then does the rest of the power always get dissipated as heat? If we use a PWM signal to the gate, does this solve this issue?

    • @DorianMcIntire
      @DorianMcIntire  6 ปีที่แล้ว

      When a device is off and exhibits infinite resistance no current can flow so the device uses no energy. Conditions necessary for a device to use power is that both voltage across the device and current through the device must be present at the same time. The mosfet uses no power when it is off and uses very little power when it is fully on since it has current but very little voltage across it.

  • @junding5948
    @junding5948 5 ปีที่แล้ว +2

    Never write code completely from scatch! I strongly agree with your opinion
    Not only for coding,the same with designing electrical drawings & mechenical drawings
    Cause we are applying the technolodgy,neither reserching nor establishing general Rules

  • @NoSkillsRequired
    @NoSkillsRequired 8 ปีที่แล้ว

    interesting video thanks

  • @kayaonur5657
    @kayaonur5657 3 ปีที่แล้ว

    I think you can also use the analogue signal and change gate-to-source voltage of the mosfet thus control the current

    • @DorianMcIntire
      @DorianMcIntire  3 ปีที่แล้ว

      Arduino Uno analog outputs actually only provide a PWM signal and cannot provide a true analog output. Additionally PWM is the most efficient way drive a motor since the MOSFET is either on or off. In a perfect situation the MOSFET would not dissipate any power itself and would only provide variable power to the motor.

  • @syahrul9282
    @syahrul9282 5 ปีที่แล้ว

    Thanks so much... was actually need to connect both ground to the same arduino ground... btw i was using one power source... but it seems like there were a problem... when i power up the motor the arduino was fading out... so thats why ur using two sources

    • @DorianMcIntire
      @DorianMcIntire  5 ปีที่แล้ว

      Yes the Arduino is incapable of running any loads that require more than about 20 ma so a separate power supply is needed. It also provide a level of protection to prevent voltage spikes from entering the Arduino.

  • @DorianMcIntire
    @DorianMcIntire  9 ปีที่แล้ว

    +Mohit Bhasi Sorry to hear that. What MOSFET did you use?

    • @benmerrick9077
      @benmerrick9077 8 ปีที่แล้ว

      Dorian McIntire Would this MOSFET work? Mosfet transistors [IRF520]

    • @benmerrick9077
      @benmerrick9077 8 ปีที่แล้ว

      Dorian McIntire Im also using a 6/9 volt dc motor

    • @SaureHefePegorino
      @SaureHefePegorino 8 ปีที่แล้ว

      +Ben Merrick any LOGIC LEVEL mosfet will work, just look at maximum voltage and current the mosfet can take.

  • @benmerrick9077
    @benmerrick9077 8 ปีที่แล้ว

    Would this transistor work too?? Mosfet transistors [IRF520]

  • @rcalihan3877
    @rcalihan3877 9 ปีที่แล้ว

    Thank you very much

    • @DorianMcIntire
      @DorianMcIntire  9 ปีที่แล้ว

      Rc Alihan You're welcome. Thanks for watching and commenting.

  • @tamgaming9861
    @tamgaming9861 6 ปีที่แล้ว

    Thanks a lot for the tutorial - if i want to regulate the speed with an Touchdisplay - HMI - how would i have to think to realise it? So that the Arduino changes the numbers and sends it to the PWM?

    • @DorianMcIntire
      @DorianMcIntire  6 ปีที่แล้ว

      Setup a slider control on the screen set up to generates a number from 0 to 255. Store the number in a variable used in the PWM command.
      For instance:
      slider control variable stored in motorSpeed variable
      use to control speed of motor:
      analogWrite(9, motorSpeed)

    • @tamgaming9861
      @tamgaming9861 6 ปีที่แล้ว

      Thanks a lot for your answer - that helps to get an understanding what i have to looking for on tutorials - thanks !!!

  • @garymaya1767
    @garymaya1767 4 ปีที่แล้ว

    You need a diode across the motor to take car of the back emf. You can map the pwm and adc.

    • @DorianMcIntire
      @DorianMcIntire  4 ปีที่แล้ว

      I'm very familiar with inductor back EMF but a flyback diode has never been necessary for any DC motor circuits I've controlled and sometimes modifies the behavior of the motor in a negative way. A diode is necessary and recommended mainly when driving relays or other pure inductor devices.

  • @Thrive-Off-Grid
    @Thrive-Off-Grid 5 ปีที่แล้ว

    Trying to wrap my head around your wiring. Aren't you pulsing the ground circuit of the motor? Am I understanding this correctly?

    • @DorianMcIntire
      @DorianMcIntire  5 ปีที่แล้ว +2

      Yes, we call this a sinking connection to a load. This is the easiest way to interface to a MOSFET. Using this method we create a common ground connection and can control current from one voltage source (Arduino) using a different voltage source (motor).

  • @youssefrezk6782
    @youssefrezk6782 8 ปีที่แล้ว

    Is there a way to hook it up so different outputs control the motor in different directions clockwise and counterclockwise, like if it sees output 3 high rotate clockwise, if output 5 is high rotate counter clockwise

    • @DorianMcIntire
      @DorianMcIntire  8 ปีที่แล้ว

      +Youssef Rezk Not really. You'll need an H-bridge to drive the motor is both forward and reverse. Very small loads can be driven with one polarity or another by using two outputs and making one output high while the other is low and vice versa.

  • @parthrupareliya625
    @parthrupareliya625 5 ปีที่แล้ว

    This is good video, But i have one question that if i want to reverse a DC motor with this method this can't be done because transistor can only run the motor.

    • @DorianMcIntire
      @DorianMcIntire  5 ปีที่แล้ว +1

      Yes, you cannot rung the motor is reverse direction without an H-Bridge drive.

  • @CuddleStories
    @CuddleStories 4 ปีที่แล้ว

    Instead of the battery, couldn't you have some capacitors in series to create higher voltage? Then the transistor would amplify the current to the motor too. This way you could avoid an external power source.

  • @sunnyshrestha317
    @sunnyshrestha317 3 ปีที่แล้ว

    can u change the direction of the motor with this setup and these components ?

    • @DorianMcIntire
      @DorianMcIntire  3 ปีที่แล้ว +1

      No. Please see my answers to similar questions in the comments.

  • @charlesklein7232
    @charlesklein7232 4 ปีที่แล้ว

    im trying to buy your mosfet but finding it possably difficult to do. i am uneducated and so lack the knowledge to understand. you say it a mosfet 2n7000. however, on your cheat its actually a 2n7000-g does the "g" make a difference? what is its significance? i have found mosfet that are labeled with a "g" but most are labeled: "2N7000 TO92 Small Signal MOSFET 200 mAmps, 60 Volts N-Channel TO-92"

    • @DorianMcIntire
      @DorianMcIntire  4 ปีที่แล้ว

      Any 2N7000 will do. The letters do typically refer to a non-electronic feature. The 2N7000 is a very popular, small signal MOSFET. They are readily available on Amazon and electronic suppliers. I buy them by the hundred at Amazon.

  • @oxxomarin
    @oxxomarin 8 ปีที่แล้ว

    Great vid and very helpful.
    Do you know for how long the motor can be used non-stop from 9V battery (at lowest speed 80)? Can you suggest please what else can help make the motor run non-stop?
    Thank you

    • @DorianMcIntire
      @DorianMcIntire  8 ปีที่แล้ว

      +oxxomarin It really depends on many factors. For instance how big is the motor, is it under load and how much load is it under. Obviously If you use a wall transformer, instead of a battery, and plug it into an outlet you can run it non-stop. The question is a little confusing because I'm not sure what you really need to accomplish.
      Thanks for commenting.

    • @oxxomarin
      @oxxomarin 8 ปีที่แล้ว

      +Dorian McIntire Thank you for your reply. The idea is to create a rotating display stand for collectible items using Arduino board. The weight on it will be no more than 100g. Since it's a personal project, it would be nice if the motor could run throughout the day (maybe non-stop is not necessarily at this moment).

    • @DorianMcIntire
      @DorianMcIntire  8 ปีที่แล้ว +1

      +oxxomarin If everything is lightweight and well balanced you could probably run it for a day or two. Adding some power management hardware and software would help it work even longer. For instance a photocell could be added to allow it to run only when the room was darker or an PIR (Passive Infra Red) sensor could be added to allow it to run only when a person was in the room. Other things to consider are using (6) C or D cell batteries configured for 9 volts. These will allow it to run many many time longer. Wall transformers are a very cheap and easy solution and you might be able to recycle such a transformer since most people have dozens tying around from devices they bought over the year. Good Luck.

    • @oxxomarin
      @oxxomarin 8 ปีที่แล้ว

      +Dorian McIntire Thank you for the suggestions. Much appreciated

  • @shan_singh
    @shan_singh 4 ปีที่แล้ว +1

    i want to control speed of motor(without gears) to use in my project, how can i do it? also, doesnt connecting motor to arduino without motor driver, will damage the pins which are meant only for low current values??

    • @DorianMcIntire
      @DorianMcIntire  4 ปีที่แล้ว +3

      You control the speed, with no directional control which would require an H-Bridge, by doing exactly what I did in the video. The MOSFET transistor I used in the video allows the motor to be driven without drawing excessive current from the Arduino.

  • @mustaqdj
    @mustaqdj 8 ปีที่แล้ว +2

    what was the use of the mosfet ? the pwm voltage controls the speed right ?

    • @DorianMcIntire
      @DorianMcIntire  8 ปีที่แล้ว

      +mustaq rookie To control the speed of the motor up and down. The PWM pulse width controls the speed.

    • @alfonsocanales7210
      @alfonsocanales7210 7 ปีที่แล้ว

      I'm wondering the samething, I know you are controlling with PWM signal, but for what I know the Mosfet can receive analog signals to Gate to control the output voltage. am I wrong?

    • @quintindudragne3359
      @quintindudragne3359 5 ปีที่แล้ว

      The most important part for the mosfet transistor is to allow a small amount of current to control a higher amperage circuit. If you were to try and run the motor directly off the arduino you would damage the circuit board.

  • @ahnafrafid6260
    @ahnafrafid6260 8 ปีที่แล้ว

    what is the model no. of your mosfet??

  • @dhidhi1000
    @dhidhi1000 4 ปีที่แล้ว

    are you sure this is PWM modulation? judging by your code at 9:10, it seems you just put a constant voltage value at pin 3, and hence the MOSFET is working on that constant voltage, but not actually switching on and off multiple times every second (there is not even a frequency defined anywhere)

    • @DorianMcIntire
      @DorianMcIntire  4 ปีที่แล้ว +3

      If you paid attention to the video you'll notice I started with the 'Blink' example to save typing all the code from scratch. The setup 'Blink' code is relevant to set pin 3 (A pwm pin) as an output. The loop 'Blink' code was replaced with the analogWrite code. analogWrite() actually creates a PWM signal not a true analog signal. The statement analogWrite(3, 255) statement produces the equivalent of a 5 volt signal (100% duty cycle) on pin 3. A analogWrite(3, 128) statement produces a 50% duty cycle. As I mentioned Arduinos Unos do not produce a true analog output signal they simulate analog output using PWM with a range of 0 to 255.
      BTW I did not remove the comments in the 'Blink' example which may have cause some confusion but the video content explained the process.

    • @dhidhi1000
      @dhidhi1000 4 ปีที่แล้ว

      @@DorianMcIntire I didn't know that, thank you for explaining! I see from the documentation that is generates PWM signals at 490 Hz.
      www.arduino.cc/reference/en/language/functions/analog-io/analogwrite/

    • @DorianMcIntire
      @DorianMcIntire  4 ปีที่แล้ว +2

      @@dhidhi1000 I guess I could have gone deeper into the explanation but the video would have been more than twice as long. I plan to cover many more Arduino videos in the future as a resource for my students. Glad you already found the Arduino reference which is very helpful when working with the device.

  • @piegp94
    @piegp94 5 ปีที่แล้ว

    Hi, does the circuit works if i change the frecuency above 60 KHz?

    • @DorianMcIntire
      @DorianMcIntire  5 ปีที่แล้ว

      The default frequency for the Arduino is 490 Hz. Although you can raise it by manipulating the settings for the processor you cannot change it to 10 Khz. When PWM frequencies are too high the motor inductance becomes a big problem.

  • @CuddleStories
    @CuddleStories 5 ปีที่แล้ว

    Does this circuit amplify the current?

    • @DorianMcIntire
      @DorianMcIntire  5 ปีที่แล้ว +1

      The transistor amplifies the current produced by the Arduino output pin.

  • @djjjozsi
    @djjjozsi 4 ปีที่แล้ว

    Could you please suggest a way to make 5V DC outputs from a 24 V DC power supply ? I see only horrible tutorials on YT. Thank you.

    • @DorianMcIntire
      @DorianMcIntire  4 ปีที่แล้ว +1

      It really depends on how much current you need for your application. If you need 1 amp, for instance, and try to use a 7805 regulator IC in linear mode, the IC would need to dissipate 95 watts of power which would destroy the IC! You really need to use a switching regulator for high currents and such regulators can be fairly complicated. Unless you just really want to build something, instead of buy, I would recommend a pre-built switching regulator such as the one available at the following link: www.ebay.com/itm/3-CUI-Inc-V-infinity-Switch-Mode-Switching-Regulator-7805-DC-DC-Buck-Converter-/263591638141. Three of these for $12.95 is a very good deal.

    • @djjjozsi
      @djjjozsi 4 ปีที่แล้ว

      @@DorianMcIntire Thank you Dorian, helped a lot. I will try this soon. 😀😀

  • @untitledusername3799
    @untitledusername3799 6 ปีที่แล้ว

    jesus christ thank you so much
    i finally understand how to use a mosfet

  • @zedd81
    @zedd81 6 ปีที่แล้ว

    Is it possible to use the same 9v battery to power the arduino?

    • @DorianMcIntire
      @DorianMcIntire  6 ปีที่แล้ว

      Only if the 9v positive is connected to Vin NOT 5V. The negative lead is connected to GND

  • @swedensy
    @swedensy 5 ปีที่แล้ว

    I recreated this with pwm generator module.
    Question is why mosfet disipates sooo much heat even if output power is at its lowest.

    • @DorianMcIntire
      @DorianMcIntire  5 ปีที่แล้ว

      You may have selected a MOSFET with a high Gate threshold voltage and cannot turn it fully on.

  • @mohit4164
    @mohit4164 9 ปีที่แล้ว

    Hey , my circuit always seems to be always complete Dorian McIntire .The mosfet doesnt seem to be acting like a switch. please help ASAP can we have a video chat or something? pls pls it is for my school project . I need to submit it in a few days

    • @DorianMcIntire
      @DorianMcIntire  9 ปีที่แล้ว

      Can you send me a picture of the setup?
      Thanks.

  • @swetha0998
    @swetha0998 4 ปีที่แล้ว

    Im going to control speed and direction of a dc series motor to drive a conveyor belt in my project...how much rpm And power is required for the motor..on what specifications should i buy a motor..plse tell me☹️

    • @DorianMcIntire
      @DorianMcIntire  4 ปีที่แล้ว

      There are too many variables to consider without know more about your needs. Also you must use an H-Bridge motor to make the motor move in reverse.

  • @Monyet96lookout1
    @Monyet96lookout1 6 ปีที่แล้ว

    Does this work if i were to change the motor to a Water Pumping Electric Micro Pump Motor?

    • @DorianMcIntire
      @DorianMcIntire  6 ปีที่แล้ว

      Any small motor will work fine as long it does not draw more than an amp of current.

  • @SilverMiraii
    @SilverMiraii 7 ปีที่แล้ว

    You could do the same with a battery a potentiometer and the motor alone, increasing resistance decreases voltage drop on the motor, led or anything for that matter, but in the case of an led, you still need a resistance such that you don't destroy the led

    • @DorianMcIntire
      @DorianMcIntire  7 ปีที่แล้ว +1

      You cannot do this with a standard potentiometer and a motor without burning out the potentiometer and wasting power. This is a common misconception for new students leaning about electricity and electronics.
      PWM is a very efficient way to control power since the signal is either OFF or ON and not in-between. Controlling power to high-power loads with resistors or potentiometers is a very inefficient way to control power since much of the power is converted to heat in these devices. This is why most high power amplifiers today use PWM to control power to speakers.

    • @SilverMiraii
      @SilverMiraii 7 ปีที่แล้ว +1

      Dorian McIntire I don't get why you burn out the potentiometer, it's just a band of restive material and a knob to set the distance on that material. But in any case, in theory resistance = loss of power. since p=i*v and v=i*r then p=I*r^2, so the higher the resistance, the higher the power.
      And you're right, while I passed all the tests in school, I still feel like a novice who needs lots more learning.
      PWM does make sense tho, you don't need extra resistance, you obtain an average voltage through frequency control, it's just on and off as you said, you get the same result in voltage as an actual equivalent resistor.
      Quick question, I know you could do PWM with arduino for example, but that's just too much, is there such as a smaller device to get the same result ?

    • @DorianMcIntire
      @DorianMcIntire  7 ปีที่แล้ว +1

      You can do PWM with a 555 timer. See the following link for details.
      www.555-timer-circuits.com/motor-pwm.html
      This would require only a few dollars in materials.
      Have fun.

    • @SilverMiraii
      @SilverMiraii 7 ปีที่แล้ว

      Dorian McIntire Thank you

    • @DorianMcIntire
      @DorianMcIntire  7 ปีที่แล้ว

      You're Welcome. Thanks for commenting.

  • @p0intblank597
    @p0intblank597 6 ปีที่แล้ว

    thanks you helped me make my obstace avoding robo

    • @DorianMcIntire
      @DorianMcIntire  6 ปีที่แล้ว

      Great! Happy I was able to help.

  • @kaspariito
    @kaspariito 4 ปีที่แล้ว

    thats a nice one. thank you for the tutorial! :))

  • @donskanone
    @donskanone 7 ปีที่แล้ว

    Cool video! But shouldn't you also use a flyback diode?

    • @DorianMcIntire
      @DorianMcIntire  7 ปีที่แล้ว +1

      A separate fly-back diode is not necessary since it is built into the MOSFET. Most power MOSFETs, these days, have built-in diodes. The fly-back diode in the MOSFET serves the same purpose except the fly-back path is through the power supply instead of just across the motor.

    • @vladan_kovacevic
      @vladan_kovacevic 7 ปีที่แล้ว

      +Dorian McIntire
      How does that actually work? When Mosfet turns of, drain voltage goes high, while source is constantly at ground, therefore diode across Mosfet never conducts? On the other hand, if H-bridge was built using Mosfets with built in diodes then it makes sense.

    • @DorianMcIntire
      @DorianMcIntire  7 ปีที่แล้ว +1

      Although the body diode in a MOSFET is used for commutation in H-Bridges it also has the properties of a zener diode and breaks down under brief high voltages. I have never experienced a MOSFET breakdown with a built-in body diode - in fact I've never experienced it with any MOSFET. Newer MOSFETs, can tolerate the voltage spikes generated when switching small DC motors. Viewers commonly recommend freewheeling diodes (its almost epidemic) for PWM but with a body diode MOSFET it is totally unnecessary.
      The goal of the video was to show an application of PWM and I really didn't want to complicate things with a discussion about fly back diodes.

  • @jumbo999614
    @jumbo999614 4 ปีที่แล้ว

    I have only 2N7000 (without G). Can i use it?

    • @DorianMcIntire
      @DorianMcIntire  4 ปีที่แล้ว +1

      Any 2N7000 will work fine. The current limit for a 2N7000 is only about 0.2 amp so you will not be able to run a large motor.

  • @santoshvardhan1327
    @santoshvardhan1327 4 ปีที่แล้ว

    We tried in three varient speeds with one switch. I mean we are changing pwm pulse high, medium and low using switch. If we press one time motor is in high speed if press one more time motor will run medium and if we press the button one more time motor will run in low speed. But Mosfet is heating in low and medium speeds. Why❓. Please explain.

    • @DorianMcIntire
      @DorianMcIntire  4 ปีที่แล้ว

      Suggest you check the MOSFETs specification and make sure the Gate-Threshold Voltage (Vgs) is low enough to fully drive the MOSFET on with only 5 volts (e.g. Logic Level MOSFET). A MOSFET threshold voltage of 3 volts or less should work well. Make sure the gate capacitance of the MOSFET is also low to minimize the turn-on time. The shorter the MOSFET remains in linear mode the better. Not every power MOSFET can be driven straight from an Arduino due to the gate drive current limitation of the Arduino. You can purchase MOSFET driver chips to help with this problem.

  • @hiennghiem1588
    @hiennghiem1588 7 ปีที่แล้ว

    Hi thanh you

  • @cryptedcoder5669
    @cryptedcoder5669 4 ปีที่แล้ว

    I'm having trouble, I have wired it all correctly and copied your code. But when I change the value let's say from 255 to 80 the speed does not change no mater what number I put

    • @DorianMcIntire
      @DorianMcIntire  4 ปีที่แล้ว

      Sounds like you might have a shorted transistor. Also if the motor is not loaded the circuit does require a very low number to slow the motor down.

    • @cryptedcoder5669
      @cryptedcoder5669 4 ปีที่แล้ว

      @@DorianMcIntire ye I figured it out thank you so much. I plugged the wrong wire to negative on the battery and vice versa

  • @alfonsocanales7210
    @alfonsocanales7210 7 ปีที่แล้ว

    so, If I send 5 volts to the gate am I going to have maximum speed possible? I can't give 12 volts? I'm kinda confused

    • @DorianMcIntire
      @DorianMcIntire  7 ปีที่แล้ว

      PWM control has nothing to do with gate drive voltage although you must exceed the threshold voltage of the MOSFET. PWM is about controller duty cycle or time on versus time off.

    • @oguzhan2393
      @oguzhan2393 7 ปีที่แล้ว +1

      can't he gives 5v voltage to the dc motor? I wanna give 2.5 amper and 1.2 voltage to heat a spring same thing to to dc motor. Does it work?

  • @Mehecanogeesir
    @Mehecanogeesir 8 ปีที่แล้ว

    doesn't a mosfet require a resistor between gate and source?

    • @DorianMcIntire
      @DorianMcIntire  8 ปีที่แล้ว

      +Mehecanogeesir No. As long as the input signal voltage is transitioning between high and low the gate voltage will go between high and low. Pull-down resistors for MOSFET gates are only needed if the signal can only source the gate instead of sink and source the gate like an Arduino output can.

  • @nikhilmurarka1070
    @nikhilmurarka1070 6 ปีที่แล้ว

    what is the command to vary duty cycle automatically?

    • @DorianMcIntire
      @DorianMcIntire  6 ปีที่แล้ว

      I'm not sure what you what to know. The code is shown and explained in the video at 6:51.

  • @YaswanthKumar8888
    @YaswanthKumar8888 5 ปีที่แล้ว

    Hi, can we do the same functioning using a relay instead of mosfet please explain...

    • @DorianMcIntire
      @DorianMcIntire  5 ปีที่แล้ว

      You can only turn the motor on and off using a relay. You cannot control the speed.

    • @YaswanthKumar8888
      @YaswanthKumar8888 5 ปีที่แล้ว

      @@DorianMcIntire thank you for the clarification

  • @jarhead2159
    @jarhead2159 9 ปีที่แล้ว

    Ok please help quickly, I have a circuit set up this exact way, same 9v battery, a 12v motor, an IRLB3034PBF mosfet, and a simple code using digital signals that turns it on for three seconds and turns it off for three seconds and loops that. However, when I hook it up, the motor turns full speed for three seconds, then just lowers to a little bit slower speed for three seconds. Is there any reason why thats happening? Please respond asap as I am using it for a physics project!

    • @DorianMcIntire
      @DorianMcIntire  9 ปีที่แล้ว

      JarHead21 Which code are you using to control the motor? Are you using the blink command to turn the motor on and off? Did you declare the output pin as an output? Have you looked at the following video:
      th-cam.com/video/Lzxuro0Z2Ew/w-d-xo.html
      The code in the linked video makes the motor move faster and then slower?

    • @jarhead2159
      @jarhead2159 9 ปีที่แล้ว

      Dorian McIntire This is my code:
      int switchpin = 9;
      void setup() {
      // put your setup code here, to run once:
      pinMode(switchpin, OUTPUT);
      digitalWrite(switchpin, LOW);
      }
      void loop() {
      // put your main code here, to run repeatedly:
      digitalWrite(switchpin, LOW);
      delay(3000);
      digitalWrite(switchpin, HIGH);
      delay(3000);
      }
      I've watched the video you included several times as well, setting it up the same way, getting the exact same results.

    • @DorianMcIntire
      @DorianMcIntire  9 ปีที่แล้ว

      JarHead21 The MOSFET you're using is actually an electrical monster. One potential problem with this MOSFET is that the input capacitance is huge. Try increasing the first delay to 8000 (8 seconds) and leave the second delay time at 3000 (3 seconds). If the MOSFET actually turns off or slows down much more then the Arduino is probably having a problem sinking the gate current needed to turn off the MOSFET. Try using a lower current MOSFET (around 10 Amps) to see if this solves the problem.

    • @DorianMcIntire
      @DorianMcIntire  9 ปีที่แล้ว

      Dorian McIntire Also see if you can turn the MOSFET ON and OFF by touching the gate wire Ground , to turn it off and then +9V to turn it back on. If this works then the output pin is probably having trouble with the MOSFET specifications.

    • @DorianMcIntire
      @DorianMcIntire  9 ปีที่แล้ว

      Dorian McIntire One more thing to try is hooking the MOSFET to another output pin but make sure you change the code.

  • @jaycool5978
    @jaycool5978 5 ปีที่แล้ว

    Nice but what about direction control?

    • @DorianMcIntire
      @DorianMcIntire  5 ปีที่แล้ว

      Direction control requires an H-Bridge.

  • @deepankarkanand4668
    @deepankarkanand4668 7 ปีที่แล้ว

    The explaination is awesome , but circuit and code are pretty much small for a smartphone viewer (everybody can't have a pc or laptop).Rest every thing is cool!!

  • @ThunderWindz
    @ThunderWindz 6 ปีที่แล้ว

    so a mosfert is just a mini relay ?

    • @DorianMcIntire
      @DorianMcIntire  6 ปีที่แล้ว

      A MOSFET can act like a relay - among other things - but with no moving parts, very little energy required to operate it and the ability to switch in nanoseconds.

  • @lastbench6884
    @lastbench6884 5 ปีที่แล้ว

    Sir when I connect source to gnd motor stops any solution

    • @DorianMcIntire
      @DorianMcIntire  5 ปีที่แล้ว +2

      I don't know what to tell you if I can't see what you've done. As I often must tell my students - things do not not work properly when they not connected properly. Make sure your connections are correct, make sure you have the proper pin-out information for your MOSFET, make sure you are using a MOSFET and not a BJT, make sure your motor does not draw more current than the MOSFET can handle, make sure your motor does not draw more current than your power supply can provide, etc.

  • @kingjames-fn8ib
    @kingjames-fn8ib 5 ปีที่แล้ว

    thanks. but i think its dangerous to make ground common to power source ,especially if using much more powerful motors and power source

    • @DorianMcIntire
      @DorianMcIntire  5 ปีที่แล้ว

      It's the only way to drive a transistor and motor it is also a common practice for systems using small motors and loads. Larger, high voltage motors are typically driven using an Optical Isolator. However Optical Isolators are relatively slow devices when using PWM.

  • @MarkMaslowPoet
    @MarkMaslowPoet 8 ปีที่แล้ว

    aren't most small voltage 2 wire electrical motors capable of rotating in both directions? Do you have an example of where you can use an arduino to control a motor in both directions? The project I have in mind would require to turn the motor n turns clockwise, hold it for m seconds (hours?) and then turn the motor n turns counter-clockwise.

    • @DorianMcIntire
      @DorianMcIntire  8 ปีที่แล้ว +2

      +Mark Maslow All DC motors can be reversed by reversing the polarity to the motor. Reversing the polarity to a motor using a controller however is not a simple thing and requires 4 switches in a configuration called an H-Bridge.

  • @akhilalle5573
    @akhilalle5573 6 ปีที่แล้ว

    Sir i can use for dc motor ratings 24v 12A 250w.plz clear my doubt

    • @DorianMcIntire
      @DorianMcIntire  6 ปีที่แล้ว

      You may have trouble finding a MOSFET with the Transconductance rating you will need and low Gate threshold rating (logic level, a few volts below 5 volts) for such a large amount of drain current. If you find such a MOSFET make sure you install a free-wheeling diode between the motor terminals. Google the term "freewheeling diode" for more details.

    • @akhilalle5573
      @akhilalle5573 6 ปีที่แล้ว

      Thank you sir,12a is the rated current of the motor,our project is on automatic wheel chair so we required constant low speed but high torque. so how we can do this in simple way.plz suggest any idea

    • @DorianMcIntire
      @DorianMcIntire  6 ปีที่แล้ว

      All I can do is refer you to some online resources for high-current motor control. My video was primarily about basic motor control using PWM and the Arduino. Quite a bit of work is required to create a high current motor driver and I would use a pre-fabricated H-Bridge for such a task. Below are some references.
      www.mouser.com/applications/industrial-motor-control-mosfets/
      chrome-extension://oemmndcbldboiebfnladdacbdfmadadm/ww1.microchip.com/downloads/en/DeviceDoc/00000896M.pdf

    • @akhilalle5573
      @akhilalle5573 6 ปีที่แล้ว

      Dorian McIntire thank you sir

  • @supernova6553
    @supernova6553 4 ปีที่แล้ว

    how would you do bi-directional movement?

    • @DorianMcIntire
      @DorianMcIntire  4 ปีที่แล้ว

      You can't do it with a single transistor, look up the term 'H-Bridge' for more information.

    • @supernova6553
      @supernova6553 4 ปีที่แล้ว

      @@DorianMcIntire Yes I know. How do battery powered drills change direction? Also an h-bridge?

    • @DorianMcIntire
      @DorianMcIntire  4 ปีที่แล้ว

      Yes. H-Bridges are readily available in many compact packages and can handle a considerable amount of current.

  • @almirbajsini
    @almirbajsini 5 ปีที่แล้ว

    Can i use IRFZ44N

    • @DorianMcIntire
      @DorianMcIntire  5 ปีที่แล้ว

      Yes, most any power, N-Channel MOSFET will work.

  • @abdullahakhtar9864
    @abdullahakhtar9864 7 ปีที่แล้ว

    si can i use B0343 mosfet

    • @DorianMcIntire
      @DorianMcIntire  7 ปีที่แล้ว

      I'm not sure. I can't find any data on such a MOSFET.

  •  6 ปีที่แล้ว

    What maximum voltage and amperage am i able to control with arduino pwm ?

    • @DorianMcIntire
      @DorianMcIntire  6 ปีที่แล้ว +1

      5V and 50ma without a transistor. With the right transistor - no limit.

    •  6 ปีที่แล้ว

      I wanted to connect the Peltier 12706 12v 60 watts 3 amp and control voltage with arduino so I can connect for example with mosfet LRF 530 or IRFZ44 N for example, or a more powerful transistor

    • @DorianMcIntire
      @DorianMcIntire  6 ปีที่แล้ว +1

      The IRFZ44 should be fine with plenty of overhead.

    •  6 ปีที่แล้ว +1

      Dorian McIntire thank you🙋

  • @virajpadwal884
    @virajpadwal884 6 ปีที่แล้ว

    how to change the direction of motor ?

    • @DorianMcIntire
      @DorianMcIntire  6 ปีที่แล้ว

      You can't change the direction with this setup. You must use an H-Bridge which uses 4 transistors to switch the motor polarity. It far better to buy an H-Bridge than build one.

  • @AlwinThomasz2p
    @AlwinThomasz2p 7 ปีที่แล้ว

    Could you please tell me how to generate 20khz pwm signal using Arduino (code), I wanna control MOSFET in my buck converter

    • @DorianMcIntire
      @DorianMcIntire  7 ปีที่แล้ว

      To do this you must change the PWM frequency register division ratio but this is not a trivial thing to do. The division depends on the type of Arduino. Are you using an Uno?

    • @AlwinThomasz2p
      @AlwinThomasz2p 7 ปีที่แล้ว

      Arduino UNO

    • @DorianMcIntire
      @DorianMcIntire  7 ปีที่แล้ว

      It can be done with bit-banging but I recommend the PWM library mentioned in the link below:
      forum.arduino.cc/index.php?topic=117425.0
      github.com/jurs/arduino-pwm-frequency-library
      Keep in mind that if you change the PWM frequency some of the timing functions on the Arduino such as Millis() and Micro() may not work properly.

  • @abdullahakhtar9864
    @abdullahakhtar9864 7 ปีที่แล้ว

    my motor starts running before i connect arduino to computer..arduino also on with battery.it can cause arduino to burn..please suggest the solution

    • @DorianMcIntire
      @DorianMcIntire  7 ปีที่แล้ว

      Make sure the mosfet is an N-Channel mosfet and is not an enhancement-mode mosfet. Check to see if a 1K pulldown resistor on the gate solves the problem.

    • @DorianMcIntire
      @DorianMcIntire  7 ปีที่แล้ว

      Correction IS an enhancement-mode mosfet.

    • @abdullahakhtar9864
      @abdullahakhtar9864 7 ปีที่แล้ว

      THANK YOU

  • @mohit4164
    @mohit4164 9 ปีที่แล้ว

    Well I guess. Used a wrong mosfet and blew up my arduino :(

  • @troudikhaled8640
    @troudikhaled8640 8 ปีที่แล้ว

    i need your help,i want the code, please?

    • @DorianMcIntire
      @DorianMcIntire  8 ปีที่แล้ว

      +troudi khaled The code is displayed in the video. It is simply a modified version of the Blink program in the Arduino example programs.

  • @hammadkhan2004
    @hammadkhan2004 3 ปีที่แล้ว

    Programming code?

    • @DorianMcIntire
      @DorianMcIntire  3 ปีที่แล้ว

      Look at the video at the following address: th-cam.com/video/T9Zpir5hidw/w-d-xo.html. As I mentioned in the video the code is a variation of Blink.

  • @charlesklein7232
    @charlesklein7232 4 ปีที่แล้ว

    THE "G" MEANS ITS A -GREEN- "ROHS" LEAD FREE! CONSEQUENTLY IT HAS NO! MEANING! zoomed in using 65 inch 4k and read the paper. otherwise i would have tracked down the paper. apology's!

  • @potbot887
    @potbot887 3 ปีที่แล้ว

    Can I use a 3.7 V battery to run it, instead of 9V? My motor needs 0.8A.

    • @DorianMcIntire
      @DorianMcIntire  3 ปีที่แล้ว

      Yes, you can replace the 9V battery with any voltage that will work with your motor. You must, however, provide a voltage to the Arduino Arduino that is compatible with the controller.

    • @potbot887
      @potbot887 3 ปีที่แล้ว

      @@DorianMcIntire Thanks Dorian