Raspberry Pi Pico Stepper Motors via PIO

Поділитися
Вставка
  • Опубліковано 27 лис 2024

КОМЕНТАРІ • 80

  • @JamesTitcombOSwarthoull
    @JamesTitcombOSwarthoull 3 роки тому +20

    This is the Intro to PIO programming I've been looking for. Thankyou, Great Job!

  • @ianleitch9960
    @ianleitch9960 3 роки тому +5

    PIO program intro spoon feeding is a must. Nice to see the progression and I hope to get a grasp on it after pouring over your examples. it's very different until explained. Awareness is arriving, albeit slowly. Many thanks.

  • @jonpinkley2844
    @jonpinkley2844 3 роки тому +10

    Thanks for this very informative video. First video I have seen that describes PIO programming.

  • @windmillgolfer
    @windmillgolfer 3 роки тому +7

    Thank you - just what I was looking for. Building a double barn-door tracker, with Pico, DRV8834 and Nema 42BYGH. 40 to 50 years since I last wrote any code or tinkered with electronics.

  • @ibexfilms3989
    @ibexfilms3989 3 роки тому +5

    Excellent presentation, both in terms of stepper motor control and, particularly, the use of PIO with the Pico. I've learnt more about PIO from this video than the previous dozen that I've looked at. Thanks

  • @MrRhysstevens
    @MrRhysstevens 3 роки тому +2

    I didn't realize how good this was the first time I watched it. Since watching some other PIO tuts and now know the meaning and significance. Great video.

  • @kralcw
    @kralcw Рік тому +1

    Great presentations. Thank you. It is interesting to note the current number of subscribers to your channel (3.14K) which is PI to two decimal points of accuracy in "scientific notation" (K) on a channel that is very Pi focused. Keep up the great work.

  • @trailranger6602
    @trailranger6602 Рік тому

    Brilliant presentation, thanks! This is my first introduction to the Pico and shows me I need to build my base knowledge a little better to fully understand some of these new concepts.

  • @lloydrmc
    @lloydrmc 3 роки тому +1

    Brilliant! A complete enough framework to do something, yet plenty of room to further refine the methodology and add functionality.
    For instance, you built a simple state machine in the Micro Python calling routine, and the Pico still has three unused PIO state machines.
    Makes me want to get the hardware to start experimenting.
    Also, props to the UA-cam algorithm for serving me this video. I went ahead and subscribed, confident you have plenty more to teach me.

  • @serenadenphoto
    @serenadenphoto 3 роки тому +3

    This new math for decimal to digital conversion is very exciting. I've learn that decimal 8 is '1000' in binary and not '0001'. For this code it doesn't matter if you do 1, 2, 4, 8 or 8, 4, 2, 1. It just changes the direction of rotation. And many have asked, where is the common ground between the Pico and the motor driver?

    • @duncanwalduck7715
      @duncanwalduck7715 3 роки тому +1

      It's a matter of "endianism", in this case "little-endian". The first bit in a word that any word (even word of length 1, i.e. a bit) will definitely have is the lowest-order bit - the 1's column in a numeric representation. So that bit will take care of the GPIO line "right here", and anything beyond that (i.e. numerically in the higher powers of 2) can overspill to "further on".
      Regarding the driver board... it ¦might¦ be a 'courtesy' to give it a common ground, but it's not a logical necessity. The reason being [I am surmising based on previous investigation] that you can drive two phases, a "forwards" and a "backwards" (with an option of "nothing") with two driven voltage sources, e.g. GPIO lines: (1,0) can be forwards, (0,1) can be backwards, and (X,X) - for consistent X as either 1 or 0 - is no drive. Just have the driver board compare the two given signal voltages for an unambiguous input. It's similar to the idea of driving an LED between *two* GPIO lines, instead of as usual between one GPIO and the high or low supply rail.
      Do this twice - two independent channels - to get your four phases. How the electronics downstream inside the stepper motor chassis itself expands these four into a great many more physical phases for its actual windings is something I haven't pondered properly, though.

    • @massimookissed1023
      @massimookissed1023 2 роки тому +1

      @@duncanwalduck7715 , not with these steppers, they are 4 phase plus a common.
      The ULN2003 is just 7 high current transistor switches, 4 of them are used for the stepper, the other 3 are redundant. (If they'd used the ULN2803 which has 8 switches they could've made 4 pairs, doubling the current capacity.)
      There really should be a ground wire from the Pico to the driver board.

  • @larrybud
    @larrybud 11 місяців тому

    Good presentation. If you want to get lower level, get an oscilloscope and hook it up to see the 4 channels at the higher speeds.

  • @amedeeabreo7334
    @amedeeabreo7334 3 роки тому +1

    Great video. I'm just starting with the PIO and this really helps. As you say "Defeating inertia" is an on-going quest!

  • @scienteer3562
    @scienteer3562 3 роки тому +2

    Really great video. I had a go driving one of these these via basic bit banging. Haven't used PIO yet, but this is the perfect guide. I guess the other way to do this would be to dedicate a core to the task.

  • @AlexYeryomin
    @AlexYeryomin 2 роки тому +9

    Thank you so much for a clear explanation on your PIO code! Just a note, shouldn't a common ground be between Pi Pico and ULN2003? Well, it works, but this is what ULN2003 spec requires if I am not mistaken.

    • @markday3145
      @markday3145 2 роки тому +4

      Could be that his bench top power supply and whatever was supplying power to the Pico have grounds that are close enough for it to work. But you're right, there really should be a common ground between the Pico and the ULN2003.

  • @MartynCole
    @MartynCole 3 роки тому +6

    why isn't there a digital ground between the Pico and the stepper board, what am I missing?

    • @UReasonIt
      @UReasonIt 3 роки тому +2

      Unless the power used by both the motor and the Pico, my guess would be that at least one of the pins to the motor is always in a sinking-state and that's the GND connection. Not a good way, but probably just a small oversite on the maker's part.

    • @bumbarabun
      @bumbarabun 3 роки тому

      I guess PC and power supply have common ground through power plug but that is pretty bad way to do it and quite dangerous.

    • @tunahankaratay1523
      @tunahankaratay1523 3 роки тому

      @@bumbarabun Not really. It's actually perfectly fine, you may call it bad practice but in real life it will work.

    • @bumbarabun
      @bumbarabun 3 роки тому

      @@tunahankaratay1523 perfectly fine? Yea have ungrounded power supply and burn USB ports on your PC or maybe motherboard as well. That does not sound fine for me.

  • @TranscendentBen
    @TranscendentBen 3 роки тому +7

    Where's your ground line between the pico and the driver board? The four signal lines aren't enough, it needs a connection between the ground connections of the boards.. Looks like you're lucking out without it, or it has the wall outlet ground as common between the driver board power supply and the computer ground to the pico on the USB connection. Neither of these is good or reliable.

    • @foorje
      @foorje 3 роки тому

      I assume he takes the 5V from the pico supply line.

    • @TheRealWindlePoons
      @TheRealWindlePoons 3 роки тому

      @@foorje I had a similar issue with one of my projects. I was powering all my external interface circuitry from my bench power supply and it all worked despite missing off the ground to the Pico. I actually wanted a floating interface supply - I found & removed a discrete (barely noticeable) link between 0V and ground on the bench PSU and I assume my PC's 0V (as appearing at the USB interface) is also grounded via the mains earth line. This "accidental" grounding should be avoided particularly on analogue circuits (I was using the ADC) where a "ground loop" will pick up all sorts of unwanted noise & interference.

  • @leodelpo
    @leodelpo 3 роки тому +1

    Muchas gracias por compartir tus conocimientos y excelente didáctica!

  • @TheSlimbridge
    @TheSlimbridge 2 роки тому

    Excellent tutorial and examples, clearly explained.
    Thanks!

  • @massimookissed1023
    @massimookissed1023 2 роки тому

    Being a nerd, I've taken one of those steppers apart and had a close look at the gearbox.
    Counting all the teeth on the gears, and multiplying all the gear ratios, led to an overall gear reduction of 63.SomeHorribleDecimal to 1, not 64:1 as you'd hope.

  • @dave-j-k
    @dave-j-k 3 роки тому

    Great video, thanks. I'm a total noob gathering info to build a balancing robot with steppers, is this a good place for this control style or am i looking in the wrong area?? It will be controlled via the usual IMU board plus a remote of some type.

  • @goowatch
    @goowatch 2 роки тому

    Muchas gracias por la explicación. Finalmente logro comprender este tema y poder experimentar con esta funcionalidad. 🙂

  • @pranavsreedhar1402
    @pranavsreedhar1402 3 роки тому

    nice informative intriguing video...I have a question... shouldnt put(a) come before running any new steps? because it is the real starting point for any new step being called without memroy which in this case is the function turn...or have i missed something?

  • @djsbriscoe
    @djsbriscoe 3 роки тому

    Very nice video.Have you got an example just lighting an LED and then going on to lighting a series of LED's. Are there any examples of reading a switch and lighting an LED as well. Just want to break it down even further. Thanks.

  • @JonMcPhalen
    @JonMcPhalen 2 роки тому

    Keep in mind that the ULN as an Emitter-Collector voltage drop of about 1.4 volts. Probably better to put 6V into that board.

  • @Unknown15916
    @Unknown15916 3 роки тому +1

    Thank you. Very good explanation.

  • @kippie80
    @kippie80 2 роки тому

    A fantastic video. But what a cliff-hanger! All the while, I'm thinking to myself, how to do the ramping .. only two variables to work with, can I do masks with this limited assembly? And you bring up the purpose at the end ... need to do ramping but I don't see a follow-up. :(

  • @WistrelChianti
    @WistrelChianti 3 роки тому +1

    Did you by any chance narrate the Thomas the Tank Engine episode: Thomas and the x86 Assembly Code Cave? ;) [because if Thomas ever does learn to program, you should totally apply to be the narrator!] Great video. Really well explained (although I didn't quite follow the last bit - no mattery it was the PIO assembly I was interesting in) and so relaxing.

  • @aleXelaMec
    @aleXelaMec Рік тому

    Nice vid. Mind me asking how can i make a counter from the encoder (counting steps motor made) using pio? Big thanks in advance

  • @sin0m
    @sin0m 3 роки тому +1

    This is awesome, great video! How would you tackle ramping/acceleration?

    • @tinkertechtrove2910
      @tinkertechtrove2910  3 роки тому +1

      Thanks :-) you just need to adjust the speed that the routine cycles through the movement pattern. Maybe adding a delay into the state machine (not a lot of registers left to work with though) or having a few state machines that run at different frequencies (wasteful but maybe ok if your only working with a few steppers) I think the Pico can have 8 state machines max, but I have not tested this.

  • @bobweiram6321
    @bobweiram6321 Рік тому

    Excellent tutorial. Good pace. It would be more intuitive if you used binary constants for the pins.

  • @cheapnoiseinthehouse5578
    @cheapnoiseinthehouse5578 2 роки тому

    Really nice. Could you do a video on connecting a I2S dac to the Raspbery pie pico using Pio?

  • @michaelmagnani3463
    @michaelmagnani3463 3 роки тому +1

    The data sheet says 2038 full steps and you should be grounding the two together

  • @captainprototype187
    @captainprototype187 3 роки тому

    nice little driver board. Also works on arduino I presume? never seen them so tiny, is that anew thing?

    • @tomasparrado873
      @tomasparrado873 3 роки тому +2

      Yes. You can write your own functions exactly as seen here or use the in-built library within the Arduino IDE (www.arduino.cc/en/reference/stepper). If your intention is to learn programming I'd experiment writing your own functions, however if you're attempting to build the motor into a project I'd recomend -> www.airspayce.com/mikem/arduino/AccelStepper/ as a library that can add acceleration/deceleration ramping allowing smoother, faster movements. If you're interested in writing your own accel/decel code, ww1.microchip.com/downloads/en/appnotes/doc8017.pdf is a good place to start for the base theory.
      Are you referring to the driver or motor being small? In either case there are smaller (better) versions of both. A good driver is www.digikey.co.uk/product-detail/en/trinamic-motion-control-gmbh/TMC2208-SILENTSTEPSTICK/1460-1201-ND/6873626 (hunt around for the best price).

  • @williwuchtig3336
    @williwuchtig3336 3 роки тому +1

    Realy great. Thank you a lot.

  • @jam43
    @jam43 3 роки тому +1

    Great video!
    But how do we get the stepper motor to run in reverse?

    • @tinkertechtrove2910
      @tinkertechtrove2910  3 роки тому +4

      Thanks :-) I should have talked about that in the video really, all you need to do is reverse the movement pattern to change the direction

  • @JohnDuthie
    @JohnDuthie 2 роки тому

    super cool thanks for sharing!

  • @eliasvanderlof7391
    @eliasvanderlof7391 3 роки тому

    I am trying to control a nema 17 stepper motor with the drv 8825 motordriver on the pico, but I can't get it to work. I also can't vind anything online on this, do you have an idea how this would work?

  • @edgeeffect
    @edgeeffect 3 роки тому

    I've been calling it the "pee-co" (like the metric unit prefix) ... but yeah, I suppose "pie-co" (like the Raspberry Pi) really works as well... now you've got me wondering which is "correct".
    Just been down a rabbit hole of IPA and pronounciation... apparently "pie-co" is valid in US English... but it works so well for this particular device...
    Now... why was I here, oh yeah... you're gonna do some PIO...
    Pity there aren't binary constants in Python?.. if I'd have been "the MicroPython man" that's one of the things I'd have added to the Python core.
    I'm not that interested in stepper motors (well, not right now anyway) but I was VERY keen to see how PIO works... so, yeah, that was really useful.

  • @deterdamel7380
    @deterdamel7380 3 роки тому

    Very good intro into the Pico's PIO! But in practice you will drive a stepper motor with a more integrated device and you don't have to take care about the pattern for the phases.

  • @skf957
    @skf957 3 роки тому

    Subscribed. Very good introduction to what is (for me at least), a complex subject. I would have liked a bit more time spent explaining some of the individual program statements, but appreciate that the video length would increase as a consequence.
    I am working on the "paper" design that has a Pico present in around 8 separate workshop machines (saws, drills etc.) and which use 433Mhz radio to communicate with a central Pico that will then perform certain functions - one of which will be the movement of a stepper motor. Unfortunately for me, the RadioHead library is geared towards C++ with limited functionality available on Circuit Python. BUT, CP does not support IRQ nor I suspect State Machine, so really negates the advantage of the Pico. And I REALLY don't want to learn C++ as I like the accessiblity Python and MP looks just as good. Anyway, thanks for posting this one and if you fancy doing something around the 433Mhz radios - you'll get my view and like!!

    • @tinkertechtrove2910
      @tinkertechtrove2910  3 роки тому

      Thanks :-), that sounds like a very interesting automation project, good luck with it!

    • @jyvben1520
      @jyvben1520 3 роки тому +1

      wouldn't the heavy machines disturb the radiosignals ?

    • @skf957
      @skf957 3 роки тому

      @@jyvben1520 Yes, that is a distinct possibility and something that I plan on testing extensively to see how many lost radio packets there are both with and without the machine running. I suppose it depends to some extent on the quality of the machines (motor suppressor) AND the quality of the radios. But thanks for pointing it out.

  • @TheUnofficialMaker
    @TheUnofficialMaker 3 роки тому

    very interesting thanks

  • @TizzyT455
    @TizzyT455 3 роки тому

    Why are there so many nops? im sure there is a more elegant way.

  • @taranagnew436
    @taranagnew436 3 роки тому

    what is the max waight in can turn?

  • @mr1enrollment
    @mr1enrollment 3 роки тому +1

    without a white board explanation of the bit setting for PIO pins in the various states,.
    your instructional value is poor. otherwise nice idea for instruction.
    I am being a honest critic - with the intention of providing you a new target for excellence.
    =
    after watching again, I like this better. white board is good, but still better than anything else I have seen on the topic.

  • @bartspongebob9879
    @bartspongebob9879 3 роки тому

    What will happen if we won't use controller and just plug motor to raspberry pi? Is there a method to make it work?

    • @WistrelChianti
      @WistrelChianti 3 роки тому +1

      3 main options, you can control the GPIOs on the pi using shell script, C++ or python. Probably best searching for separate tutorials on that. Main thing here is to learn to use the PIO state machines on the Pico microcontroller. The only reason he is demoing the programming on a raspberry pi rather than using the pi to control the motor, is because setting up for Pico programming without a pi/linux is currently a bit "involved".

    • @bumbarabun
      @bumbarabun 3 роки тому +1

      You cannot drive enough current by GPIO.

    • @WistrelChianti
      @WistrelChianti 3 роки тому

      @@bumbarabun I think by controller they meant without micro controller rather than without the stepper interface board... Although I guess that take on things might be the intention... I guess it is ambiguous

  • @hlavaatch
    @hlavaatch Рік тому

    Where is your ground connection?

  • @MrBobn8r
    @MrBobn8r 2 роки тому

    How do you reverse direction?

  • @dudesemidecent894
    @dudesemidecent894 2 роки тому

    please show the codeing part and what to do

  • @Alacritous
    @Alacritous 3 роки тому

    You need chapter markers. I know how stepper motors work. What time stamp does the PICO stuff start at?

  • @benholroyd5221
    @benholroyd5221 3 роки тому +1

    Are you pronouncing 'pico' wrong? or is this another instance of the pronunciation being different for no good reason and 99% of the time you only read it anyway so you never actually get used to the weird pronunciation (hello Gnome.)

  • @VisheshSingh-x1g
    @VisheshSingh-x1g 7 місяців тому

    How to do ramping bro?

  • @paulmaydaynight9925
    @paulmaydaynight9925 3 роки тому +1

    where did you get those pork 'pie-Co' , 'pick-oh' for the win ^_~

  • @harnaikhothi3277
    @harnaikhothi3277 3 роки тому

    hi mate prog will they run python or c pls

  • @vizionthing
    @vizionthing 3 роки тому

    Sir it is pronounced peeko

  • @qozia1370
    @qozia1370 Рік тому

    use a man driver and motor not this baby stepper!

  • @MichaelKingsfordGray
    @MichaelKingsfordGray 2 роки тому

    Um, err, um, you know, um, err, erm, er, erm, erm, er,

  • @cokeforever
    @cokeforever Рік тому

    you make me sleepy with your monotonous talk, learn from Ben Eater