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

  Рет қаралды 207,811

Maker Tutor

Maker Tutor

Күн бұрын

This video is about raspberry + L298N + DC Motor
How to control DC Motor with Raspberry Pi + L298N DC Motor driver
Python Script
github.com/jum...
:::::::::: 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! 💕

Пікірлер
@steveman1982
@steveman1982 4 жыл бұрын
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
@vaulthunter3056 4 жыл бұрын
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!
@Stiev00
@Stiev00 5 жыл бұрын
OMG, this is the first helpful tutorial I found! All the others were just badly explained or stupid to read. THANK YOU VERY MUCH!
@blackeadam
@blackeadam 2 жыл бұрын
Thanks!
@Lutfeydotcom
@Lutfeydotcom 4 жыл бұрын
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!
@jaf6932
@jaf6932 Жыл бұрын
Thank you, I will remember the name Maker Tutor when my robot is complete and I can finally take over the world! /j
@rafaelmarchipucci1370
@rafaelmarchipucci1370 3 жыл бұрын
Thanks for this, it helped me a loooot. Cheers from Montreal, CAN
@lebigboi3615
@lebigboi3615 5 жыл бұрын
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 4 жыл бұрын
Thank you!!
@MODEH7
@MODEH7 10 ай бұрын
Thanks mate
@kicosger5909
@kicosger5909 9 ай бұрын
Great work :) Is there a delay between the input and the execution, or is it just the recording?
@siklosinandor74
@siklosinandor74 2 ай бұрын
It sure works! Where is your 4 engine program available? Thank you very much!
@jvtroyen
@jvtroyen 4 жыл бұрын
Nice and clear tutorial. Could the same be achieved from Node Red?
@moya_mama
@moya_mama 4 жыл бұрын
Спасибо тебе, теперь я наконец-то понял как подрубить этот драйвер движка)!Спасибо)))!!!
@harpyeagle99-e7x
@harpyeagle99-e7x 3 жыл бұрын
Nice project! How did you power the L298N with the 3.3v power supply on the Raspberry Pi though? I thought it uses 5v.
@dainiusjaraminas6412
@dainiusjaraminas6412 5 жыл бұрын
L289N nice and easy PWM example:)
@padmavathynarasareddygari1213
@padmavathynarasareddygari1213 4 жыл бұрын
Hey, great video. But I have 1 doubt. Can we also control servo motor with this driver?
@Lambertusjan
@Lambertusjan 4 жыл бұрын
Well done! Not a word too much.
@carasilvestro2
@carasilvestro2 5 жыл бұрын
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 4 жыл бұрын
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.
@Happytobehereee
@Happytobehereee 5 ай бұрын
What are the red and black wires connected to the the motor? Mine came with no wires so I’m curious
@TheSateef
@TheSateef 3 жыл бұрын
nice, simple, works great, thanks
@stevenbeebe35
@stevenbeebe35 18 күн бұрын
I think he has something wrong? You are supposed to connect the 12V power supply into the 3 block connector, closest to the 6 Logic pins. He is putting the 12V into the 5V input. If you look at the datasheet PDF, the 12V power is connected to the 5V input, wrong. I hope Maker Tutor reads these comments. I am looking at the HANDSON TECH PDF on the same device? or different L298N breakout board? Kinda confused here.
@urtiaga71
@urtiaga71 5 жыл бұрын
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 2 жыл бұрын
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 7 ай бұрын
I think you have to remove one of the jumpers kn the board to enable higher voltage
@ravenBXNY
@ravenBXNY 4 жыл бұрын
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
@ramonedrozojr.768
@ramonedrozojr.768 2 жыл бұрын
what is the recommended frequency for the PWM to work properly even when the PWM is very low?
@kiksen123
@kiksen123 Жыл бұрын
Hello, is it possible to set the motor speed individually or just int the steps used in the py code? Thank you!
@vaulthunter3056
@vaulthunter3056 4 жыл бұрын
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
@ValFolarin
@ValFolarin 7 ай бұрын
the motor is planted perpendicular to the axle. how is it spinning the axle?
@okanelcid4527
@okanelcid4527 3 жыл бұрын
Can i use the power suply from my rasperry? (5v No 2) or do i need an external cable?
@JoseAlvarezV
@JoseAlvarezV 4 жыл бұрын
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 3 жыл бұрын
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)
@adelaarenas51
@adelaarenas51 5 жыл бұрын
hello it worked for one motor but how do i use the l298n driver when using two motors,,,please answer thanks
@dawalkerdoesstuff6315
@dawalkerdoesstuff6315 4 жыл бұрын
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.
@qadro8536
@qadro8536 5 жыл бұрын
you just saved my projekt ty big time
@gilangprambudi354
@gilangprambudi354 5 жыл бұрын
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 5 жыл бұрын
@@zacharymalwitz412 any.
@joecotter4385
@joecotter4385 2 жыл бұрын
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..
@salmankhan24
@salmankhan24 4 жыл бұрын
very helpful tutorial...can you make same tutorial with bts 7960 dc motor driver
@louismarinelli5637
@louismarinelli5637 2 жыл бұрын
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!
@josephjojo756
@josephjojo756 2 жыл бұрын
Can I use L298N to control two 250W 24V brushless hub motor with speed and directional control?
@Flowmada
@Flowmada 5 жыл бұрын
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?
@Bearded_Dragon_Sir
@Bearded_Dragon_Sir 6 ай бұрын
Look into what a Fourier Transform is
@erandiromesha2365
@erandiromesha2365 10 ай бұрын
how to controle the speed of the motors?
@pritamnagdeve2299
@pritamnagdeve2299 10 ай бұрын
Please send me the correct code
@pritamnagdeve2299
@pritamnagdeve2299 10 ай бұрын
If your code run, then please send me the correct code
@lakshaydulani
@lakshaydulani 3 жыл бұрын
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
@ramanateja2193
@ramanateja2193 3 жыл бұрын
@ Maker Tutor Miss, could you please make a similar video on "Controlling four TT Geared Motors with L298H & Raspberry Pi 4B" ??
@pritamsahoo9515
@pritamsahoo9515 9 ай бұрын
Please can you tell how we will give delay after forward rotation
@arcreations3273
@arcreations3273 3 жыл бұрын
Can I use L298N driver with my personal computer
@ottotm
@ottotm 5 жыл бұрын
does this work if i using drone motors? Im not sure about that, this is why i ask.
@slambee3806
@slambee3806 Жыл бұрын
Can you list the equipments you used please?
@Micha-ni5xv
@Micha-ni5xv 4 жыл бұрын
The jga25-370 motor doesn`t drive backwards.
@emilyedwardsgyf4100
@emilyedwardsgyf4100 2 жыл бұрын
Can you tell me what model motor you are using?
@littlejoelgriffo2
@littlejoelgriffo2 2 жыл бұрын
Where do you get the power supply from though??
@cyka_delik9537
@cyka_delik9537 11 ай бұрын
Just to verify, this would nullify the need for a device like the explorer hat pro, yeah?
@louise1021
@louise1021 3 жыл бұрын
All the pins seem to be in the right place but no movement happens. I am not sure what I've done wrong.
@dawalkerdoesstuff6315
@dawalkerdoesstuff6315 4 жыл бұрын
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 2 жыл бұрын
I thought current draw was dependent on load? Not the supply?
@tron1098
@tron1098 Жыл бұрын
@@heronymousbot5883 agree
@slambee3806
@slambee3806 Жыл бұрын
Same but mine had a really big blue crack with a lot of smoke
@brechazostv
@brechazostv 2 жыл бұрын
Excelent tutorial..... Do you have any other for installing resnet18 on raspberry pi4 ??? Thanks and happy day!!!
@RixtronixLAB
@RixtronixLAB 2 жыл бұрын
Nice info, thanks :)
@luisvaz1122
@luisvaz1122 4 жыл бұрын
What temp1=1 does?
@_d4c
@_d4c 3 жыл бұрын
that is what i am wondering
@sdevane75
@sdevane75 5 жыл бұрын
hi, what is the ENA to pin 25??
@trueindian03
@trueindian03 3 жыл бұрын
I have a doubt, why you are connecting H Bridge ground to raspberry pi ground
@naveendubey4412
@naveendubey4412 5 жыл бұрын
when i run the program it shows line 28 name 'raw_input' not defined. pls help
@SchwettyBawls
@SchwettyBawls 4 жыл бұрын
Change to just 'input'
@f.alperenbolat9491
@f.alperenbolat9491 2 жыл бұрын
How to connect motor driver to Jetson pins ?
@electroniquepassion
@electroniquepassion 5 жыл бұрын
Nice 👍
@abu8422
@abu8422 Жыл бұрын
how many dc motors raspberry pi can move
@abdelmfougouonnjupoun4614
@abdelmfougouonnjupoun4614 4 жыл бұрын
Please it is possible to control four motors dc 12v with that module l298n ?..
@bucketman5138
@bucketman5138 4 жыл бұрын
can i use a 9v battery not 12v?
@edzajdler7943
@edzajdler7943 4 жыл бұрын
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 4 жыл бұрын
Type: input() in place of raw_input()
@jeronimoduclos5772
@jeronimoduclos5772 Жыл бұрын
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 8 ай бұрын
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.
@amrmzkr
@amrmzkr 4 жыл бұрын
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 3 жыл бұрын
@@MakerTutor101 could you tell me what the use is for "temp1"?
@technicalilm8999
@technicalilm8999 4 жыл бұрын
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.
@sdevane75
@sdevane75 5 жыл бұрын
temp1 - what is this used for in the code also 'z' ?
@xLorkin
@xLorkin 4 жыл бұрын
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 ;)
@okuratnywidz3196
@okuratnywidz3196 Жыл бұрын
Hello I HAVE one questions How much Volt have motor ? Please answer on my question
@sreenandmallisetty9809
@sreenandmallisetty9809 4 жыл бұрын
what is IN1, IN2 and ENA
@saltcraft
@saltcraft 4 жыл бұрын
It was really helpful
@arunprakash1873
@arunprakash1873 Жыл бұрын
how to use this for 4 wheels ?
@aaditpradhan5607
@aaditpradhan5607 3 жыл бұрын
Can u explain the wiring with a diagram for the same
@MrIMacro
@MrIMacro 4 жыл бұрын
Thanks i want to control the pi remotely, is that possible?
@novak6218
@novak6218 4 жыл бұрын
i think that you could connect to it using ssh, not sure tho
@phanuphonphiwpheuxd2066
@phanuphonphiwpheuxd2066 4 жыл бұрын
โครงรถในวิดีโอซื้อที่ไหนเหรอครับ
@develhoper
@develhoper 3 жыл бұрын
So I'm getting an error about ''raw_input is not defined''. How can I solve this problem?
@teodord0nchev
@teodord0nchev 2 жыл бұрын
x=input() will do the job ..remove raw_
@gomes0802
@gomes0802 5 жыл бұрын
when I run the program it gives error on line 24 can you help me
@lebigboi3615
@lebigboi3615 5 жыл бұрын
@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 5 жыл бұрын
@GingaFox yeah we found the reason like 20 seconds after i wrote the comment
@lebigboi3615
@lebigboi3615 5 жыл бұрын
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
@kumarjha1729
@kumarjha1729 3 жыл бұрын
Any idea how to control RMCS 221x motor?
@zacharymalwitz412
@zacharymalwitz412 5 жыл бұрын
What raspberry pi is best for doing this project, please respond
@virgilmcmayers4974
@virgilmcmayers4974 5 жыл бұрын
Any from oldest to the newest...
@aasnetwork5391
@aasnetwork5391 3 жыл бұрын
Its comming error like this name 'raw_input' is not defined
@mattkan3275
@mattkan3275 4 жыл бұрын
Nice tutorial !
@frederickrichard1718
@frederickrichard1718 4 жыл бұрын
@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 4 жыл бұрын
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
@bobyau8755
@bobyau8755 4 жыл бұрын
i like your video and i want to ask if the code are in python 3?
@javiers.8274
@javiers.8274 5 жыл бұрын
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
@BrendonHolt
@BrendonHolt Жыл бұрын
Verbal commentary would be very useful.
@Just_Cat.
@Just_Cat. 4 жыл бұрын
elif x=='f': ^ SyntaxError: unindent does not match any outer indentation level help!?
@kaverighosh4523
@kaverighosh4523 5 жыл бұрын
Make a pic16f877a based LCD digital clock😇🙋
@kAbdulBasitKarim
@kAbdulBasitKarim 2 жыл бұрын
x=raw_input() has error in my case. plz check
@freemanfreed1581
@freemanfreed1581 5 жыл бұрын
12 V power supply ground and raspberry pi ground burnt the board !! why ???
@felixianohansrenee1437
@felixianohansrenee1437 5 жыл бұрын
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
@harpermartin7813
@harpermartin7813 3 жыл бұрын
Great video! God bless. Always remember that Jesus Christ loves you and is Savior!
@ercümentalpaslan
@ercümentalpaslan 4 жыл бұрын
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"
@AMAL_JOY.
@AMAL_JOY. 4 жыл бұрын
how to control 2 dc motors?
@dta7037
@dta7037 4 жыл бұрын
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
@Nilvernguyen
@Nilvernguyen 5 жыл бұрын
thank you
@vladimirsdejesusbonilla4336
@vladimirsdejesusbonilla4336 Жыл бұрын
Gracias, me sirvió.
@s3tech962
@s3tech962 5 жыл бұрын
Good
@MarwaKacimi-ou2lk
@MarwaKacimi-ou2lk 8 ай бұрын
Comment je peux faire ça avec 4 roues
@ldu_yt4045
@ldu_yt4045 8 күн бұрын
sois 2 moteurs qui controlent 4 roues, sois 4moteurs qui controlent chaque roues
@kidzeroll99
@kidzeroll99 5 жыл бұрын
How to control motor with Blynk.apk??
@inggridelsipurba7668
@inggridelsipurba7668 9 ай бұрын
why can't it stop, is there a problem? why can't it stop, is there a problem? 
@glogs98
@glogs98 5 жыл бұрын
what p.start() does
@dainiusjaraminas6412
@dainiusjaraminas6412 5 жыл бұрын
p.start(25) set FIRST attempt to run to DC power 25%
@StefyPoncin
@StefyPoncin 5 жыл бұрын
Muachhh also ! ;)
@arvindmishra2009
@arvindmishra2009 5 жыл бұрын
thanks a lot
The Ultimate Guide to using Motors in Robotics (including ROS, Raspberry Pi)
25:56
Raspberry Pi Robotics #3: Keyboard Control
23:05
ExplainingComputers
Рет қаралды 361 М.
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
Driving DC Motors with Microcontrollers
1:04:32
DroneBot Workshop
Рет қаралды 741 М.
Raspberry Pi Motor Control & RPM Measurement Tutorial
18:43
rdagger68
Рет қаралды 97 М.
How to Control a Brushless Motor with a Raspberry Pi 5
15:09
Berardinux
Рет қаралды 4,5 М.
How to Make Anything Remote Controlled with the RX480E Circuit!
19:21
Control Your Raspberry Pi Remotely Using Your Phone | RaspController
8:22
Huge Current MOTOR DRIVER BTS7960
7:27
Saravanan AL
Рет қаралды 73 М.
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН