OLD:Raspberry Pi - How to control motors...

Поделиться
HTML-код
  • Опубликовано: 23 окт 2024

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

  • @jan-willemschoonen241
    @jan-willemschoonen241 10 лет назад +1

    Thanks Raspberry PI Guy! Your tutorial is very clear and concise and to the point. I think many people will find the tutorial inspiring and useful. And therefore a well meant thanks is more than deserved here. I will try and use this information to develop an autonomous gps controlled boat. THANKS

  • @RickPassio
    @RickPassio 8 лет назад

    Just bought a PI and have no Idea what I am doing with it. The tutorial was extremely helpful. Thank you.

  • @MrNorfarm
    @MrNorfarm 10 лет назад +1

    This is the best video for the L298N motor controller board. Thanks PiGuy

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

    This video is great and really helped me out, so thank you very much :) The only thing that I noticed is that in the video, you suggest that the +5v power on the L298N board is needed to supply the bridge with power (in which you did using the +5v power GPIO pin on the RPi). This video is the only resource on the net that claims that +5v is needed to supply the board, as all other information states that the +5v pin on the l298n bridge is to output a voltage to other peripherals. I tried out the l298n without supplying the +5v as stated in the video and the chip performed as expected and did not need it. Just to let you all know :) Good work!!

  • @tigermanno1
    @tigermanno1 10 лет назад

    Excellent tutorial! Sound and picture is very good. Pacing is good and subject matter is very interesting. I wish all Raspberry Pi/DIY electronics videos were like this. A genuine joy to watch :)

  • @PeterNerlich
    @PeterNerlich 10 лет назад

    Pretty great tutorial! Don´t remember ever heard something so clearly understandable explained. You´re doing best!

    • @PeterNerlich
      @PeterNerlich 10 лет назад

      btw.: Wow! I wrote exactly the one hundredth comment?? :D

  • @sonick808
    @sonick808 11 лет назад

    i have 5 pi's doing work around the house and yard, and still need more. they are wonderful

  • @johnmiles2070
    @johnmiles2070 10 лет назад

    Outstanding tutorial. Well documented, well spoken, and professionally presented.

  • @bhouldsworth
    @bhouldsworth 10 лет назад +2

    Thanks again. Just spent time with my daughter converting a small robot using this. We used two wheels (easy enough) and, other than being a little under-powered, it worked great.
    I didn't want to have anything connected such as a keyboard so I set up SSH so that I could remote into the Pi and run the programs using Putty from my Android tablet. Look ma! No hands!

  • @bhouldsworth
    @bhouldsworth 10 лет назад

    Thank you so much. This is an excellent step by step guide.
    I have an older robot built with some old power screwdriver motors but we had to control it with switches and walk behind it. That robot was built with my Son and now I'm going to use this to update it as a project with my Daughter. This was exactly what I needed.

  • @HenriHellBoy
    @HenriHellBoy 10 лет назад

    Thanks for the effort you are putting in this project....like the Raspberry more and more.

  • @henriquedoria6797
    @henriquedoria6797 10 лет назад

    Great video! Now I got some useful Raspberry Pi concepts that I didn't know.

  • @swapneelchitale1990
    @swapneelchitale1990 11 лет назад

    This is wonderful demonstration of using the raspberry pi. Keep up the good work.

  • @FukeU1976
    @FukeU1976 11 лет назад

    Thanks RaspberryGuy! Love the a somewhat slow but highly educating pace!

  • @mccloud35
    @mccloud35 10 лет назад

    Nicely explained. No details left to the imagination.

  • @cyclessaga8234
    @cyclessaga8234 10 лет назад

    great tutorial, I don't think it was to long, just nice and slowly.....

  • @riffraff7689
    @riffraff7689 10 лет назад

    It's probably not necessary (or advisable) to connect the +5V terminal to the Pi. This is actually a 5V source from the on-board 7805 regulator. Not sure how much surplus power is available, but it should suffice to power a small AVR.

  • @MilanKarakas
    @MilanKarakas 10 лет назад +3

    Good explanation.
    I have one question for which I believe other people may have too:
    How to control speed of the motor(s)?
    This is because sometimes we don't need our robot to run as faster as possible, but instead very slowly - especially when some detector (ultrasound) is attached to help avoid obstacles. If speed is too fast, then robot will bump into obstacles too often.
    Than you in advance,
    milan
    ---

    • @KKuurus
      @KKuurus 10 лет назад

      loop delay the output of the PI.

    • @MilanKarakas
      @MilanKarakas 10 лет назад

      KKuurus I am not still sure delay what? To make short pulses, then delay? Or, something else? Or to use PWM? Does this device has PWM at all?
      Sorry for too many questions, but before to make decision whether to invest money into this 'toy', I want to know what exactly I need for robot (I have plan to make one, maybe in distant future... low on budget right now).

    • @KKuurus
      @KKuurus 10 лет назад +2

      by looping through a delay before you reposition the servo/stepper you can slow the movement of the motor.
      in the software driving the motor, will slow the movement of the shaft,
      PULSE
      delay delay delay
      Pulse
      Pulse
      delay delay delay

    • @robbin_goat
      @robbin_goat 10 лет назад

      ***** PID will do the work if u know how to use them

    • @superlongnamefive
      @superlongnamefive 10 лет назад +2

      the only way to control a dc motor with 2 wires is to adjust the voltage going through the motor. you can easily do this by making simple 5 transistor circuit on the power supply for the motor and using a potentiometer to controller the current going through the transistors.

  • @hesperion2
    @hesperion2 10 лет назад

    Very useful tutorial. I've been doing some ATM with an Arduino board and components, and I find controlling and programming things from Raspberry PI very similar. I think I will try it when my RPI would have arrived.

  • @braselectron
    @braselectron 10 лет назад

    You are a very good teacher. Thank you.

  • @jeremyhunter2319
    @jeremyhunter2319 11 лет назад

    Hey, I've been subscribed for a while but only recently, after moving house, got an internet connection and thus been able to use my raspberry pi wirelessly. I'm finding it difficult to follow a lot of the instructions. I guess I have a weird learning style in that I find it easier to just get what I need to do to make it work then learn the technical stuff about why it works after, I can never remember the names of things otherwise!

  • @reinhard.sprung
    @reinhard.sprung 10 лет назад

    You don't have to connect the first Enable-A cable from your video. As long as the second is high, the chip is enabled. This is also the input to use with PWM to control the motor's speed.

  • @kbcbala
    @kbcbala 10 лет назад

    Thanks for you time and patience. you got me going in elctronics.
    excellent mate. keep up the good work.

  • @litstw
    @litstw 10 лет назад

    This is the most informative and pleasant, tutorial I've seen in a while. Thank you for being awesome.

  • @dachshunddigital5197
    @dachshunddigital5197 11 лет назад

    I found what I think is a slight issue with your example, enable A/B you don't have to use the 2nd Pin. I followed your setup, both enable A pin 1 and 2, and not using the pin 2, and the results are the same, only the front most pin for enable A/B from board edge has to be set to high. The board documentation suggests that enable A/B are actually already setup for PWM, so setting enable A/B to high, is driving the motor at maximum speed. Have you tried using soft PWM to drive enable A/B?

  • @NazreenAshraf
    @NazreenAshraf 9 лет назад

    Hi, may I know why I shouldn't connect ENA to Pi? Thanks

  • @funonhigh
    @funonhigh 11 лет назад

    If you had 4 wheel attached to 2 L298N's could you set it up to take user input,for example 'left' will stop the left side motors and start the right side ones for say 2 seconds for 90 degrees (ish). If you had a wireless keyboard you could remotely control your raspberry pi to move if you had a user input programmed in. (I'm new to python and I'm not sure if this is possible)

  • @erichsouza
    @erichsouza 11 лет назад

    Great video! Now I've just got a little doubt. If you would add a couple of sensors (like a hall effect sensor), do you have any idea how to do it?

  • @FallenFF96
    @FallenFF96 10 лет назад

    You are literally saving my life! Do you have videos on teleop control and how to program such an interface?

  • @ebenezer-isaac
    @ebenezer-isaac 4 года назад

    Hello Sir, I managed to make the connections and also run the code properly. Thank you very much for the video. But I seem to be facing a problem, the motor gives a few spins (2 or 3 mostly) and then stops, it just doesnt respond. If I reconnect the ground connected to the motor driver or run the script again, it spins again a few times and stops. I have tried multiple tutorials but cant seem to identify the problem. I exactly replicated the wiring shown in your schematics. The motor is powered by 4 AA 1.5V batteries just like in the video. Only time this problem doesnt seem to occur is when I apply 20V 1A DC supply from the adapter and I cant possibly use that 20V coz I want the roboCar to roam freely (not plugged in to the wall).... Can you please help me identify what I might be doing wrong?

  • @dermarcw
    @dermarcw 10 лет назад

    Is it possible to bridge the ENA pins with a jumper, like on one of the photos?
    In my opinion the Motor should be enabled the whole time.
    And now I can simply turn on and off the motor by setting the input pins for the directions on and off?
    So I would have 2 pins more for other stuff...

  • @HighlightWhale
    @HighlightWhale 8 лет назад

    4 battery pack with 4*1.5v = 6v (if you are using non-rechargable batteries).
    Raspberry takes 4.75-5.25 input voltage. Is it okay to give 6 volts from battery pack to h-bridge+raspberry?
    If it so, can I use 4 rechargeable batteries, which will provide only 4 * 1.2v = 4.8v?
    Will it be enough, or should i use 6 battery pack(with 5 batteries), in order to provide 5 * 1.2 = 6v?
    I'm so confused about it, can someone explain me please?

  • @interfaithquest
    @interfaithquest 10 лет назад

    perfect tutorial to start using the PI !

  • @hectorarq
    @hectorarq 11 лет назад

    Robotics for the masses ... thanks mate!

  • @vaughanling1833
    @vaughanling1833 10 лет назад

    Great tutorial..would this setup work for a nema 17 stepper motor for a 3d printer?

  • @JonathanKlingvall
    @JonathanKlingvall 11 лет назад

    I'm doing a project in school where I want to be able to use the Pi to unlock a locker in some way. Is it possible to do this using a L298N? I'm completely new to programming.

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

    thanks for the detailed explanation.. made it easier for a noob like me

  • @TeoZarkopafilis
    @TeoZarkopafilis 10 лет назад +2

    Does it matter which GPIO pins we use to give input? (I mean , can we use different combinations?)

  • @arunrajput7947
    @arunrajput7947 10 лет назад +3

    nice tutorial for beginners.....

  • @Nate072
    @Nate072 11 лет назад

    I always wanted to make a Pi robot, thanks for uploading this!

  • @KatieKTLG
    @KatieKTLG 10 лет назад

    If you are using 2 motors do you need a higher voltage from the battery or will it just run out faster?

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

    Could you use this if you wanted to control 5 or 6 motors? Also if you have more than 1 motor control board do you have to ground the Pi into each?

  • @302RELL
    @302RELL 11 лет назад

    Is it possible to control any type of motor with a raspberry pi or arduino? I would like to use the actual claw machine from a real arcade machine, would I be able to control the motors on the claw gantry(x-y)? They look like dc motors.

    • @lessedu
      @lessedu 11 лет назад

      yes, just follow same procedure as noted on the earlier vid. thanks

    • @302RELL
      @302RELL 11 лет назад

      lessedu thanks!

  • @GrowlyBear917
    @GrowlyBear917 10 лет назад +1

    11:31 one of your AA cells disappeared from the battery holder. Where did it go?

  • @TheMatiancai74
    @TheMatiancai74 10 лет назад

    Really good tutorial this. I shall have to source these components and have a go. Thanks for making this easy to understand.

  • @mehdiachouri
    @mehdiachouri 10 лет назад

    that was really very detailed video, i'm not that much into programming but i got everything you said, really good job. keep it up, thank you.

  • @sebangel13
    @sebangel13 10 лет назад

    muchas gracias por tan explicativo video te lo agradesco muchisimooo por hacerlo fue de mucha ayuda!!!!!!

  • @AverageSubscriber17
    @AverageSubscriber17 10 лет назад

    Would it be easier and/or more efficient to control motors that are connected to arduino but controlled by raspberry pi. I've already successfully done this but I was wondering if excluding arduino and only using RPi would be more beneficial. I'm working on converting a RC car into a car that will connect via wifi to be controlled by inputs on my computer and receive a live camera feed and later I plan on making the car autonomous by adding sensors.

  • @eddieunderhill6386
    @eddieunderhill6386 11 лет назад

    Excellent video. Well demonstrated. More of the same please.

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

    Super great explaination, but i don't know why, mine is not stop with CTRl C, it just continue spinning, so where i can find another tutorial to set speed of the motor?

  • @obwonkonobe
    @obwonkonobe 10 лет назад

    is it possible to do this with an arduino? If so, can you use pins other then the pwm ones, or does it not even matter?

  • @GMTuca
    @GMTuca 10 лет назад

    hey, thanks for the video!
    Is there a way I can power the raspberry pi from the same battery pack as well?

  • @HTobias
    @HTobias 11 лет назад +8

    Is there a way to use 4 motors at once?

  • @the77bear
    @the77bear 11 лет назад

    cool Video !!! How can i control also the speed of the motor(s). Does it work with a joystick ?

  • @sshashlan
    @sshashlan 11 лет назад

    A pleasure to see your videos as always

  • @bulentkoroglu7009
    @bulentkoroglu7009 8 лет назад

    very very nice sharing
    thanks so much
    we are waiting your new projects

  • @chriswhitehead
    @chriswhitehead 11 лет назад

    Have you tried playing with stepper motors yet? If you have a tutorial for those it would be great.

  • @MrOpenGL
    @MrOpenGL 10 лет назад

    Can we control the speed of the motor with this board? Can the RPi do PWM?
    BTW Great video, as always!

  • @freedream0511
    @freedream0511 10 лет назад

    Nice tutorial! That exactly what I need. But I tried and found the rpi can't work however. When it started screen can print some messages, Particularly the network module can't work, neither wired or wireness. And the power I use is 12V. So I doubt the gpio 5V if whether can as the power input? I also see the circult diagram, it didn't has a diode, then I can't how to do next, appreciate for any advices.

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

    Thanks,
    Could you please tell us how to do the same thing but with controling the motor via the internet.
    Let's say i am in a city and my pi is in another city.

  • @ofeyofey
    @ofeyofey 11 лет назад

    Are all L298N Modules the same? The one recommended here is sold out on ebay so is this one ok, the Dual H-Bridge Motor Driver L298N Module For Arduino PIC DC Stepper L298 Board, even though it is for an Arduino? Thanks

  • @tylergriffin333
    @tylergriffin333 10 лет назад

    Thanks for the video pi guy. Watching this video inspired me to start a robot of my own. I'd always wanted to do so with one of my pi's, but I always assumed it'd be too expensive and/or difficult. My first iteration is here: Raspberry Pi KNEX robot

  • @JNinMC
    @JNinMC 10 лет назад +3

    so you made it control a wheel but how would you get it to control multiple wheels?

    • @jonathanmertz4677
      @jonathanmertz4677 10 лет назад +3

      Use the A side (ENA, IN1, IN2) connected to one motor and the B side (ENB, IN3, IN4) connected to the other.
      Note the "back enable pins" are not Enable at all, but +5v. You may jumper between the front and back to permanently enable that motor, or connect the front Enable pin for each motor to the Pi. Do not use 4 wires for Enable, only two, connected to the front pins, the ones even with the IN row.

    • @aceofclubs331
      @aceofclubs331 10 лет назад

      he did mention you could use input 3 and 4 for more than 2 motors

  • @BluBird1598
    @BluBird1598 11 лет назад

    Thanks for the Video! It was very informative and gave me a starting bases for my
    robot project at school, but for my project I need to control 6 motors. As far as i'm aware I need to use 24 gpio pins to control them all, however the pi only has 17.
    Do you have any solutions? Thanks in advance.

  • @samgrabia
    @samgrabia 8 лет назад

    welcome back to another raspberry pi tutorial with your host harry potter

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

    OK :) It is a good video If you are Matt Timmons- Brown Learn Robotics with Raspberry Pi ....Problem...Chapter 3 page 62 to page 66.. You lost me and maybe a few others on this exact wheel motor on wiring in your book both wires are red. Not sure why one isn't a black or blue to show the difference between the positive and negative hook up. I am sure this matters in some way Let's go with page 62 Neither the motor or the wires tells me which is positive or negative I'd rather know then guess any tips?

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

      Hi Scott! Thanks for your question - you can reach me at my email address or on Twitter more easily in future though.
      Just taken a look at that page and you don't need to worry. DC motors like these do not have a particular polarity, and so you can run electricity through them either way. In actual fact that's how you get them to go forwards or reverse - electric current one way or the other. That is why both of the wires are red in my book - the orientation doesn't matter.

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

      @@TheRaspberryPiGuy ok thanks but does each wire go to a positive and negative on the bread board ?

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

      @@scottrocket3274 it is the same deal with the motor connections on the breadboard - the polarity and orientation of the wires is not important. Hope that helps :)

  • @QUEdotCOM
    @QUEdotCOM 10 лет назад

    Excellent tutorial. Thank you.

  • @chrisgibson18
    @chrisgibson18 11 лет назад

    I have a robot that has 2 6V motors (pololu.com/catalog/product/1060) and would like to achieve what you did in this video. I will be using a raspberry Pi. Can you recommend a servo board that I can use? Or will the one in the video be enough to power both the motors that I have?

  • @sledgehoe
    @sledgehoe 11 лет назад

    Wouldn't it be possible to simply put a jumper on the "EnableA" Pins to enable it?
    Because i saw a picture of this board with jumpers on it.

  • @robinkarpeta441
    @robinkarpeta441 11 лет назад

    Very interesting and clear video. Thanks!

  • @AshishPatel-sg1do
    @AshishPatel-sg1do 4 года назад

    If you have connected 5V from L2298N Motor Driver to Pi. Why are you again powering up Pi with USB cable?

  • @JustinNinan
    @JustinNinan 11 лет назад

    Loved this video! waiting for more advanced raspberry pi based project videos:).

  • @soyol88
    @soyol88 10 лет назад

    Can you also provide a demo on how to connect a Step Motor to the raspberry pi? :)

  • @xeonnnnn
    @xeonnnnn 11 лет назад

    Very nice program; but what if you have 2 motorboard-controllers, you only have 1 5v pin?

  • @SpellcasterLegendery
    @SpellcasterLegendery 10 лет назад

    If You Have Two L28(Whatever Its Called)
    How do you connect two wires from the same Pin(E.g Pin 2)

  • @Nate072
    @Nate072 11 лет назад

    Would you consider making a tutorial on how to stream live video/images from the Pi camera?

  • @JVIazRamen
    @JVIazRamen 10 лет назад

    Could you also program/connect an input on the raspberry Pi ?

  • @4211video
    @4211video 10 лет назад

    Why would you put pins into screw terminals? It looks like that board has pins right next to the screw terminals you can use to power it. Also why are you wasting two GPIO pins on "enable A" when you can just hard wire them (this is even shown in one of your stock photos -- you can clearly see someone simply just put a jumper over the enable pins!)

  • @RyanRuckley
    @RyanRuckley 8 лет назад +1

    But by using two GPIO pins for the enable you chew through a lot of pins. I'm controlling four motors identical to yours so I need to economise. I'm only using two pins per motor. I hold one low and PWM the other for forward and round the other way for reverse. On the driver the enable pins are jumper end together. Easy.

    • @vikasnar
      @vikasnar 8 лет назад

      Thanks fro sharing , How are you using one PWM signal from one pin to change the direction ?

    • @RyanRuckley
      @RyanRuckley 8 лет назад

      +vikas narang as I said, I'm using two pins. One acts as the ground and the other has the PWM signal. Swap for the other direction. The swapping gets done in code. So I've used 8 pins total for 4 motors but I can control them all independently.

    • @vikasnar
      @vikasnar 8 лет назад

      +Ryan Ruckley gotcha ... i didn't undertand the pin swapping part the first time.thanks a lot for replying

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

    Hi. Thanks for video. Please say how I can controll speed motor on l298n. Thanks

  • @Tamilitnews
    @Tamilitnews 10 лет назад

    Very good job mate. God bless u
    Pradeep
    Live u (pvt) ltd.
    Sri Lanka , uk (Bromley )

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

    why are you connecting two ENA pins seperately?

  • @delsonjrdd
    @delsonjrdd 10 лет назад

    so i want to control a RC car motor speed, so i need more, power can i simply replace the battery source with the rc cars battery pack, it uses a "Lipo Battery 1500mAh 7.4V 2S 25C"

  • @brezneyviegas27
    @brezneyviegas27 10 лет назад

    Is there a way to centre a motor i.e. if you are using it for steering a car ?

  • @obwonkonobe
    @obwonkonobe 11 лет назад

    hey great vid! but 2 things, 1 how do you wire up 2 motors, 2 can you put the source code in the disc? thanks!

  • @Cydermaster
    @Cydermaster 11 лет назад

    Another excellent video - thank you

  • @Jdiddy1792
    @Jdiddy1792 10 лет назад

    Please explain what the point of this is:
    pin 7 -> A enable 1
    pin 11 -> A enable 2
    Code:
    gpio.setup(7, gpio.OUT)
    gpio.setup(11, gpio.OUT)
    gpio.output(7, True)
    gpio.output(11, True)

  • @phuvo925
    @phuvo925 10 лет назад

    i see amazing, but, how doing combining between library opencv with bcm2835 to control motor?

  • @ChrisKaspar
    @ChrisKaspar 10 лет назад

    Can you control motor speed with the L298N or is it just an on and off function??

    • @themetalsaltine3820
      @themetalsaltine3820 10 лет назад

      You control motor speed with your program in Python

    • @ChrisKaspar
      @ChrisKaspar 10 лет назад

      Thanks, that is what I thought but wanted to make sure the relay would not act as a simple on/off switch. I guess I should have said, Can you control the speed despite the relay.

    • @MJAndersonPhoto
      @MJAndersonPhoto 10 лет назад

      Chris Kaspar The L298N is not a relay... it's an H bridge. A relay IS a simple on-off switch.

  • @cucciolo182
    @cucciolo182 9 лет назад

    Now that it came out the 5$ Raspberry are you going make new projects?

  • @themetalsaltine3820
    @themetalsaltine3820 10 лет назад

    would i be able to use a 1500 mah NiMH battery from a traxxas rc car to power my motors? or would i fry the arduino. Also do you have a video showing how to hook a xbox360 remote to rpi?

    • @reinbert
      @reinbert 10 лет назад

      Depends on the voltage of both the battery and the motors.
      And to hook up a xbox360 remote to the pi plug in the cabled version or buy the wirelss controller for windows/PC

    • @themetalsaltine3820
      @themetalsaltine3820 10 лет назад

      thanks

  • @johnnyzhang6871
    @johnnyzhang6871 10 лет назад

    Is it necessary to put 12V to L298N? Why not us the power on Raspberry Pi?!

  • @sturgelikethefish
    @sturgelikethefish 11 лет назад

    do you not need to use diodes across the motor then?

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

    Is there a way to do this with an ESC and an AC motor ?

  • @cyclessaga8234
    @cyclessaga8234 10 лет назад

    my motor is working fine most of the time, but sometimes it is making a buzzing sound and it is not rotating. Does anybody now why?

  • @NayarJoolfoo
    @NayarJoolfoo 11 лет назад

    The pins retain their states when the program exits. You should kill the program when the motor is sleeping idle for the 2 seconds.

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

    Nice!👌
    How put push button ?
    Thank you👏

  • @Hyttelus
    @Hyttelus 11 лет назад

    Will you please make a tutorial about uploading to YT using the Raspberry PI?

  • @ShashankVerma1
    @ShashankVerma1 10 лет назад

    Can you use L293D instead of L298D ?

  • @williamscammell5460
    @williamscammell5460 10 лет назад

    Thanks this helped lots.