Raspberry Pi Pico W LESSON 99: Sweeping Servo Position Using the PIO State Machine

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

КОМЕНТАРІ • 28

  • @charlotteswift
    @charlotteswift 9 днів тому +4

    I've made a video of my solution to lesson 98 but I'm putting the comment here as it's a little late. It shows one way of how you can control a servo in a non-blocking fashion. It's called 'My video for Paul McWhorter's Pico W Lesson 98 - Sweep a servo arm using PIO (non-blocking)'

    • @larryplatzek9017
      @larryplatzek9017 7 днів тому

      What book "Fluent Python" who is publisher I find several when searching.

  • @charlotteswift
    @charlotteswift 4 дні тому +1

    I've managed to make a video for this lesson (99). It should also cover lessons 100 - 102. I didn't want to get too far ahead but due to various medical appointments before the end of the year, I realised that I would only have time to make one video which is called 'My video for Paul McWhorter's Pico W Lesson 99 - Moving servos'. I hope that someone watches it!

  • @DrDave327
    @DrDave327 3 дні тому

    Awesome content, Paul! Here is my solution to the homework assignment: titled:
    state Machine: 2 servo Control
    Thank you!!!!!!

    • @paulmcwhorter
      @paulmcwhorter  2 дні тому

      LEGEND! Thanks for sticking with this class, and we are well into the very challenging material. It is great to see some people are sticking with it all the way through the tough stuff.

  • @johnganci933
    @johnganci933 2 дні тому

    Completed the homework. Video uploaded. I did have a scare when my pico w was corrupted. Learned a few things, though. The small power board I was using could power one servo as shown in my lesson 98 homework, but it could not power two servos. It malfunctioned, as did the pico w. After buying a new pico w (actually 3) and a couple picos, I ended up powering each servo with a separate Arduino Uno board (did not want to try to power both servos with one Arduino!) I think I need to buy a bench power supply. At any rate, this was another fun project.

    • @paulmcwhorter
      @paulmcwhorter  2 дні тому

      A small DC power supply with adjustable voltage, and current limit knob is a nice thing to have for the benchtop. As I often say, dont use your Single Board computer as a power supply, and dont use your PC USB as a power supply.

  • @patrickfox-roberts7528
    @patrickfox-roberts7528 7 днів тому

    Thanks Paul

  • @edSabio572
    @edSabio572 6 днів тому

    Thanks Paul! I am late but I was able to control 2 servos by instantiating sm1 and using a different GPIO...Not sure if I am correct, new at this depth... : (

  • @ChandrashekarCN
    @ChandrashekarCN 5 днів тому

    💖💖💖💖

  • @johnganci933
    @johnganci933 6 днів тому

    I finished the homework but was doing some final testing. While testing I interchanged the wires connecting the 2 servos to the pico W. BIG MISTAKE! I think I've fried my pico. Lost connection to PC. Tried to re-install micropython. Doesn't seem to work. Will order a new pico W with pre-soldered headers and go from there. I'll miss next Tuesday's deadline. Grumble.

    • @johnganci933
      @johnganci933 5 днів тому +1

      Good news. When I got up this morning I had the bright idea to check my local Microcenter for pico w. Sure enough, $7.99 for one with pre-soldered headers. Just got back with 3 of them and 2 regular picos. I'm back in business! My original pico w is truly fried. Tried for several hours to get micropython back on it. No joy there. I'll give it a proper funeral. Now back to getting my homework into a video.

  • @johnganci933
    @johnganci933 2 дні тому

    When modifying my lesson 98 solution to not do a pull(noblock) in the PIO program I noticed a significant change in how long it takes the servo arm to sweep from 0 to 180 and back to 0. I've posted a video "pio sweeping servo behavior" that illustrates the behavior. I would appreciate any ideas anyone might have that explains the behavior. Thanks in advance.

    • @paulmcwhorter
      @paulmcwhorter  2 дні тому

      I am perplexed by what you are reporting. Try so simplify. I would take servos off and just trace what difference you see on a scope, if you have a scope.

    • @johnganci933
      @johnganci933 2 дні тому

      @@paulmcwhorter I don't have a scope. Might buy one as a Christmas present. What I was trying to report. (1) First program which has the pull(noblock) as 1st instruction in pioProg, results in observed clock time of 7.24 seconds when servo sweeps from 0 to 180 then back to 0. (2) Second program removes the pull(noblock) and adds the pulls in Python like you did. Watch the other video I posted earlier today (Still Sunday where I am.) Does this help you?

    • @paulmcwhorter
      @paulmcwhorter  День тому

      No, I understand what you are saying, it just does not make sense what could cause that. To debug it, you have to sit and make sure the two programs are otherwise EXACTLY the same, and then if you do not find some subtle difference, check timing using the scope. I can't figure it out from here.

  • @craigflorin1071
    @craigflorin1071 7 днів тому

    Enjoyed the lesson. It helped that I really dug into the math last week. He is my solution to the Homework. Edit. Sorry about the wrong link. Homework link update follows: ua-cam.com/video/J2GO4AuMAkk/v-deo.html. Sorry about the video that plays after the one I created ends. Looks like your tube added that.

    • @paulmcwhorter
      @paulmcwhorter  7 днів тому

      Can you edit your link . . . the link did not take us to a homework assignment, but something else.

    • @craigflorin1071
      @craigflorin1071 6 днів тому

      @@paulmcwhorter Update the link. Not sure what the add feature is at the end of the video, but it looks like youtube added that.

  • @johncain1401
    @johncain1401 7 днів тому

    I have enjoyed working with the SMs, I added a try/except code at the end of the code in Lesson-99, just to return the servo to zero whenever CTR-C is pressed, probably an easier way to do it but this worked.... :
    except KeyboardInterrupt:
    sm0 = rp2.StateMachine(0,servoSet, freq=2000000, set_base=Pin(20))
    sm0.active(1)
    sm0.put(20000)
    sm0.exec("pull()")
    sm0.exec("mov(isr,osr)")
    angle=0
    pw=int(500+angle*2000/180)
    sm0.put(pw)
    sm0.exec("pull()")
    print('Servo now at zero degrees - Good To Go')

  • @pelabarr
    @pelabarr 3 дні тому

    Here's my solution to lesson 99 dual-servo sweeping : ua-cam.com/video/P9TBcMRFn6E/v-deo.html

  • @arnoldschmucker9977
    @arnoldschmucker9977 6 днів тому

    Corrected! i really am old enough to remember how windshield wipers really worked. ua-cam.com/video/IcDzEqyFL20/v-deo.html

  • @arnoldschmucker9977
    @arnoldschmucker9977 7 днів тому

    Did it. ua-cam.com/video/3KT4rkm7944/v-deo.html