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)'
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!
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.
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.
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.
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... : (
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.
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.
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.
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.
@@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?
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.
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.
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')
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)'
What book "Fluent Python" who is publisher I find several when searching.
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!
LEGEND!
Awesome content, Paul! Here is my solution to the homework assignment: titled:
state Machine: 2 servo Control
Thank you!!!!!!
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.
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.
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.
Thanks Paul
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... : (
💖💖💖💖
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.
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.
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.
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.
@@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?
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.
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.
Can you edit your link . . . the link did not take us to a homework assignment, but something else.
@@paulmcwhorter Update the link. Not sure what the add feature is at the end of the video, but it looks like youtube added that.
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')
Here's my solution to lesson 99 dual-servo sweeping : ua-cam.com/video/P9TBcMRFn6E/v-deo.html
LEGEND!
Corrected! i really am old enough to remember how windshield wipers really worked. ua-cam.com/video/IcDzEqyFL20/v-deo.html
LEGEND!
Did it. ua-cam.com/video/3KT4rkm7944/v-deo.html
LEGEND!