How to use a transistor to control motor speed

Поделиться
HTML-код
  • Опубликовано: 21 ноя 2016
  • How to use a transistor to control motor speed. We use a 2N2222a NPN transistor with the the base going to a PWM pin and a 50k potentiometer to vary the speed of a simple DC motor.
    ~-~~-~~~-~~-~
    Please watch: "Arduino Power Monitor"
    • Arduino Power Monitor
    ~-~~-~~~-~~-~
  • РазвлеченияРазвлечения

Комментарии • 47

  • @nickstamatiou9871
    @nickstamatiou9871 3 месяца назад

    You are an expert on electronics I have learn so much from you😊😊😊Thanks

  • @dannyyeoh2340
    @dannyyeoh2340 6 лет назад +12

    There is a error at 4:04. The ground wire from Arduino is hook up to the positive rail of the breadboard. At 7:07, the circuit has been corrected. The ground from the Arduino is correctly hook to the negative rail on the breadboard..

    • @ET2carbon
      @ET2carbon 2 года назад

      hahaha I saw that too

  • @irfanpin-2255
    @irfanpin-2255 5 лет назад +2

    It is really good idea and very helpful for me thank you

  • @FerMagee
    @FerMagee 2 года назад

    Good job! Which transistors can I use for this besides the one you showed us?

  • @MrOrangeman18
    @MrOrangeman18 4 года назад

    hey. great video. could you do a video on how to pick the correct npn transistor while using it in a pwm format. i am designing a pwm driver to drive a 12v computer fan, but running at max it uses about 4watts, im after a smd npn to do this, but struggling. i know for my aplication i will never hit 100 power, but struggling to work out what sort of watts i will be using at a given pulse width.
    cheers
    steve

  • @cndbrn7975
    @cndbrn7975 2 года назад

    thanks! ..

  • @adamadness2283
    @adamadness2283 2 года назад +1

    The moter wire you should solder it it helps

  • @FM60260
    @FM60260 5 лет назад +1

    How do you build one without the PLC?

  • @stopthephilosophicalzombie9017
    @stopthephilosophicalzombie9017 3 года назад +1

    I'm trying to cook up a mouthpiece controller for a double amputee for a servo powered sewing machine. I want to use a clothespin shaped mouthpiece as as substitute for the pedal, but I don't know what sensor I can use to translate clench angle to PWM or voltage difference. Do you have any insight what I can use to accomplish this?

  • @migsvensurfing6310
    @migsvensurfing6310 6 лет назад +8

    I think a reverse protection diode is a good thing when using anything with coils in it. Dont you agree ?

    • @learnelectronics
      @learnelectronics  6 лет назад

      +migsven surfing yep

    • @SK-NSW
      @SK-NSW 5 лет назад

      where would you put the diode

    • @jackvac1918
      @jackvac1918 5 лет назад +3

      @@SK-NSW You would bridge the DC motor terminals with the diode installed backwards, negative side of the diode to the positive wire. This way when current is being applied to the motor it won't short through the diode, but when the circuit is opened the energy in the coil in the motor will discharge through the diode and prevent the a potentially destructive voltage spike.

    • @dylanjayabahu2878
      @dylanjayabahu2878 3 года назад

      @@jackvac1918 What do you mean by bridge? Would you just attach the negative of the diode to the positive going into the motor and the positive of the diode going to the ground wire connecting to the motor? like parallel? And also can I use an LED or should I get a regular diode?

    • @jackvac1918
      @jackvac1918 3 года назад

      @@dylanjayabahu2878 Yes, the diode in reverse polarity to the circuit and in parallel to the motor (this configuration is called a flyback diode). You will need to use a power diode for a motor because the large flyback current generated by a disconnected motor will burn up a typical LED; the diode should be rated to at least be able handle the same amount of current the motor draws under load.

  • @jhbrogeras
    @jhbrogeras 3 года назад

    Not sure if it makes a difference. In the diagram (1:11) the load (in this case the engine) goes between Vcc and collector, while the emiter is connected to ground. In this example, the engine (the load) is betweem emitter and ground. Does it make any difference?

  • @sarthaksachdeva2090
    @sarthaksachdeva2090 7 лет назад +1

    im not able to get this circuit working

  • @treybarnes7932
    @treybarnes7932 3 года назад

    If i were to substitute a 100k potentiometer it would do the same thing just with a larger deadzone with the motor not running am i correct?

  • @amratsingh5206
    @amratsingh5206 5 лет назад +1

    As I see you are not using a resistor for the base of the transistor, other people recommend using a base resistor, I don't know what kind of resistor should I use when base is connected to arduino PWM. Is the choice of resistor relative to how much voltage and current is passing through the collector and emitter? I don't know how to read transistor datasheet, if you could show beginners like to me, what kind of transistor with what resistor should be used for the base that would be great.

    • @MosMeister
      @MosMeister 3 года назад

      I read a lot that uou don't necessarily need a resistor with these mini-transistors. I also don't know why, bit it works fine for me as well.

  • @MosMeister
    @MosMeister 3 года назад

    Why would you need the Arduino? You can add the pot-meter directly to the base of the transistor (with a resistor in between perhaps?)

    • @lentzintl
      @lentzintl 3 года назад

      The transistor has to drop more voltage across it when not fully saturated and you will waste power with heat. Much more efficient to use PWM to vary the effective area under the curve to control the speed.

  • @Thaddeus9287
    @Thaddeus9287 2 года назад

    Honest question: When using the PWM signal to control the LED brightness in a previous video, you did not need a transistor, but here, to control the motor speed, you do need that transistor.
    So what is the transistor doing and why is it necessary in this case?

    • @lyapunovnchill3028
      @lyapunovnchill3028 Год назад +1

      The Arduino cant handle the current drawn from the motor, but it can handle the current drawn from an LED.

  • @plouf1969
    @plouf1969 5 лет назад +1

    Why do you need the transistor at all? What would happen if you simply connected the digital pin to the motor instead of putting it to the base of the transistor?

    • @learnelectronics
      @learnelectronics  5 лет назад +1

      Arduino pins max out at 40mA. You would burn out the analog circuit for certain and possibly damage the board in total.

  • @szevlin
    @szevlin 4 года назад

    how is the motor powered? i dont see where its getting the power from, the nano can give max 40ma and that motor looks like its drawing more

    • @MosMeister
      @MosMeister 3 года назад

      Power is switched trough the transistor

    • @szevlin
      @szevlin 3 года назад +1

      thank you, i actually learned a lot since i commented this but wouldnt the current be the maximum that the traces on the board can withstand? so for example if i wanted a 100 watt motor i would need a different power supply

  • @animangafan342
    @animangafan342 2 года назад

    why didn't you need a diode for the DC motor?

  • @randywetzler5976
    @randywetzler5976 Год назад

    I tried this using a PNP BC557 transistor with a 10K potentiometer (don't have a 2N2222a or 50kpot) and the motor just runs full out ignoring the potentiometer. I wold assume it should work fined using these components. I checked and double checked the code and connections, not sure where to go from here.

    • @randywetzler5976
      @randywetzler5976 Год назад

      Being a novice at electronics I dug into this a bit further. Turns out the BC557 is a PNP so wouldn't work even after switching the collector and emitter feeds. After googling for a replacement for the 2N2222A NPN a 2N3904 NPN was listed which I was able to find in my stash from an Arduino starter kit purchased a few years ago. All worked as it should after that. Hope this helps someone in the future who doesn't quite have the exact parts used in a project or video such as this.
      Thanks to "learnelectroncis" for providing the video!

  • @dracwula
    @dracwula Год назад

    Can you explain why use D5 as PWM output to drive transistor rather than Analog (A#) as output port to drive the transistor?

    • @Mtmonaghan
      @Mtmonaghan 2 месяца назад +1

      Because it is a pulse width procedure , the pulse is at digital high and low for varying periods, depending on the pot setting .

  • @TheTtreasure
    @TheTtreasure 4 года назад

    can i use this way to control in dc motor for drone??

    • @Mtmonaghan
      @Mtmonaghan 2 месяца назад

      You could use a radio controlled servo to turn the pot.

  • @Nazgul1221
    @Nazgul1221 2 месяца назад

    Bro im using 2n7000 and its overheating, is it okay?

  • @lookupverazhou8599
    @lookupverazhou8599 Год назад

    How are you doing this? My pins don't even generate enough current to run the dc motor directly, how does a pwm at reduced voltage do it? Yeah, it's bad for the board, I get it.

  • @gallupcustomknives2293
    @gallupcustomknives2293 4 года назад

    I tried to do this exactly and I get an error at motorSpeed = map(potVal, 0, 1023, 0, 255); it says motorSpeed was not declared in this scope. Anybody care to help me fix it?

    • @gallupcustomknives2293
      @gallupcustomknives2293 4 года назад

      Nevermind, I accidentally wrote the first motorspeed and the secon motorSpeed, just needed to correct the first S with a capital S and it works.

  • @buiciucdaniel6794
    @buiciucdaniel6794 5 лет назад

    I don't see a power source for the motor.

    • @learnelectronics
      @learnelectronics  5 лет назад

      12 bench supply

    • @buiciucdaniel6794
      @buiciucdaniel6794 5 лет назад +1

      @@learnelectronics But is not an independent power source. Motor must have an independent one.

  • @sarthaksachdeva2090
    @sarthaksachdeva2090 7 лет назад

    nahi chal raha bhai aise to

    • @obtron
      @obtron 7 лет назад

      lol ! bruv