Arduino Tutorial 35: Understanding How to Use a Stepper Motor

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

Комментарии • 1 тыс.

  • @Seftdelmer
    @Seftdelmer 3 года назад +33

    For those that are doing this with the kit, please note that the supplied 9V battery may not be sufficient to drive the stepper motor (via the driver). When I first tried with the supplied battery, the stepper motor made a noise but didn't turn. I then swapped the supplied battery with a new one, and the stepper motor turned. Thanks to Paul for these excellent videos.

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

      was the new battery any different?

    • @AlexDavis-ch1ro
      @AlexDavis-ch1ro Год назад +3

      Yep, me too. Mine came with a Piscell 9V: obviously not up to the task. Energiser did the trick!

    • @Lucky-ek8tv
      @Lucky-ek8tv Год назад +2

      same

    • @Thejbelow
      @Thejbelow Год назад +3

      Even with a brand new battery it's weak. Can't beat a power supply

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

      Mine worked for a bit and I checked the battery with my most excellent multimeter. The voltage turned out to be a little bit over
      6 V! So I’m surprised it worked at all.

  • @thomasmiller3398
    @thomasmiller3398 2 года назад +67

    Currently in my second year of aerospace engineering at university and have never touched an Arduino or C++ before and was given a project requiring the use of multiple stepper motors, sensors, buttons and LEDS and I cannot stress enough how much these videos have helped me. Thank you so much for making such high quality free material! I know there will be others like me in similar situations and your videos will have saved them as much as me.

    • @zvone908
      @zvone908 Год назад +3

      Hi, I'm thinking about studying aerospace engineering after high school. Can you recommend any books worth reading, or give any advice other than that?
      Thanks in advance :)

  • @peterknoll8906
    @peterknoll8906 8 месяцев назад +4

    I know it's an old video. I don't know if you read the comments here.
    I did the homework as you said, without having seen your solution to that.
    I did a attach.Interrupt and with it i called a function "reverse", ive made.
    In this function, i reversed direction.
    My quick and dirty way of spinning infinitely in the main loop, was to start of with "while (true)"
    It's at least a very short code, by having the same outcome.
    I've did a INPUT_PULLUP command on the pinmode. That works great.
    Thank you Sir, for your educational videos.
    Ive learnt a lot from you!

  • @mxcollin95
    @mxcollin95 5 лет назад +143

    This channel is a gold mine! I’ll definitely be working through your arduino and RasPi series!!! Wish I would’ve had a teacher like you when I was in high school. 👍

  • @JonPeroutka
    @JonPeroutka 2 года назад +30

    You, sir, are the Bob Ross of engineering. Thank you for your great tutorials.

    • @mau19885
      @mau19885 5 месяцев назад

      so on point! stealing this since I tell so many people about him :)

  • @bjornakeSwe
    @bjornakeSwe 3 года назад +6

    I'm a retired swede of 71. I've been an engineer for 50 years. My first experiece with computers was my Commodore 128 and Basic. I do remember the com speed of 9600 and sometimes even 2400. After that it has mostly been hardware. I discovered the Arduino and got interested. I stumbled on your videos and was hooked. After watching a number of them I realised I had to get the Super Duper Kit. So it is ordered but not yet received. So far i've watched your videos to the end, but programming them in my head, so when I get my kit I think I must start from scratch and do it irl. I've also noted that you have videos about RasPi and Python, so I don't need to be bored for a long time. I have a number of ideas that can be solved with the Arduino and some coding instead of a bunch of CMOS/TTL IC's. Like so many others in these comments i wish I had a teacher like you at school.

  • @MatlasX
    @MatlasX 4 года назад +116

    This is definitely one of the lessons where you could have probably spent a bit more time explaining how the stepper motor works in this particular case. Pins 8, 9, 10 and 11 were used, but really not sure what they do.

    • @misterdecaro
      @misterdecaro 2 года назад +4

      I agree, I'd like to know more details about why those specific pins and why the order of pins 9 and 10 are swapped in the Stepper setup call.

    • @jafaralturfy5053
      @jafaralturfy5053 2 года назад +12

      The stepper motor has 4 coils each coil is connected to 5v through these pins.

    • @syedsajjadali4220
      @syedsajjadali4220 2 года назад +3

      @@jafaralturfy5053 thanks mate

    • @chadmorreale
      @chadmorreale 2 года назад +3

      @@misterdecaro I believe this is just due to the ribbon cable and wanting to put them in order physically on the connectors.

    • @davidransier
      @davidransier Год назад +7

      OK, not so sure this comment will be helpful, but here goes. I read the Documents included with the Elegoo kit and it says the four pins are a four-bit code to the stepper. That says to me that they should be in order. I confirmed this by reading the Stepper.h file (found in Github). However, when I put the in numerical order the motor only spins one direction, regardless of the Step value. When I SWAP PINS 9 7 10, the direction swaps correctly when I push the button. Bottom line, we need more info from Paul M!

  • @gusmon83
    @gusmon83 2 года назад +4

    That last bit there put into the void loop threw my brain a curveball. Finally figured out it was "buttonValOld=buttonValNew;" as the last line of the void loop. Paul, I've been bingeing these lessons and crushed 35 in three days. You've done an incredible job, here. I knew nothing but was able to follow until you said "pause" AND THEN able to program this in my own way, unfortunately vastly different and of course with different results than you were able to provide here. Things happened, but it was still on delay and made a full rotation and then reversed. Invaluable lessons. THANK YOU!

  • @ericroque5813
    @ericroque5813 7 месяцев назад +3

    For those who had trouble doing this, take note of the right sequence of pin declaration which is 8, 10, 9, 11 as this is the right sequence for half step. I put the pin number in ascending order thinking it was just as simple as naming the pin number as I plug it in the arduino board. But no, the right order mattered. Took me a while to figure this out.

  • @misterdecaro
    @misterdecaro 2 года назад +4

    Before watching this, I just want to say that I wasn't sure if I was going to 'bother' going back to watch you first series, your 'lessons' on Adruino. But now I can say that I will definitely go and watch them also! I was looking for something specific and I found it in one of the lessons and, I have watched a couple of others too! At any rate, to my fellow followers/subscribers/learners, the first set of lessons Paul offered is definitely worth your time and effort. Thank you Mr. McWhorter!

  • @bm5211
    @bm5211 4 года назад +18

    Thank you so much for these wonderful tutorials! As an ecology student, I have never in my life touched anything to do with electronics or mechanics before watching your Arduino series. But now, 35 episodes later, I am amazed to say I can still follow along with everything. :) Every time you introduce a new part I get so many ideas for hobby projects! I genuinely never thought I would be able to understand anything to do with wires and circuits, but your explanations have made the impossible possible. Thanks again, you're the best!

  • @ancienttechnologiespinball1690
    @ancienttechnologiespinball1690 9 месяцев назад

    Hello Paul.
    I'm an Electric Mechanical pinball technician from Toronto, Canada. I built a pinball machine using parts from the '70s, but for mass production i need to use Solid State Electrictronics. That's why I'm here.
    Yes, i watch every video to the end, more than once. I take screen shots of coding and try not to look at the pictures later, but normally need to because I'm still learning the language. Same with the math. I failed math in high school and happy to learn it now.
    The wiring comes naturally to me. i've always been good with electricity and mechanical thing.
    I find no part of videos boring . Thank you for making them.
    My board broke down this morning, so while I'm waiting for a new one, I'm gonna start watching again from episode 1 and see if i can call the shots before you make them.

  • @rogthedodge99
    @rogthedodge99 4 года назад +3

    I did it using lesson 28 as a base. My motor only reversed when it had reached 1 revolution because I'd left
    the number of steps at 2048. My stepper direction was based on the button val. I now realise you can step 1 at a time, and in the same direction until told otherwise. Thanks Paul. It really is worth trying things yourself first, even if it's not quite right.

  • @sampleexamplemusic
    @sampleexamplemusic 3 года назад +10

    GIDDY UP. ok this dude rules. going back to the beginning and watching all of these because he's an awesome teacher!

  • @TheSelfUnemployed
    @TheSelfUnemployed 2 года назад +8

    Unable to complete the homework on my own but grateful for the lesson! Thank you Paul!

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

    I'm a retired electrical engineer, following your videos for the fun of making a device follow the projects. I made this work, in a similar manner to how you taught us to toggle with the buttons. That was more elegant than my last attempt. (Sorry I haven't waited to get to the end of the video to get the magic word.)

  • @tretty07
    @tretty07 4 года назад +6

    Racked my brains for a couple of hours trying this one, I got it to change direction but only after each full turn, excellent lesson, learning something new each time.

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

      Sorry, super late reply, but decrease the amount of steps between each check. Heck, you can have it check after every 1 step.

  • @wayneandersen7596
    @wayneandersen7596 4 года назад +1

    I did it. I only had a couple of differences. I did 10 steps per loop and I changed direction on button release instead of button push. Thanks for doing this series!

  • @sandeepjadhav3565
    @sandeepjadhav3565 4 года назад +11

    I am following you since lesson 1, and i would like to say I was able to do homework on my own. thanks to you.

  • @emiliomartineziii2980
    @emiliomartineziii2980 Год назад +2

    For anyone who is having trouble try using a 12V supply instead of the 9V battery. When I did it with just the battery from the kit, it didn't work, but when I took two double A batteries, put them in series with the 9v battery from the kit, and then used the total 12V supply, it worked!

    • @thebrewsterblock
      @thebrewsterblock 8 месяцев назад

      Hey Emelio. Having the same problem even with a new 9v. Where is the 12 v input? Or did you feed 12 thru the 9v?

  • @stefstaf
    @stefstaf 4 года назад +6

    These are invaluable lessons and thank you Mr. McWhorter for taking the time (and the pain) to make them for our benefit. The synchronus presentation of the code, the printout and the experiment makes these lessons the best you can find in the subject. I had a little difficulty understanding the stepper commands that came out of nowhere but then I realized that these commands are hidden in the accompanying libraries. If you intend to devote one of your wonderful lessons in explaining Arduino librabries and how they "generate" the new commands we would be for ever grateful sir.

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

    I managed it, looked back on the old button toggle code to help remember what I did back then. My only problem was leaving the number of steps at 2048, and the delay of 500ms - it almost never read the button. Then I cut it down to 10 steps and shorter delay and it worked better. My code inside the if statement was direction=-direction. Thanks for another great lesson. It's been a while, but I've been having fun with the other stuff I can do!

  • @CarolinaDGF
    @CarolinaDGF 3 года назад +4

    Thanks to all the instruction leading up to this video, I was able to do it on my own. You are a great teacher, Paul. The only thing I struggled with was getting the first part to work at all. As soon as I would plug in the stepper controller, the light would go out on my power supply. Turns out the battery in the kit did not have enough power. Glad I ordered a 9V Arduino wall wart when I ordered my kit. Plugged it in and all was well. (All was well after spending several minutes checking my wiring before pulling out my volt meter to see what the battery was not putting out enough power....)

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

      thanks man I think I have the same issue lol

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

      I'm glad I found this comment so I didn't have to pull out my meter lol! Had a rechargeable lithium 9V laying around from my pro sound work and everything is working now! Man, the brand new provided battery lasted about 30 seconds hahah!

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

      Same problem here, no name batts are notorious for being junk. The updated link leads to a larger kit (The Most Complete Starter Kit) which includes many more parts (twice the price) including the wall wart.

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

    I have just been copying you as you go because, I've picked up the lessons again after some time away. Trying to let my brain get refreshed! Thanks for another great tutorial.

  • @donaldtroll7537
    @donaldtroll7537 3 года назад +12

    The battery from the kit died within a few minutes and made me think I unplugged something. Plugged in a new battery and everything worked. Another great video, Paul.

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

      same here. Luckily I found the culprit with a voltmeter

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

    Pay very close attention, I spend 2 hours figuring out how important the numbering on the stepsPerRevolution definition is, if you use 8,9,10,11 instead of 8,10,9,11 your motor will only run in one direction ;-)
    Afterwards tried the homework, but failed.
    Thank you Paul for you time, you are a gem to this world. You opened my mind to so many new options!

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

      THANK YOU! I've been trying to figure this out for an hour

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

      Thank you, good sir! I guess I must be dyslexic

  • @dash8944
    @dash8944 4 года назад +3

    If any of you are having issues getting the stepper motor to rotate, try swapping batteries - the one that came with the kit didn't work for me.
    My motor was vibrating but not rotating (the LED lights were not coming on either).
    Hope you find this friendly advice helpful.
    (Thanks Paul for your amazing videos btw)

  • @vandanasrivastava2028
    @vandanasrivastava2028 4 года назад +2

    I am from class 6 and during this outbreak I have learned how to code and use an arduino board. Thankyou sir for teaching like this.

  • @27prajjwalprasad43
    @27prajjwalprasad43 4 года назад +4

    I did it on my own but in a muuuuuch more complex way. I was shocked to see that you made it work in just 5-6 lines of code!!!

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

      Hi could you please send me your work to wrekjohn@gmail.com

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

    Took me 2 minutes to do the assignment, I notice that being an experienced developer helps a lot even though I am totally new in the electronics part.

  • @Panvil
    @Panvil 4 года назад +4

    I did it on my own, but made it way too complex. Thanks for the great lesson Paul. Much love.

  • @ghaniyyahmbello4393
    @ghaniyyahmbello4393 Год назад +2

    Mr Paul, your tutorials are really interesting and educative, breaking down every little detail. Thumbs up for the good job.

  • @karelenmarritkruyswijk393
    @karelenmarritkruyswijk393 5 лет назад +9

    Who wouldn't get exited for electonics looking at these video's... Thank you. Thinking about using the stepper motor for domotica opening and closing curtains depending on time of the day if possible.

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

      could use in conjunction with the light sensor. Auto Open curtains in the morning, close in the evening. Good security gadget for when your away?
      Would need to pick values carefully, would give the game away if they kept closing when a large cloud obstructed the light. :)

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

    One those projects where there are three things to get working and you can always get any two at one time. I was running first time with two but it took another three hours to get all three.. I was delighted to get the result. Writing code is always about thinking differently and learning at the same time. We are down to 4K likes so I guess this is the hard core that will persist. Good to know that there are that many people out there who will go the extra mile rather than skip reading and looking for quick fixes. With development I have found that in designing the current project you always need to think about how this will lead into its successor. Taking short cuts that will eventually become long cuts as you box yourself into a corner!

  • @satisfactoyz
    @satisfactoyz 3 года назад +3

    I wasn't able to figure it out, sad to say. I made it switch, but only after each command cycle finished. I didn't realize you could get continuous movement by multiplying by 1 and -1. Anyway .... it was an eye opener. Thanks again, Paul.

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

    I had the same experience as several on this video- the 9V battery that came with my kit died very quickly. BUT I didn't realize that since I heard/felt the stepper motor sort of kind of doing something, and went too quickly to the conclusion that my stepper motor was 'bad'. Glad I saw others posting that changing out the 9V worked. Did the trick for me!

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

      Nice troubleshooting. Always suspect bad connections and batteries before anything else. Seems the components themselves are rarely the culprit. Thanks for the comment.

  • @miketurley9277
    @miketurley9277 3 года назад +3

    Hello Paul, I appreciate your lessons. You have inspired me to learn this stuff in sequence not just dig around for what I am looking for. The kit definitely makes this easier than digging through my junk. I hate digging!
    I wanted to share a bit of my own knowledge with you.
    Although there may have been another comment or possibly just messing with some of the electronics newbies but either way ROHS isn't the MFR (I beleive this device is from Kiatronics). of the motor it is a qualification for hazardous materials used in the manufacturing process of stuff, usually electronic components. ROHS compliance was a standard that started in the late 90s-early 2000s. I hated the PB free solder, it just doesn't flow like the old stuff...

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

    I was able to do the "homework" on my own. This time through the series, I've been meticulous about saving old programs. Every time we have an assignment that references something we've done before (like the toggle button in this assignment), I open the older program and try and figure out how to adapt it for the new use case. Occasionally, I'll actually have to go back to the lesson where it was discussed (for example if I don't remember how to set up the circuit) but thus far, the code is usually enough to jog my memory. Several programmers I have talked to have told me that knowing how to adapt existing code is almost as valuable as writing that code the first time and I took it to heart.

  • @christopherchance4860
    @christopherchance4860 4 года назад +3

    Where were you when I was in High School?
    Thank you for your enduring hard work, I have learned so much from you and your tutorials

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

    I was able to do it. And I really want to thank you for your work, it's the first time I can do something only with lessons given on youtube.

  • @gitarlos
    @gitarlos 5 лет назад +23

    the elgo driver does not work some times unless you switch IN1 with IN4 .

    • @shatann
      @shatann 4 года назад +2

      That's right! How'd you figure that out?

    • @thomaseardley2900
      @thomaseardley2900 4 года назад +1

      thank you bro you saved me hours of trouble shooting

    • @godwincornelius6285
      @godwincornelius6285 4 года назад +2

      Wow what a life saver..... I wish Paul would have mentioned that... Thanks a lot by the way.... Because the stepper motor was misbehaving

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

      Well it didn't work too

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

      Don't do this it may damage ur driver
      Mine didn't work too and I used ur method and it worked but when I changed the code to stepsperrevolution/2 it didn't work
      Instead of doing that change ur battery my problem was battery

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

    This is my favourite lesson so far, so much of what has been taught over the past few lessons, all came together and made perfect sense.

  • @lordstelanthin
    @lordstelanthin 4 года назад +21

    I did this one on my own, but wow did I overcomplicate it.

  • @gghutton
    @gghutton 4 года назад +1

    I spent 3 hours trying to figure this out on Saturday. I knew I wanted to change directions with multiplication with a '-1'. I also went back to #34 to see how the button was set up. I also added a RED and YELLOW LED lights to show which direction the motor was spinning. So I did come back here to follow step by step.

  • @michaelcostello6991
    @michaelcostello6991 4 года назад +24

    My battery died almost immediately. Lucky you warned us so we didnt panic and measured the voltage to confirm.

    • @jimmyjimmereeno3341
      @jimmyjimmereeno3341 4 года назад +3

      Same here. The low-cost battery that comes with the kit lasted less than 5 minutes. I was afraid that the motor or driver board had fried.

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

      @@jimmyjimmereeno3341 yup i had the same exact thing the battery went out so i hooked up a extarnal power suply that can go to the net

  • @erikburman530
    @erikburman530 2 года назад +2

    I'm so glad I stuck with this and figured it out on my own. I went through so many wrong turns but when I finally realized how to make it work the solution was so simple I had to do a facepalm! Very rewarding! And now, on to session 36.

  • @jefejc
    @jefejc 3 года назад +3

    These lessons are making me think hard but that's good for my old age

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

    I wish that all RUclipsrs had your ability to understand a student’s perspective and have the ability to thoroughly teach every step in the process.

  • @MahBor
    @MahBor 3 года назад +4

    When the stepper motor starts moving, some components on my breadboard power supply module start heating up to the point where they burn my fingers if I touch them. Is this normal? I'm really worried and don't wanna burn my module so I've stopped using the stepper motor.

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

      You are probably running more current in the components that you should be doing and that is why it’s heating up

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

    Love it - Due to the gear reduction system inside the little stepper motor, the actual steps per rev works out to be 32/9*22/11*26/9*31/10*32 = 2037.8864197530864197530864197530864197530864197531
    I'm having fun and watching all of your videos --- Thanks Mal

  • @pranavshool
    @pranavshool 3 года назад +3

    Yeah, I did it by using different logic!

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

    Had a little trouble with getting the stepper motor commands correct. Failed the homework assignment but gave it a good try. Steeper motors are so important for good projects. Thanks for sharing your knowledge for FREE on these videos.

  • @KisorcererAMP
    @KisorcererAMP 4 года назад +9

    For the life of me, I could not understand this one. I've rewatched the toggle video multiple times and it seems that when a project involves toggles I struggle.

    • @garysenier2440
      @garysenier2440 4 года назад +1

      me too

    • @favesongslist
      @favesongslist 4 года назад +1

      You could try using two buttons for now to prove the stepper motor sketch, one for clockwise and one for anticlockwise, and then go back to the earlier tutorial for making a toggle work.

    • @favesongslist
      @favesongslist 4 года назад +1

      ​@@garysenier2440 the trick to understanding the toggle function is that you are detecting the button change from 0 (not pressed) to 1 (pressed) over time.
      So
      step1: read the button, if 0 then lastPress=FALSE
      step2: read the button again and if lastpress==FALSE and the Button is 1 change lastPress=TRUE; to Make sure the toggle only happens once per press.
      change the Toggle state, if it was 0 make it 1, or if it was 1 make it 0.
      Instead of using an int it may help to use a boolean (can be either 0 or 1)
      bool toggleState=0;
      int lastPress;
      int buttonVal;
      buttonVal=digitalRead(buttonPin);
      IF (buttonVal==0){ // Checks if button not pressed
      lastPress=0; // this makes sure the toggle next press
      }
      ELSE { // Do this when button is pressed
      IF (lastPress==0 ) { // Check for only once per button press
      lastPress=1; // stops repeating while button still pressed
      toggleState=!toggleState;
      digitalWrite(LEDpin, toggleState);
      }
      }

    • @karamyounis15
      @karamyounis15 4 года назад +1

      Hey, idk if you still need help with this but I'll try to give it a shot. The original "if" statement reads "if(oldButtonValue==1&&newButtonValue==0){" ; the "oldButtonValue" is defined by you, in this case it's a 1, the "newButtonValue" is defined by this command "newButtonValue=digitalRead(buttonPin);". Now, the "if" statement is not true (the arduino will not run the commands underneath the "if" statement) until both parameters (oldButtonValue and newButtonValue) are met. Since oldButtonValue is defined by you, it is true from the start, and since newButtonValue is defined by the press of the button, the "if" statement will only work when "0" is read, or when the button is pressed; at this point, everything you put in the "{ }" will run. I hope I made some sense.

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

    I finally got it!
    I used the switch, "the old-fashioned way", with the resistor (I forgot the new system), but at the end it worked.
    I had problems with the change of direction; first because I had it at full turn and then because I discovered that printing the values on the screen slowed down the program so much that it didn't detect the press on the switch.
    It was too much work because of my clumsiness, but I finally managed to do it in a similar way as you did, Paul.
    Thanks so much!!!

  • @SarkarMotion
    @SarkarMotion 5 лет назад +31

    "Stepping" up the difficulty I see! This lesson was a "stepping" stone, one might say. Oops! Sorry, looks like I "overstepped" my limits here. 😶😍

    • @VivekYadav-ds8oz
      @VivekYadav-ds8oz 4 года назад +2

      You, sir, have earned my respect.

    • @ramraja7796
      @ramraja7796 4 года назад +5

      MotiOnTech , You have taken a step in a right direction but now you must step back.

    • @minab45
      @minab45 4 года назад +4

      You should be removed from this channel, that'll servo right.

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

      you need to step off with all these puns!

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

      No you didn't, you are just getting started

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

    I had attempted to do it by myself, but my solution was partly correct. And yours is perfect, so yes I did copy you, but after putting in my efforts in the solution. THANK YOU!

  • @Ninethepoet
    @Ninethepoet 4 года назад +3

    21:52 this is everyones reaction when their first line of code works! P A S S I O N!!!

  • @karansunar4458
    @karansunar4458 4 года назад +1

    you are the best teacher i ever seen my life...

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

    I'm working thorugh these tutorials in 2021. An absolutely fantastic resource, thank you! When creating the Stepper I accidentally set the pin sequence as 8,9,10,11 - not 8,10,9,11 as it should have been. This resulted in the motor buzzing but not turning. It took a long time to work out why! If another viewer is haveing similar issues, it's perhaps something to check.

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

      Great job!

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

      im having the same problem as you but your solution does not seem to work for me. When you say set the pin sequence you mean the order in which you plugged the pins in the arduino or you mean the way the pin are listed in the code?

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

      found out what the problem was....the batery was just not having an output of 5v so thats why the controller would not power up :0

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

      @@painfullgaming8667 i have the same problem.. for some reason when I run an empty program the output voltage of th battery is 5V. However, when I run the program of the step motor it goes down to ~2V and therefore I don't see any movement; just a buzz.

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

    You accuse some of us of watching without doing the homework? The way I learn is watching through the series to absorb the concepts. After 35 video's watched and 33 to go I will watch through the second time with the hands on approach. Thank you for your contributions. :-)
    BTW My knowledge and skills with Fusion 360 have become more advanced thanks to your Fusion series

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

    More great Advice from Paul is to always set the serial up for debugging, this helpd me to get the case statements in the right loop.

  • @steveholt8991
    @steveholt8991 5 месяцев назад

    This series is still relevant today. I've learned so much going back to the basics. Thank you very much Paul.

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

    So glad I read the comments. My motor would only spin one direction until I switched pins 2 and 3 on the motor controller.

  • @didifady1641
    @didifady1641 4 года назад +2

    Paul keeps saying that we should have learned these things a long time ago, but I'm learning as a 10 year old! I gotta say Paul, you really have mastered teaching all ages. This set of tutorials are easy to understand, but so, so useful. Thanks. I finally found something useful to do during COVID-19.

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

      The only thing that I'm having trouble with is the math, but that is understandable too!
      UwU

    • @paulmcwhorter
      @paulmcwhorter  4 года назад +3

      That's great!

    • @didifady1641
      @didifady1641 4 года назад +1

      Thanks so much for the tutorials!

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

    This is the first assignment that I was unable to complete. I did not occur to be to multiply by -1 to solve this. While I was trying to analyze what was going on by using the Println command nothing would print until a full rotation was completed. Then all I got was 2048. I kept drawing a blank on how to Solve the problem. I guess I should work on these earlier in the day. Thanks for the simple solution. Keep up the good work.

  • @donthomas9669
    @donthomas9669 4 года назад +1

    I got it on my OWN!!! My confidence is growing!! Thank you so much Paul, you are an excellent teacher, and the best part of my day is coming home and doing these arduino tutorials with you, I look forward to them all day long. I used an if else statement, with a button value variable and a digitalRead command making the button HIGH with a digitalWrite command.I didnt even use buttonValNew or buttonValOld, I just used button val and I used If(buttonvalue==0) then the stepper commands, then else (buttonvalue==1) then the negative stepper commands.

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

    I did Tutorial 35, and did it differently than you did. I liked your coding much better. Thanks for a great series.

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

    since i am following these tutorials using micropython instead of c++, this one was kind of an adventure for me! i almost gave up and just switched to c++ for this lesson but in the end i prevailed! i ended up learning a bit about how these motors work (or at least how to control them electronically) and writing my own motor controller class after i wasn't able to find any that behaved exactly how i wanted. i think my controller class is kind of specific to the uln2003 motor driver, but that's ok
    it also took me far longer than it should have to realize that i needed to change my loop behavior from full rotations to one step at a time in order to incorporate the button press being at any time!

  • @souljr.
    @souljr. 8 месяцев назад

    Took me a while of troubleshooting/looking back at notes (like 30-45mins) but I finally got the program working to a fairly smooth point. I'm sure there's a much better way than what I've done, but I'm just happy to have gotten the homework done without listening ahead! Figuring out where exactly to put the delay( ) command in my program was the tricky part.
    I decided to use do...while loops to make the motor keep going until the button is pressed then change direction. Probably one of the main reasons I was having issues with the proper delay time location within the blocks.

  • @Jim-mn7yq
    @Jim-mn7yq 4 года назад

    Yes, I was able to get it working. But I almost immediately ran into hardware issues. I got the initial stepper motor to turn, but shortly after that the green led on the power supply started to dim and ultimately all lights on the driver went out. Turns out the battery in the kit was almost doa on delivery. As a result, I discovered what Paul mentioned, ie, these motors gobble up a lot of amps and can drain a battery quickly. Also the power supply doesn't seem to operate well with much below 8.5 to 8 volts.
    Once I got that figured out, it wasn't too bad. The hack on the pin was pretty obvious, and for those of us who've followed along, the toggle code was almost identical.
    All in all, a very challenging tutorial. And one I'm sure many of us learned from, including expanding our troubleshooting abilities.

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

    Got the joystick to control the stepper in the y and the servo in x. then I put a red toggled LED on the end of the servo. should have used the Green LED cuz this was s special occasion. You Rock Mr.M

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

    It's amazing for me, totally newbie in the art of electronics, that sofar I can follow and understand everything our beloved teacher says and explains, and more. He even made it possible for me to really be happy about the working of circuits. Through you Magic comes True, Paul.
    But the Stepper-lesson was a hard one. Nothing worked - I controlled all wires, buttons,....no movement of the motor, no lights on the driver. I measured a correct current on the breadboard and the controller though. I read en reread the code and made changes according to reactions of other students, I replaced the battery and even made a direct connection to the arduino-5Vpin. I even filled my cup of coffee with ice-tea. ..Nothing happened. Almost on the point of loosing all my hope, i wondered what those 2 unused pins on the motordriver did. I found out that they were meant for an on/off switch! ....and unconnected..??? so...I connected them and BOOM BOOM BOOM BOOM BOOM BOOOM boooooooM!!!!!!!!!!!!
    Never give up, you guys and girls
    ps shouldn't those pins not be covered by a little cap or something like that - or was i so unlucky to miss that in my Elegoo Super Starter Kit?

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

    Thanks Paul. I've followed every lesson to the end. Done all home work. I'm writing extensive comments in all my programs so that I can understand what I've been doing. Also used the Reference under Help, which has been very helpful. Unfortunately the battery with the kit was lousy. The stepper motor stopped working after a minute. Luckily you mentioned you hade to switch batteries. Now it works again.

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

      The battery is useless. Lasts about 10 seconds.

  • @leokim6831
    @leokim6831 4 года назад +1

    This is the best channel on youtube I hope that I have a teacher like you in my school

  • @destinyokwong2099
    @destinyokwong2099 8 дней назад

    I did it myself sir
    I used a very similar method sir
    Thanks to your lessons
    Steps = -steps
    But I prefer the way you did it.

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

    I did the homework, worked out quite complicated on the first attempt, but then went back and reviewed lesson 27. Much cleaner code on the 2nd go. This one made me think alot!! definatly taught me to think it through before diving in, and work out a flow diagram.

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

    Another easy one. Took the downtime to explore whether the Arduino can be doing anything else while moving the motor. So I'm seeing the value of multi-tasking.

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

    Hi, Paul, I did do this on my own first... but struggled mightily with it for about 4 hours, and ended up with code that was much more complicated and less elegant than yours! It got the job done, I won't bore you with my convoluted code, but what i didn't do was dynamically set the state and rule out buttonVal of 1 all in one shot at the digitalRead of the button, nor did I realize that you could ignore starting a full revolution, but just base it all on one step, looping continuously until the button read got a zero value. So I ended up with multiple nested for loops, returns if the button state had changed, and one set of nested "for"s for one direction and another set "for"s the other direction, with button reads and check for a change in each! I suspected I was doing it with way too much code/complexity, but since I got it to work flawlessly at least, it was only after that that I went on to see what you did. ...and hence learned a lot more!
    Even though I struggled and ended up with a solution that was cumbersome, I still learned a lot by both working through my approach until it worked and then seeing your much more efficient and creative solution, so thanks, and thanks for always encouraging us to try to work them out ourselves first!

  • @johnplowright6421
    @johnplowright6421 5 лет назад +2

    Great lesson, for my "Homework" I got the change of direction but the motor only did one rotation then waited for a button press to start in the next direction. for my pinMode I use pinMode (buttonInput, INPUT_PULLUP); which work the same as your digiatlWrite method.

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

    I did it in a different way and used a boolean value. This homework is challenging for me and took me 4 hours (with some momentary breaks) but enjoyed the process. Thank you Paul for teaching me how to use the Arduino.
    Actually I bought the kit on January and looking for tutorials but I was so hesitant to watch yours because I want to literally go straight up making cool and perplexing projects. I gave up because I don't understand anything. From why is the LED hooked that way and why it has a resistor. Why does the breadboard has + and - rails. Why do you do pinMode in the void setup and digitalWrite in the void loop, and literally everything else. I felt that this isn't for me even though my long-time dream is to work in the robotics field (still my dream as of now). I figured out the reason why it was hard. It's because I immediately jumped to the best part where you apply everything you learn (which for me, none) to make those cool projects. Just like how everyone wants to be like Elon Musk but no one wants to work hard like him. Anyways, this thought of mine lasted until May (4 months after buying the kit). I again saw your tutorials and somehow thought of watching everything, because suddenly I get the feeling that I want to learn. Now I can apply what you taught us from Lesson 1-35 and still ongoing and looking forward to finish this tutorial. Thinking of watching your tutorial is one of the best blessing I got so far in my life.
    Sorry if this comment is too long. It's okay if you don't want to read it. I just want you to know that I made it this far and you are a big part of it. I'm still working with my dream. Thank you!!!

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

    many times through before I realized my push button only works on one side, and my power/ground rails only work halfway across either side. plus a fist full of coding mistakes, several times through, you held my hand the whole way. I thank you so much.

  • @JohnB-r6c
    @JohnB-r6c Год назад

    Was able to almost complete homework. My stepper would not change directions until completion of the revolution cycle. Great Lesson again Sir.

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

    I managed to successfully get the project working (although it did take me a bit of time), and i have to say after using my method, your solution was really neat way of using the negative/positive to control the direction. I used a longer method which i figured out from doing one of my own programs. the goal of that one was dimming an RGB LED individually. Button A would brighten, B would dimm, and C would select which RGB A and B would actually control.
    Basically, after many failed attempts, i ended making button C a glorified counter (0=R, 1=G, 2=B), then loops back (if 3, then value=0). after that, i simply added "if" statements for each value (if 0, A/B buttons control red, if 1 then green, and if 2 then blue). That allowed me completely separate anything each individual "if" statement is doing, and the button press is only strictly in charge of the selection. So basically i ended up making a "selector" switch which i guess will come useful for later later projects since for a simple toggle, it's a bit too much work.

  • @חייםלב-ז7ו
    @חייםלב-ז7ו Год назад

    i did it in a diffrent way, but my method works only with a short click.
    that was a great lesson, thank you very much!

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

    For those it may help my motor was wired a little differently and after some trial and error needed IN1 to Pin 11, IN2 to Pin 8, IN3 to pin 10 and IN4 to pin 9. Thanks for the lessons Paul - learning a lot!!

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

    I was soooo worried my motor didn't work BUT I followed the troubleshooting steps you showed us in all your previous videos and it turned out it I was given a dud for a battery in my shipment! Thanks for the very beneficial videos you put out ive learned so much during quarantine!

  • @AlexDavis-ch1ro
    @AlexDavis-ch1ro Год назад

    I paused, and was able to make it work, although the method I used was temperamental and wouldn't always change direction. I tried to change the variable using a (-1) multiplier and used your easy button hack, but I forgot about the (&&) command in the 'if' statement. Thank you for your teachings; every evening I'm able to learn something new, and it gives me something to ponder during the day, and how I can use it in future projects. Much love!

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

    ordered my kit finally, with your link. I have a different kit that doesn't have all the same components. This is a great series. Thanks for taking your time Paul.

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

    I studied at the university about arduino, but just now I am really learning.
    Thanks Paul, quite relaxed arduino lessons!!!!

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

    Ever have all the confidence in the world and fall flat on your face :) I didn't get the homework and am thinking about binge watching all videos from scratch to fill in any gaps I have in my brain housing group. Excellent video.

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

    Awesome video! Did anyone else's battery give out too quick? Had to connect the small PSU to the wall.

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

      Yes. Everyone's

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

      That's what I get for skipping around in the video. The real problem is I didn't hold my breath, and it caused the battery to go dead.

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

    Thanks for the great videos, I always watch them until the end. Yang Chen is right, I was able to power everything by using a 5V rail. What really cooked my noodle was I could not get my motor to reverse. It took me a few minutes, I check my code over and over, even changed the negative values and nothing seemed to work. Then, I switched the two center wires on the step motor and viola, it all worked as expected. This is also how I came to find out that you can use the 5V power source. My motors didn't work at first, but when I change the "motospeed" to 3, it worked.

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

      I had the same problem with the motor not running backwards so as you suggested I changed the two center wires and it worked. I guess the two electro magnets were mapped differently for our step motor. Thanks for the post.

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

      holy crap thank you!! I was having the same problem both with the power supply and the motor not reversing properly

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

    Spent quite a while on this one. Threw in a potentiometer to set the motor speed 1-10 as well just to do the math. It's kinda working but I can only change the rotational direction when the switch is toggled during the delay time. I accept my failure and shall watch and learn now!

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

    I did it but I kept the steps per revolution, and multiplied that by -1. And I messed up the which pin the button needed to be connected to, so I ended up going back to basics and using a resistor. Your way makes a lot more sense.

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

    Good one coach. I was stepping back & forth while holding the button. Went back and changed it so now works as required. Happy to say I did use the -1 trick :- )

  • @anol4590
    @anol4590 3 года назад +2

    Thank you so much for this video! I hope it reaches many other people

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

    I did the HW, but I did mine completely different and in a way more complicated way. I set up 3 while loops based on the value of butNew and butOld. Your way was way simpler!

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

    Did it almost exactly the way you did it. Only difference is I use bool instead of int for the clockwise variable. I understand c++ very well just not the electronics so much. Really appreciate all you do I have learned so much.

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

    Difficult but you make it more easier to us. Teacher your every project comes me new and different. I am trying to whole thing but it not easy to me. That is why I can not able to write your homework project alone. I need times to understand fully. Till then I must copy you. But I assure you, after copying you one day I make myself your task alone. Now, it is really difficult for me to understand fully. To the end I just say, I clap today just as a child see surprize from someone like magician. I also laugh to see your final step at the end of the project. You are such a great magician to me. Thanks for everything.

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

    Done this on my own but used parts of lesson 28 the toggle switch on the leading edge. Using the if and else loops. But will now study your version.