Raspberry Pi How to Control a DC Motor With an L298N Driver

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

This video is about raspberry + L298N + DC Motor
How to control DC Motor with Raspberry Pi + L298N DC Motor driver
Python Script
github.com/jumejume1/pi-l298n...
:::::::::: SUPPORT CHANNEL ========
Please Donate To Help Me Afford New Equipment And Software To Make My Videos More : goo.gl/1m8Dg2
→ Don't forget to subscribe!
🌟Love you all! 💕

Пікірлер: 156

  • @steveman1982
    @steveman19824 жыл бұрын

    Very nice :) Working on a remote controlled robot to run some wires in the narrow crawlspace under my house, this will come in handy !

  • @vaulthunter3056
    @vaulthunter30563 жыл бұрын

    Thank you!! -- I had to change line 15 value of 1000 to 100 and change line 25 raw_input to input..... after that worked great!

  • @1ycx
    @1ycx3 жыл бұрын

    Items that can be bought from amazon: Power supply with DC adapter: www.amazon.com/dp/B077PW5JC3 L293D: www.amazon.com/dp/B00ODQM8KC

  • @rafaelmarchipucci1370
    @rafaelmarchipucci13703 жыл бұрын

    Thanks for this, it helped me a loooot. Cheers from Montreal, CAN

  • @Lutfeydotcom
    @Lutfeydotcom4 жыл бұрын

    Thanks for the video! It would be helpful if you did a voice over explaining what was going on during the video instead of the music. But, hey, I got it working so thanks!

  • @Stiev00
    @Stiev004 жыл бұрын

    OMG, this is the first helpful tutorial I found! All the others were just badly explained or stupid to read. THANK YOU VERY MUCH!

  • @Lambertusjan
    @Lambertusjan4 жыл бұрын

    Well done! Not a word too much.

  • @moya_mama
    @moya_mama4 жыл бұрын

    Спасибо тебе, теперь я наконец-то понял как подрубить этот драйвер движка)!Спасибо)))!!!

  • @TheSateef
    @TheSateef2 жыл бұрын

    nice, simple, works great, thanks

  • @dainiusjaraminas6412
    @dainiusjaraminas64125 жыл бұрын

    L289N nice and easy PWM example:)

  • @qadro8536
    @qadro85364 жыл бұрын

    you just saved my projekt ty big time

  • @jvtroyen
    @jvtroyen4 жыл бұрын

    Nice and clear tutorial. Could the same be achieved from Node Red?

  • @jaf6932
    @jaf693211 ай бұрын

    Thank you, I will remember the name Maker Tutor when my robot is complete and I can finally take over the world! /j

  • @Flowmada
    @Flowmada4 жыл бұрын

    Is there anyway to use a microphone to control the motor based on frequency input? I've found a guitar tuner program that meets the sound interpretation, but how to I get the motor to start in a direction based on how high/low the freq is and then stop when a specific frequency is met?

  • @saltcraft
    @saltcraft3 жыл бұрын

    It was really helpful

  • @hewiweng99
    @hewiweng992 жыл бұрын

    Nice project! How did you power the L298N with the 3.3v power supply on the Raspberry Pi though? I thought it uses 5v.

  • @Bianchi77
    @Bianchi772 жыл бұрын

    Nice info, thanks :)

  • @kicosger5909
    @kicosger59093 ай бұрын

    Great work :) Is there a delay between the input and the execution, or is it just the recording?

  • @electroniquepassion
    @electroniquepassion5 жыл бұрын

    Nice 👍

  • @mattkan3275
    @mattkan32754 жыл бұрын

    Nice tutorial !

  • @Nilvernguyen
    @Nilvernguyen4 жыл бұрын

    thank you

  • @blackeadam
    @blackeadam Жыл бұрын

    Thanks!

  • @arvindmishra2009
    @arvindmishra20095 жыл бұрын

    thanks a lot

  • @okanelcid4527
    @okanelcid45273 жыл бұрын

    Can i use the power suply from my rasperry? (5v No 2) or do i need an external cable?

  • @vladimirsdejesusbonilla4336
    @vladimirsdejesusbonilla43368 ай бұрын

    Gracias, me sirvió.

  • @lebigboi3615
    @lebigboi36154 жыл бұрын

    IF there is a raw_input error, just change the "raw_input" to "input"

  • @frederickrichard1718

    @frederickrichard1718

    4 жыл бұрын

    python 2 vs python 3 muahahahhaaa

  • @vaulthunter3056

    @vaulthunter3056

    3 жыл бұрын

    Thank you!!

  • @MODEH7

    @MODEH7

    4 ай бұрын

    Thanks mate

  • @kiksen123
    @kiksen1238 ай бұрын

    Hello, is it possible to set the motor speed individually or just int the steps used in the py code? Thank you!

  • @stephanieponcin6459
    @stephanieponcin64595 жыл бұрын

    Muachhh also ! ;)

  • @ramanateja2193
    @ramanateja21933 жыл бұрын

    @ Maker Tutor Miss, could you please make a similar video on "Controlling four TT Geared Motors with L298H & Raspberry Pi 4B" ??

  • @salmankhan24
    @salmankhan244 жыл бұрын

    very helpful tutorial...can you make same tutorial with bts 7960 dc motor driver

  • @ramonedrozojr.768
    @ramonedrozojr.768 Жыл бұрын

    what is the recommended frequency for the PWM to work properly even when the PWM is very low?

  • @JoseAlvarezV
    @JoseAlvarezV3 жыл бұрын

    Thank you so much, this is exactly what I was looking for, question if I want to connect 2 12v DC motors, do I need a second L2298N drivers, or can I use the same one?

  • @hafizmuhammadmuteebarmagha3734

    @hafizmuhammadmuteebarmagha3734

    3 жыл бұрын

    you can use 1driver for four motors

  • @krish3357

    @krish3357

    2 жыл бұрын

    I am still learning this too, but I think as long as you have a Dual-H brigde l298n motor, you are able to control it. Just plug your motor into the other ports (in3,in4 and ENB)

  • @urtiaga71
    @urtiaga714 жыл бұрын

    Crystal clear tutorial ! I've tested it but I'm using a 12v power supply and the output of the shield is 8v. Consequently, this makes my motor to work slower than expected... any idea why it happens? Thanks

  • @teodord0nchev

    @teodord0nchev

    Жыл бұрын

    I have the same problem my output voltage is 9V. I can`t make it run at 12V and use the full potention of my motor.

  • @MultiBB112

    @MultiBB112

    29 күн бұрын

    I think you have to remove one of the jumpers kn the board to enable higher voltage

  • @brechazostv
    @brechazostv2 жыл бұрын

    Excelent tutorial..... Do you have any other for installing resnet18 on raspberry pi4 ??? Thanks and happy day!!!

  • @vaulthunter3056
    @vaulthunter30563 жыл бұрын

    This worked for me when changing 'raw input' to 'input()'....I could initially go forwards and backwards....but now, for some reason...I cannot get the motor to go in reverse! Please help!! Thanks

  • @carasilvestro2
    @carasilvestro24 жыл бұрын

    Hello, thanks for the video, it has been really helpful!! However, I'm struggling to understand what the "x='z' " is doing at the end of each if statement, can anyone explain this?

  • @xLorkin

    @xLorkin

    3 жыл бұрын

    hey there, without downloading and looking at the script in detail. I think 'x' is a variable which remembers the input. After the input is processed, it's just set to something the script isn't using , like 'z'. So it only processes your input once until you make another valid input.

  • @padmavathynarasareddygari1213
    @padmavathynarasareddygari12133 жыл бұрын

    Hey, great video. But I have 1 doubt. Can we also control servo motor with this driver?

  • @RubixCubix_

    @RubixCubix_

    5 ай бұрын

    No

  • @josephjojo756
    @josephjojo7562 жыл бұрын

    Can I use L298N to control two 250W 24V brushless hub motor with speed and directional control?

  • @s3tech962
    @s3tech9624 жыл бұрын

    Good

  • @ottotm
    @ottotm4 жыл бұрын

    does this work if i using drone motors? Im not sure about that, this is why i ask.

  • @lakshaydulani
    @lakshaydulani3 жыл бұрын

    hi, i m using a 9V battery with raspbeery pi.. The motor makes a sound but doesnt run. The same battery, or l298n driver works fine when run just using the battery. But doesnt run when connected to the pi..please help

  • @sdevane75
    @sdevane755 жыл бұрын

    hi, what is the ENA to pin 25??

  • @bobyau8755
    @bobyau87554 жыл бұрын

    i like your video and i want to ask if the code are in python 3?

  • @louismarinelli5637
    @louismarinelli5637 Жыл бұрын

    What is the green and black thing you use to connect the 12v power supply to the l298?

  • @slambee3806

    @slambee3806

    Жыл бұрын

    It is a DC Barrel to Screw Plug Jack Connector. Hope it helps!

  • @technicalilm8999
    @technicalilm89993 жыл бұрын

    When i use the h bridge the motor runs very slowly compared when i connect the motor directly to the power supply. I'm using a 9v external battery. should i get bigger battery I have little knowledge about electrical, if someone can help that would be great.

  • @adelaarenas51
    @adelaarenas514 жыл бұрын

    hello it worked for one motor but how do i use the l298n driver when using two motors,,,please answer thanks

  • @dawalkerdoesstuff6315

    @dawalkerdoesstuff6315

    3 жыл бұрын

    it's not explained but the two IN pins are simple "out" gpio pins and dictate the direction, have one pin high the other low will go on one direction, swap them and it will go on the other direction. The "ena" pin is a pwm pin used to drive the speed, you can use the spare pwm pin 13 on the pi. So you can use pins 5, 6 as the direction pins and 13 as the drive pin. Hock up the right side of the l298n as what you already have and change the code to use the above pins. hope this helps.

  • @slambee3806
    @slambee3806 Жыл бұрын

    Can you list the equipments you used please?

  • @abdelmfougouonnjupoun4614
    @abdelmfougouonnjupoun46143 жыл бұрын

    Please it is possible to control four motors dc 12v with that module l298n ?..

  • @ravenBXNY
    @ravenBXNY4 жыл бұрын

    How are you providing power to the raspberry pi? Other than that this is a very informative video.

  • @frederickrichard1718

    @frederickrichard1718

    4 жыл бұрын

    idek how do you get the 12v power supply or what is it called so i can find it on amazon? lol

  • @joecotter4385
    @joecotter4385 Жыл бұрын

    Looks great thanks for the tips are there any updates? Doesn't seem to work maybe there were updates from Pi or something gives an error: NameError: name 'raw_input' is not defined

  • @dacotacraft2011

    @dacotacraft2011

    Жыл бұрын

    same problem..

  • @emilyedwardsgyf4100
    @emilyedwardsgyf41002 жыл бұрын

    Can you tell me what model motor you are using?

  • @louise1021
    @louise10213 жыл бұрын

    All the pins seem to be in the right place but no movement happens. I am not sure what I've done wrong.

  • @littlejoelgriffo2
    @littlejoelgriffo22 жыл бұрын

    Where do you get the power supply from though??

  • @ValFolarin
    @ValFolarin14 күн бұрын

    the motor is planted perpendicular to the axle. how is it spinning the axle?

  • @amrmzkr
    @amrmzkr4 жыл бұрын

    Can i use a different ground pin on my raspberry pi since i've use the one in the video for my raspberrypi fan

  • @MakerTutor101

    @MakerTutor101

    4 жыл бұрын

    Yes you can

  • @_d4c

    @_d4c

    2 жыл бұрын

    @@MakerTutor101 could you tell me what the use is for "temp1"?

  • @frederickrichard1718
    @frederickrichard17184 жыл бұрын

    @Maker Tutor idk how do you get the 12v power supply or what its called and i cant find it on amazon lol help meeeeeee

  • @dawalkerdoesstuff6315

    @dawalkerdoesstuff6315

    3 жыл бұрын

    Something like this should do www.amazon.co.uk/gp/product/B07XDHQGZC/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1

  • @Micha-ni5xv
    @Micha-ni5xv4 жыл бұрын

    The jga25-370 motor doesn`t drive backwards.

  • @kaverighosh4523
    @kaverighosh45235 жыл бұрын

    Make a pic16f877a based LCD digital clock😇🙋

  • @cyka_delik9537
    @cyka_delik95374 ай бұрын

    Just to verify, this would nullify the need for a device like the explorer hat pro, yeah?

  • @phanuphonphiwpheuxd2066
    @phanuphonphiwpheuxd20663 жыл бұрын

    โครงรถในวิดีโอซื้อที่ไหนเหรอครับ

  • @pritamsahoo9515
    @pritamsahoo95153 ай бұрын

    Please can you tell how we will give delay after forward rotation

  • @gilangprambudi354
    @gilangprambudi3545 жыл бұрын

    Is it possible to power the Raspberry Pi 3 B+ with the source used to power the driver?

  • @virgilmcmayers4974

    @virgilmcmayers4974

    5 жыл бұрын

    Yes via DC/DC step-down converter.

  • @zacharymalwitz412

    @zacharymalwitz412

    5 жыл бұрын

    @@virgilmcmayers4974 So what raspberry pi would be the best for this project?

  • @virgilmcmayers4974

    @virgilmcmayers4974

    4 жыл бұрын

    @@zacharymalwitz412 any.

  • @sdevane75
    @sdevane755 жыл бұрын

    temp1 - what is this used for in the code also 'z' ?

  • @xLorkin

    @xLorkin

    3 жыл бұрын

    hey there, without downloading and looking at the script in detail. I think 'x' is a variable which remembers the input. After the input is processed, it's just set to something the script isn't using , like 'z'. So it only processes your input once until you make another valid input. temp1 ...? i have no idea. someone needs to name their variables better ;)

  • @arcreations3273
    @arcreations32733 жыл бұрын

    Can I use L298N driver with my personal computer

  • @dta7037
    @dta70374 жыл бұрын

    Great video, it's very helpful, but can anyone help me if i want to input duty cycle, or even RPM instead of type l,m,h ?

  • @frederickrichard1718

    @frederickrichard1718

    4 жыл бұрын

    how do you get the 12v power supply or what is it called so i can find it on amazon? lol

  • @aaditpradhan5607
    @aaditpradhan56073 жыл бұрын

    Can u explain the wiring with a diagram for the same

  • @MrIMacro
    @MrIMacro4 жыл бұрын

    Thanks i want to control the pi remotely, is that possible?

  • @novak6218

    @novak6218

    3 жыл бұрын

    i think that you could connect to it using ssh, not sure tho

  • @bucketman5138
    @bucketman51384 жыл бұрын

    can i use a 9v battery not 12v?

  • @edzajdler7943
    @edzajdler79433 жыл бұрын

    Need help! I check the wiring and the code but keep getting the following error: 'raw_input' is not defined. Any help would be appreciated

  • @bharatmandowara6168

    @bharatmandowara6168

    3 жыл бұрын

    Type: input() in place of raw_input()

  • @jeronimoduclos5772
    @jeronimoduclos577211 ай бұрын

    Where does the power supply come from? from the raspberry? If so where from From a different source? Do i need one fro the raspberry one for the motor and one for this?

  • @BradenNeighbor

    @BradenNeighbor

    2 ай бұрын

    Check the diagram at 0:52. For the ground, you could splice the wire, or you could simply plug it into the raspberry pi's ground.

  • @kumarjha1729
    @kumarjha17293 жыл бұрын

    Any idea how to control RMCS 221x motor?

  • @javiers.8274
    @javiers.82744 жыл бұрын

    Thaks for for your code. I´ll be using it for my robot. But what exactly makes this "e" order?

  • @peileed

    @peileed

    4 жыл бұрын

    it stops the GPIO from sending signals (e for "exit" I assume), it is basic a "turn off", you should never close the code without that as the gpio will still be active even if you are not running the code

  • @javiers.8274

    @javiers.8274

    4 жыл бұрын

    @@peileed Ok, thank you so much :D

  • @trueindian03
    @trueindian032 жыл бұрын

    I have a doubt, why you are connecting H Bridge ground to raspberry pi ground

  • @naveendubey4412
    @naveendubey44124 жыл бұрын

    when i run the program it shows line 28 name 'raw_input' not defined. pls help

  • @SchwettyBawls

    @SchwettyBawls

    4 жыл бұрын

    Change to just 'input'

  • @zacharymalwitz412
    @zacharymalwitz4125 жыл бұрын

    What raspberry pi is best for doing this project, please respond

  • @virgilmcmayers4974

    @virgilmcmayers4974

    5 жыл бұрын

    Any from oldest to the newest...

  • @Just_Cat.
    @Just_Cat.3 жыл бұрын

    elif x=='f': ^ SyntaxError: unindent does not match any outer indentation level help!?

  • @abu8422
    @abu842211 ай бұрын

    how many dc motors raspberry pi can move

  • @luisvaz1122
    @luisvaz11224 жыл бұрын

    What temp1=1 does?

  • @_d4c

    @_d4c

    2 жыл бұрын

    that is what i am wondering

  • @f.alperenbolat9491
    @f.alperenbolat9491 Жыл бұрын

    How to connect motor driver to Jetson pins ?

  • @okuratnywidz3196
    @okuratnywidz319611 ай бұрын

    Hello I HAVE one questions How much Volt have motor ? Please answer on my question

  • @sreenandmallisetty9809
    @sreenandmallisetty98093 жыл бұрын

    what is IN1, IN2 and ENA

  • @dawalkerdoesstuff6315
    @dawalkerdoesstuff63153 жыл бұрын

    A note to all about the power supply, make sure it is a 12v 2a supply. I had a 12v power supply from a previous project but was 10a, loud crack and blue smoke told me something was wrong :(

  • @idvfpv

    @idvfpv

    3 жыл бұрын

    so you don't know anything about electronics, even if the power supply was 1000A at 12V it would not blow anything up! amps aren't pushed in to the source, they are pulled out of the supply, and the amount of amps is how much the source asks from the supply! if your source asks 3A but the supply is rated for 2A it would likely burn your supply! so don't tell people wrong things, you are making them burn there shit. and you probably fried your electronics because you don't know electronics and tought that if your short circuit your shit it would work better!!!

  • @heronymousbot5883

    @heronymousbot5883

    Жыл бұрын

    I thought current draw was dependent on load? Not the supply?

  • @tron1098

    @tron1098

    Жыл бұрын

    @@heronymousbot5883 agree

  • @slambee3806

    @slambee3806

    11 ай бұрын

    Same but mine had a really big blue crack with a lot of smoke

  • @tomererez6980
    @tomererez6980 Жыл бұрын

    cool as f***!!!

  • @develhoper
    @develhoper3 жыл бұрын

    So I'm getting an error about ''raw_input is not defined''. How can I solve this problem?

  • @teodord0nchev

    @teodord0nchev

    Жыл бұрын

    x=input() will do the job ..remove raw_

  • @arunprakash1873
    @arunprakash1873 Жыл бұрын

    how to use this for 4 wheels ?

  • @aasnetwork5391
    @aasnetwork53913 жыл бұрын

    Its comming error like this name 'raw_input' is not defined

  • @gomes0802
    @gomes08024 жыл бұрын

    when I run the program it gives error on line 24 can you help me

  • @lebigboi3615

    @lebigboi3615

    4 жыл бұрын

    @GingaFox no the raw_input() problem is on line 29. But yea, i have an error on that raw_input() command, so pls help if possible

  • @lebigboi3615

    @lebigboi3615

    4 жыл бұрын

    @GingaFox yeah we found the reason like 20 seconds after i wrote the comment

  • @lebigboi3615

    @lebigboi3615

    4 жыл бұрын

    GingaFox oh yeah, it was this exact error.

  • @frederickrichard1718

    @frederickrichard1718

    4 жыл бұрын

    @@lebigboi3615 change raw input to just input she probably coded it in python 2

  • @justswedish
    @justswedish4 жыл бұрын

    THIS IS NOT WORK Traceback (most recent call last): File "/home/pi/Desktop/pi-l298n-dc-motor-master/l298n_dc.py", line 28, in x=raw_input() NameError: name 'raw_input' is not defined

  • @RoiLele0

    @RoiLele0

    4 жыл бұрын

    change the "raw_input" line 18 to "input"

  • @felixianohansrenee1437
    @felixianohansrenee14375 жыл бұрын

    Can i use a tamiya motor ?

  • @MakerTutor101

    @MakerTutor101

    5 жыл бұрын

    Yes

  • @felixianohansrenee1437

    @felixianohansrenee1437

    5 жыл бұрын

    @@MakerTutor101 it is safe with tamiya stock battery as power source? Tamiya motor t needs 2 ampere to run

  • @kAbdulBasitKarim
    @kAbdulBasitKarim2 жыл бұрын

    x=raw_input() has error in my case. plz check

  • @AMAL_JOY.
    @AMAL_JOY.3 жыл бұрын

    how to control 2 dc motors?

  • @harpermartin7813
    @harpermartin78132 жыл бұрын

    Great video! God bless. Always remember that Jesus Christ loves you and is Savior!

  • @freemanfreed1581
    @freemanfreed15814 жыл бұрын

    12 V power supply ground and raspberry pi ground burnt the board !! why ???

  • @30yearoldwhiteguy69
    @30yearoldwhiteguy692 жыл бұрын

    Where do I find the wires

  • @erandiromesha2365
    @erandiromesha23653 ай бұрын

    how to controle the speed of the motors?

  • @pritamnagdeve2299

    @pritamnagdeve2299

    3 ай бұрын

    Please send me the correct code

  • @pritamnagdeve2299

    @pritamnagdeve2299

    3 ай бұрын

    If your code run, then please send me the correct code

  • @braylenhammond12
    @braylenhammond122 жыл бұрын

    This would be perfect to make a vehicle but I would need 3 or 4 of them

  • @muhammadhaykal9323
    @muhammadhaykal93234 жыл бұрын

    How to control motor with Blynk.apk??

  • @glogs98
    @glogs985 жыл бұрын

    what p.start() does

  • @dainiusjaraminas6412

    @dainiusjaraminas6412

    5 жыл бұрын

    p.start(25) set FIRST attempt to run to DC power 25%

  • @Aryankhan-pz7ml
    @Aryankhan-pz7ml5 жыл бұрын

    Mam ap job kya karte ho?

  • @BrendonHolt
    @BrendonHolt7 ай бұрын

    Verbal commentary would be very useful.

Келесі