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
Very nice :) Working on a remote controlled robot to run some wires in the narrow crawlspace under my house, this will come in handy !
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!
Items that can be bought from amazon: Power supply with DC adapter: www.amazon.com/dp/B077PW5JC3 L293D: www.amazon.com/dp/B00ODQM8KC
Thanks for this, it helped me a loooot. Cheers from Montreal, CAN
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!
OMG, this is the first helpful tutorial I found! All the others were just badly explained or stupid to read. THANK YOU VERY MUCH!
Well done! Not a word too much.
Спасибо тебе, теперь я наконец-то понял как подрубить этот драйвер движка)!Спасибо)))!!!
nice, simple, works great, thanks
L289N nice and easy PWM example:)
you just saved my projekt ty big time
Nice and clear tutorial. Could the same be achieved from Node Red?
Thank you, I will remember the name Maker Tutor when my robot is complete and I can finally take over the world! /j
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?
It was really helpful
Nice project! How did you power the L298N with the 3.3v power supply on the Raspberry Pi though? I thought it uses 5v.
Nice info, thanks :)
Great work :) Is there a delay between the input and the execution, or is it just the recording?
Nice 👍
Nice tutorial !
thank you
Thanks!
thanks a lot
Can i use the power suply from my rasperry? (5v No 2) or do i need an external cable?
Gracias, me sirvió.
IF there is a raw_input error, just change the "raw_input" to "input"
@frederickrichard1718
4 жыл бұрын
python 2 vs python 3 muahahahhaaa
@vaulthunter3056
3 жыл бұрын
Thank you!!
@MODEH7
4 ай бұрын
Thanks mate
Hello, is it possible to set the motor speed individually or just int the steps used in the py code? Thank you!
Muachhh also ! ;)
@ Maker Tutor Miss, could you please make a similar video on "Controlling four TT Geared Motors with L298H & Raspberry Pi 4B" ??
very helpful tutorial...can you make same tutorial with bts 7960 dc motor driver
what is the recommended frequency for the PWM to work properly even when the PWM is very low?
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
3 жыл бұрын
you can use 1driver for four motors
@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)
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
Жыл бұрын
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
29 күн бұрын
I think you have to remove one of the jumpers kn the board to enable higher voltage
Excelent tutorial..... Do you have any other for installing resnet18 on raspberry pi4 ??? Thanks and happy day!!!
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
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
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.
Hey, great video. But I have 1 doubt. Can we also control servo motor with this driver?
@RubixCubix_
5 ай бұрын
No
Can I use L298N to control two 250W 24V brushless hub motor with speed and directional control?
Good
does this work if i using drone motors? Im not sure about that, this is why i ask.
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
hi, what is the ENA to pin 25??
i like your video and i want to ask if the code are in python 3?
What is the green and black thing you use to connect the 12v power supply to the l298?
@slambee3806
Жыл бұрын
It is a DC Barrel to Screw Plug Jack Connector. Hope it helps!
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.
hello it worked for one motor but how do i use the l298n driver when using two motors,,,please answer thanks
@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.
Can you list the equipments you used please?
Please it is possible to control four motors dc 12v with that module l298n ?..
How are you providing power to the raspberry pi? Other than that this is a very informative video.
@frederickrichard1718
4 жыл бұрын
idek how do you get the 12v power supply or what is it called so i can find it on amazon? lol
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
Жыл бұрын
same problem..
Can you tell me what model motor you are using?
All the pins seem to be in the right place but no movement happens. I am not sure what I've done wrong.
Where do you get the power supply from though??
the motor is planted perpendicular to the axle. how is it spinning the axle?
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
4 жыл бұрын
Yes you can
@_d4c
2 жыл бұрын
@@MakerTutor101 could you tell me what the use is for "temp1"?
@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
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
The jga25-370 motor doesn`t drive backwards.
Make a pic16f877a based LCD digital clock😇🙋
Just to verify, this would nullify the need for a device like the explorer hat pro, yeah?
โครงรถในวิดีโอซื้อที่ไหนเหรอครับ
Please can you tell how we will give delay after forward rotation
Is it possible to power the Raspberry Pi 3 B+ with the source used to power the driver?
@virgilmcmayers4974
5 жыл бұрын
Yes via DC/DC step-down converter.
@zacharymalwitz412
5 жыл бұрын
@@virgilmcmayers4974 So what raspberry pi would be the best for this project?
@virgilmcmayers4974
4 жыл бұрын
@@zacharymalwitz412 any.
temp1 - what is this used for in the code also 'z' ?
@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 ;)
Can I use L298N driver with my personal computer
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
4 жыл бұрын
how do you get the 12v power supply or what is it called so i can find it on amazon? lol
Can u explain the wiring with a diagram for the same
Thanks i want to control the pi remotely, is that possible?
@novak6218
3 жыл бұрын
i think that you could connect to it using ssh, not sure tho
can i use a 9v battery not 12v?
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
3 жыл бұрын
Type: input() in place of raw_input()
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
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.
Any idea how to control RMCS 221x motor?
Thaks for for your code. I´ll be using it for my robot. But what exactly makes this "e" order?
@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
4 жыл бұрын
@@peileed Ok, thank you so much :D
I have a doubt, why you are connecting H Bridge ground to raspberry pi ground
when i run the program it shows line 28 name 'raw_input' not defined. pls help
@SchwettyBawls
4 жыл бұрын
Change to just 'input'
What raspberry pi is best for doing this project, please respond
@virgilmcmayers4974
5 жыл бұрын
Any from oldest to the newest...
elif x=='f': ^ SyntaxError: unindent does not match any outer indentation level help!?
how many dc motors raspberry pi can move
What temp1=1 does?
@_d4c
2 жыл бұрын
that is what i am wondering
How to connect motor driver to Jetson pins ?
Hello I HAVE one questions How much Volt have motor ? Please answer on my question
what is IN1, IN2 and ENA
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
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
Жыл бұрын
I thought current draw was dependent on load? Not the supply?
@tron1098
Жыл бұрын
@@heronymousbot5883 agree
@slambee3806
11 ай бұрын
Same but mine had a really big blue crack with a lot of smoke
cool as f***!!!
So I'm getting an error about ''raw_input is not defined''. How can I solve this problem?
@teodord0nchev
Жыл бұрын
x=input() will do the job ..remove raw_
how to use this for 4 wheels ?
Its comming error like this name 'raw_input' is not defined
when I run the program it gives error on line 24 can you help me
@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
4 жыл бұрын
@GingaFox yeah we found the reason like 20 seconds after i wrote the comment
@lebigboi3615
4 жыл бұрын
GingaFox oh yeah, it was this exact error.
@frederickrichard1718
4 жыл бұрын
@@lebigboi3615 change raw input to just input she probably coded it in python 2
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
4 жыл бұрын
change the "raw_input" line 18 to "input"
Can i use a tamiya motor ?
@MakerTutor101
5 жыл бұрын
Yes
@felixianohansrenee1437
5 жыл бұрын
@@MakerTutor101 it is safe with tamiya stock battery as power source? Tamiya motor t needs 2 ampere to run
x=raw_input() has error in my case. plz check
how to control 2 dc motors?
Great video! God bless. Always remember that Jesus Christ loves you and is Savior!
12 V power supply ground and raspberry pi ground burnt the board !! why ???
Where do I find the wires
how to controle the speed of the motors?
@pritamnagdeve2299
3 ай бұрын
Please send me the correct code
@pritamnagdeve2299
3 ай бұрын
If your code run, then please send me the correct code
This would be perfect to make a vehicle but I would need 3 or 4 of them
How to control motor with Blynk.apk??
what p.start() does
@dainiusjaraminas6412
5 жыл бұрын
p.start(25) set FIRST attempt to run to DC power 25%
Mam ap job kya karte ho?
Verbal commentary would be very useful.