 And welcome to the show. It's me, John Park. And it's time for another exciting episode of John Park's workshop. Hopefully not too exciting from a technical standpoint. I had a crash a little earlier that it was taken a while to set things up after it recovered. I did a restart on the machine. And here we are. So hello to everyone over in our Discord. And look, that works. Some of these windows, I'm hoping they'll all come in OK. But some of these layers were acting a little funny upon restart. I think I got them all fixed. But we'll see. So hey there, people of our Discord, if you are watching on another stream of some kind and you're not sure where the chat is, if you're over on Twitch perhaps, where is all the chat? Well, it's happening right there in Discord. You can go to Adafruit.it slash Discord. And you'll get an instant invite to our Discord server. And this is happening over on the live broadcast chat channel. You can't see it there because I've cut it off, cropped it off on the left side there of our Slack. You will see we've got live broadcast chat, pet photos off topic, help with, circa Python 3D printing, Adafruit I.O., Arduino, Audio, Git, Make, Code, PCB design, and on and on and on. There's a lot of channels of content. Someone said the stream is acting a little jittery. I am sorry for that. Hey, it looks like YouTube says excellent connection at the moment. So I'm not sure if that's happening on Twitch or somewhere else. The streaming monitor over in Restream I.O. also reads good health, good bit rate, good frames per second, good ish. So I see the frames per second were jumping between 30 and 15 roughly. Glitchy but watchable, Rich Sad says. Well, hey, I'm not sure if I can aspire to much more than that at the moment. Hoping we're going to get the AT&T fiber here. I'm on spectrum. I have a dedicated line for this, for the workshop, for doing my streaming separate from all other uses. So it really should be good. But I'll tell you in the last six months, something's going on with that bandwidth, I think. I think that's the issue. But enough about that, let's jump into some of our topics here. First of all, I mentioned we've got a jobs board. That's at jobs.atorfruit.com. Head on over there if you want to take a look at some of the jobs on offer. I'm going to open up my browser here, and you'll see. Here's the jobs board. And there are a bunch of cool positions here. This is a free jobs board, free to post your positions and free to post your resume and info. So open hardware summit chair, position open. There's the senior front-end engineer, Flutter, full-time 100% remote. I don't know what most of that means. But that's at laudable. So it's laudable. And senior cloud infrastructure dev ops full-time 100% remote. So if you head over to the jobs.atorfruit.com, you can also post your resume. If you're logged in, I don't know if I'm logged in on this browser. If I click on the available for hire, yeah, it'll let me see that. I don't know if I can post a new thing. But here's, let's say, you need a 3D and CAD innovative electrical engineer, and you're hoping to get one from Freehold, New Jersey. Well, there's one right there for you. There's another 3D and CAD person in New Orleans, Louisiana. So we've got it all covered. So head to jobs.atorfruit.com to find out more. Next thing I want to mention is Adabox is coming soon. I'm not so sure about those dates there. That's not accurate. I don't think we're, well, we might be shipping then. We're not unboxing until, I believe, the 20th. That's our plan currently. So pencil that into your calendar. And if you want, I think there may still be just a few openings for this one. We ship around 4,000 of them. I just got the email alert yesterday, I think it was, that said we had 50 spots left. So if you want one of those, go and head to adabox.com, or adafruit.com slash adabox, same thing. And you can get started just as the big blue button there says. If you want, you can subscribe to yourself, or you can subscribe as a gift to someone else and give the gift of Adabox. Let's see. I'm looking in the chat here, by the way. People are discussing bandwidth issues. And I'm curious. Someone said, band it at 4 o'clock. I don't know what that means. Many ISPs suffer from this. Yeah, and my upload, I think this line might be paying for about 30 megabits upload speed. And when I test it, it's somewhere in that range, usually 20 to 30. But I don't think that's true. I don't think that's honest. I think that's some sort of, hey, the best packet that got through was that fast. But yeah, sustained rates, suspicious. Hopefully it's not too bad. Let's see. What else have we got going on? Did you know? I think you did, but I'm going to tell you about it. That I've got this show right here. It's the JP's product pick of the week show. It happens on Tuesdays. It looks like this. I do these silly thumbnails to encourage the YouTube algorithm to spread the good word far and wide. And I usually spend a little time showing you a product, maybe a bit of its history, a data sheet, some code, a demo or two. And there's a big humongous discount available during the live stream. And this week, it was this delightful Neopixel Neo Matrix 64 RGBW. And if you like, I'll play a little one minute recap, just in case you missed it. Here's what it looks like in one minute form. Check it out. The product pick of the week this week is the Neo Matrix 64 RGBW. So here what you're going to see. This is a rainbow display, so that's what we're used to. And then I have some stuff in the natural white. This one, actually, this is running my monitors, making it look a little warmer to me than it is. It's really more of a neutral, natural color. So there we have some jade color, Comet or Chase. And here's a really nice one. This is the Pulse Sparkle. You'll see I've got this line right here. For some of the colors, I'm using RGB underscore white underscore W. And that allows me to specify just that white diode instead of lighting up red, green, and blue equally, which gives you a kind of color tinted white. It's never a great white compared to this single diode that's in there. It is the Neo Matrix 64 RGBW. Yes, it is. And hopefully some of you got some, and we'll have some fun projects to work on. I can't remember if I discussed this during the show, but the idea comes up every once in a while of doing the cube with these. I've just got the ones there right now. But this notion of connecting them and then maybe using magnets or some other way to fit them together, a 3D printed frame to slip them into, but to do a full cube of these, maybe with an accelerometer inside of it, with a microcontroller in there, like a feather and a battery and maybe some way to plop one off and plug it in for power. But that would make for a pretty cool cube, I think. And let me know if anyone's seen those done with the Neo Pixels. I've seen some really cool set of these like dodecahedrons made from little tiny hand soldered SMD matrix. They brought that to Supercon a couple of years back. It's really cool. All right, yeah, so that's that. Now on to the next thing. So what I wanna talk about is a little thing I like to call the circuit Python Parsec. So let's get set up for that. The circuit right there. All right, setting up. So actually today's gonna be kind of servo day and I know even I spoke about some servo stuff last week, so this is a bit of a continuation of that. What I wanted to talk about from the circuit Python Parsec today is easing the motion of your servo motor. So you're used to servos going choo, choo, choo, really fast from position to position when you tell them, hey, get to an angle, it just gets there as quick as it can. Well, this is a technique developed by Todd Bot for easing or almost adding a low pass filter to that motion. The way this looks, that's what I wanna show you first. I'm gonna plug this in and I stuck a little matchstick on the end of this servo horn so you can see a little better. Watch this motion. First it's gonna jump. That's a regular hard stop. Hard stop. Now we're gonna ease. You can see that little easing motion as it gets to its position. It starts quick and then slowly gets there. And if I recall, I'm only playing those hard, fast ones right at the beginning. So from now on out, it should just be, yeah, these nice easing motions. And as Todd pointed out, this is a lot like many organic things, a lot of things in nature when they move, they move quickly and then they ease as they get there. If you look at little say water bugs or little amoebas, things like that, even people, we tend to move quick and then slow down as we look at something or get our head there. So the way this is done, you can see, I've got some libraries I'm importing to be able to use the board and PWM IO and a different servo. Then I am setting two positions and how long I wanna take to get there. So zero and 180. I'm going the full extents of the servo. I set up my servo. I go to those angles at the beginning quickly. I go to zero to 180 and to 90 real fast to show you what that quick motion looks like. And then we have this thing here. This is a variable called ease speed. This is the amount of the motion that's gonna be spent on the easing and the number of slices to subdivide the motion tail into, in this case, 50 subdivisions. If you look at, I'm gonna open up my serial port here one second, let's do screen dev tty.usb. Watch the numbers as they go by. So these are these diminishing numbers that are the smaller and smaller sub angles that we are traversing at the end there. And this is how it's done in my main loop. We set the new angle and the number of seconds. So that's from our list. We present, we print that position. And then this is the easing slices for I in range number of ease slices. The servo goes to an angle plus the new angle minus servo A angle times the ease speed. And then we repeat that until we've gone through 50 of those little sub slices, which is what gives us that nice smooth motion at the end. Then we sleep a couple of seconds and repeat the process on the next angle in the list. And so that is how you can set up a nice easing motion very simply on a servo motor inside of circuit Python. And that is your circuit Python, Parsec. I was just looking at the chat. Let's pop open the Discord chat here. And someone said something about my matches here. Yeah, thankfully it didn't catch on fire. This is an easy strike one. Someone asked about easy strike matches. Wanna see if we light it? This is a bad idea. I'm gonna try it. Let's jump back to a, let's add a down camera to the mix here. There's a down camera and it's not, you know, it's not moving very fast and it's also not very securely attached. So I doubt it'll strike, but I'm gonna, I'll grab a big strike or strip. Obviously being a strike anywhere, it should strike anywhere, but we'll increase our chances by getting it at the beginning of the, nope, it's just kind of coming off of there because I have it secured with a glue dot. So sorry so much for that. That's probably for the best, right? Given all the woes of this streaming setup, probably adding fire isn't one of the things I should do. Let's pop that camera off of there and on with the show. Whoa, what's up with this? Who's the burning Elmo? Yeah, I do have a fire extinguisher. It's right there. You can't see it, but it's right behind me. That's a very, very, very high up on the list of important tools in the shop for sure. All right, let's see what's next. So I wanted to jump into another servo-based thing. So that is a, what we were looking at there, that's a sort of traditional hobby servo. Means you can tell it a position to go to and it tries really hard to get there. But we have an open loop of feedback. We don't actually, once we send a position and tell it to get there, we don't really receive confirmation back on the microcontroller that we succeeded. And so what I wanna show you today is a closed loop feedback system which is in the form of our analog feedback servo motors. So let me jump to a little down camera again. This is one of the three different analog feedback servos that we have on the Adafruit store. And what you'll notice about it is an extra wire. So we have the traditional brown for ground, orange for positive voltage, and other orange or sometimes yellow for the control signal, the PWM signal that tells the servo motor what position to go to. These feedback servos have this fourth wire, in this case it's a white wire, and that is sending out a analog value that should correspond to the position we've sent it to. But if it doesn't, we've bumped into something stripped to gear, who knows what, those could be out of sync. Oh, hey, speaking of out of sync, someone said that we're restarting and I'll let that settle for a moment. And let's see if we can get back. Yep, just release. All right, we should be back, yeah? Hopefully in sync too. Can I see if that's running on? Yeah, it looks like we're running again. Yeah, let me know. I can restart it, it just takes a few seconds like that. So let's take a look actually on the product page for this just to see what I'm talking about. And then we also have some other interesting info guides about what we're using here. So hold on one second and let me bring this. So this is the one I'm using here. We have a couple of the microservos as well, I think there's a plastic gear one and a metal gear one, but I'm using the sort of standard hobby servo-sized one. And this one, it's $14.95, we have them in stock. And I think this is a good option for doing some animatronics. So what I'd like to do is build some window display type of animatronics. Nothing big and heavy, right? I'm not gonna be moving a giant skeleton across the front lawn with these little servos, but you can do some puppeteering of things, especially the light things that move easily, like ventriloquist dummies, for example, might be a cool option, even hanging little bats and things from strings. And you can do that with a typical traditional servo, non-feedback, and I even showed just a second ago on that circuit python, parsec how to do some easing. But with the analog feedback servo, we can get a lot more satisfying animation. So if you want to deal with the timing of your animation, one of the nice things about the feedback servo is it works in both directions. So this, before I get ahead of myself actually, let's look in the product page it says here, talks about our servo, looks like a servo, acts like a servo, it's more than a servo, we got a factory to custom make these classic standard size hobby servos with a twist, the feedback potentiometer wipes. So normally when you tell the servo where to go, it uses a potentiometer that's essentially geared to the shaft that's turning to arrive at a particular position. That info we're just linking back out of the servo, so it's the same potentiometer and we can see where it actually got to. Then there's a note about the pulse width, I'll talk about that, how to set up sort of a calibration for your angles as well as your feedback, what kind of analog values that potentiometer spits back when it gets somewhere, and then ultimately how to use it. If you click on this link here, analog feedback servos, you'll get to a guide that's really terrific, Bill Earl wrote this, talks all about how these feedback servos work and then how to set them up in both Arduino and circuit Python, and then there's some sample code for calibration, using the calibration as feedback and even doing essentially a go motion animation setup. And go motion, by the way, if you're sort of a film buff, an effects, special effects film buff, you may have run across this term back 80s, 90s, really more 90s, I think, with tippet studios and some other effects houses or special effects houses doing miniatures that were not stop motion, where you move a frame, take a couple frames of film, move, take a couple frames of film, move, take a couple frames of film, but with go motion and some of the more advanced computer input rigs for your characters, you would set them up with feedback and potentially not motors to drive them, but in some case, yes, but more so to just read the joint locations, move a character and then capture a frame of that data into the computer. So using puppeteered models to drive computer generated characters was something done on like Starship Troopers and I think some of the later Jurassic Parks, maybe even the first Jurassic Park. And if you look into this, actually a really great guy that I used to work with when I was at Disney, he was up at Pixar, but he had been at tippet and ILM I think, too, is Rick Sayre and he was one of the guys who created that setup, which was called the dinosaur input device or DID. Anyway, that's a bit of a history about this, but I think this is really cool. The idea of hooking up servos or potentiometers or mix or other encoders to the joints of a character so that you can pose it and then replay that. So this is a really nice, somewhat simplified way to do that, but also really satisfying. So let's get into it. Let me jump into a down view here and I think I'll start with the good stuff just in case I break things and then we'll go backwards through this a little bit. Let's start out with a good demo. So what I'm doing is, let me describe the setup here a little bit. I've got a Feather RP2040 and I have one of our PWM servo feather wings and then I have five volts with I think it's a two and a half amp power supply running into the breakout board here. So this is providing enough current that maybe your microcontroller can't actually provide once things start drawing a lot of current, especially a stalled motor will draw tons of current and just brown out your board. So this allows us to use the external power supply. We have the servo PWM out and this one actually has eight channels of PWM that it can send out. I just have the one servo on here and then you can see I'm running a, that extra feedback loop lead of analog output from the potentiometer in here into one of my analog input pins on the Feather. I'm just using a pin I soldered into the top of this board but it's really analog A3 on the board there that we're using. So I then also have a couple of buttons plugged in and this is just a slight, very slight adjustment I made on Bill's code and it works really well. The way this works, if I press the red button it goes into record mode and then I will move that servo into position. So you can gently, you don't wanna strip it but you can gently move it and you can even move it with some speed and some slow motion and that's going to record all of that timing and position information. Then I'll stop recording by hitting the red button a second time and then I'll hit the white button and that's gonna play my animation. So let's do a demo here. I'll keep it simple so that you can kind of see what's happening. I'll try starting this position, moving quickly, slowly, quickly, slowly and stop. So hopefully that just recorded. I'm not looking at my output screen and now hit this white button, it didn't work. All right, let me look at my serial output here. Hold on one second. We can switch back to this view actually. Put in that extra me. There we go. So let's, oops. Oh, it doesn't see the device. Oh, okay, I'm gonna try one thing. I was having some weird problems with this earlier. I'm gonna reset the board without that servo plugged in. This is the first time I've used this RP2040 feather in this. I don't know if there's some issue. I'm not considering, but let's see. Is it not finding the serpy drive? Oh, it is now, okay. Yes, you're the only circuit Python device plugged in. That's a good sign. All right, so let's turn on. Let's try one quick move. Oh yeah, it's recording. Stop, and now I'm gonna play. Yeah, it's working. Now, unfortunately, I think that the stream is gonna make it a little hard to tell some of the more subtle motions just because of the delay and frame rate that I have. Oh, I just got distracted, because James Williams says that he knows Rick Sayer. I knew him at Pixar. Hey, all right, James, that's really cool. Rick's a sweet guy. Didn't know he did the dyno input device. Yeah, he's one of, I think, four people named on the patent for that, if you look it up. Super cool. And in fact, they have one at ILM, if you ever are able to go to ILM and kinda walk through some of the cooler lobby staircase areas, there's some artifacts under acrylic cases and there's a dinosaur input device there. Just a bunch of erector set looking servos and a ton of cable harnesses coming off of it. Probably big RS-232C interfaces. Okay, so let's do this again. You can see I'm gonna hit record. I'm gonna slowly go to the right. I'm gonna hang out for a little while and then I'm gonna quickly jump back and I'll stop. Now I'll hit play. Let's see, slowly going to the right. Stop and hang out. And then jump back. And now if I hit play again, it'll repeat that. As you can see, it goes to our starting position. It got there suddenly, so you kinda need to keep track of where your starting ends are so that it'll loop seamlessly. And let's do one more. Full left. Stop, left again. Stop, right, right all the way back to our starting point. Stop, and let's go full screen. And I just realized it'd be a lot easier to tell what's going on if we attach something to this. So I'm gonna grab a piece of blue tack and how about a spare LED? You tack that on there so you can follow that. That won't light up. But here we go, hitting the play button. Hitting left, center, left again. Center, full right, back to 45. Ta-da! So that's really cool. It's really exciting. This idea of being able to essentially pose your animatronic and record those poses. So if you consider, I'll jump to one of our other product pages to show you. We've got the, let's see, pan tilt. So these little mini pan tilt kits are pretty cool. These ones use the little microservos, or mini, are we calling them, yeah, microservos. You can see these are little brackets that attach to the servos and allow them to act as a pair of joints. So you can think of it as something like a elbow and a wrist, let's say. If you're just moving one of those on a single axis and then the other one, let's say, can move on this axis. That's sort of what you get. So if you wanna link multiple servos together, they can be closed, they can be far within reason. These don't have a lot of torque. So if you get pretty far out, that moment arm is gonna be applying a ton of force on the little servo, it won't be able to handle it. But within reason, you can set up some small little pan tilt things that give you a couple of axes. And then if you imagine setting up this type of setup on multiple servos and maybe have, still just one button for record, but you record multiple servos, you go to a particular pose, another pose, another pose, and then you'll be able to repeat that motion and have something with the timing and the positioning. I think that's one of the cooler things about this method is it's not just position, it's the timing, which is really the critical part when it comes to realistic motion or interesting motion or at least intentional motion and animation is that the timing is really critical. So to be able to hold dramatic pauses, look quickly, look slowly somewhere, maybe you're attaching a pan tilt head to just a little skull, put some red LEDs on it and put it on your window sill, this is a really nice way to do that. So let's take a look now at the code and then I said I would actually jump backwards and show you how you set these up, which is kind of interesting. So let's go, I'll go back to this window here and let me open up, if it's gonna let me, open up some code that's on that feather, yes, okay. So we'll start with the current code. So this is the one I'm calling servo animate, that's actually just the code.py right now. So here's how this works. We're importing a bunch of the typical libraries, including PWM, simple IO map range, so we can remap some ranges, and Adafruit motor to get servo. I'm actually using, I don't think I'm using that one directly because I'm using servo kit. So my code is, I started with Bill's example and then I've started to adjust it a bit just because in Bill's example he wasn't using this feather wing, I don't think, so I'm starting to move it to that. I'm also gonna switch the digital stuff to using the debouncer just because I like to use that, but I haven't yet. Then we set up a couple of these digital inputs for the buttons on D12 and D11 to be the, this red record button and this white playback button. Big fan of these, by the way, these are these little breakout boards for a clicky button that are a nice way to set something up. I was even thinking with this, it might be fun to use something like, since we have a STEMI QT port on the feather, one of our little four key breakouts might be nice to have a few different things that you can input and you can use the neopixels on there as the feedback for what you're doing, so blinking red while recording, blue or green during playback, that sort of thing. Then you can see I'm skipping some of the stuff that was from the original code there. I'm not blinking an LED at all right now and I'm not using the servo pin and feedback pin as stated there. Then I'm doing a setup of the record button, setup of the play button. I have my feedback pin set up as the board A3 and like I said, we'll jump back in a second and look at some of the code that leads up to this to understand the feedback a little more and where I got these numbers from because right now I've just got some magical numbers that are my calibration minimum and my calibration maximum. I'll show you where those came from. My minimum and maximum angles and the sample count and sample delay for the recording, for sampling the motion. Then I set up my servo kit library with that PWM servo breakout as a eight channel servo kit. I think we also have a breakout board that does 16, not the feather one, but like a standalone breakout board. And then I'm just setting this one servo. So kit.servo index zero is being set to a pulse width range of, and I kind of did during the calibration, I did this as a little bit of a trial and error just to find what minimum pulse width gets me to zero degrees and what maximum pulse width gets me to 180 and that happened to be on this servo, 500 on the minimum and 2400 on the maximum. Oh, sorry, I just noticed there's a double image of me. Let's get that littler one out of there. And then I'm setting up my feedback variable to be a read on the analog pin A3. So that variable will be whatever raw voltage value we get when we ask analog in on A3 what it's seeing. So that's what's gonna be changing as the servo position changes. The servo positions are stored with this variable position and then at the start of this, you'll see just in my serial window here, it'll just say servo record play when it starts. I think it was already running when I started the serial output there, so we don't see it. Then we have this function, a couple functions that are important here, the play servo function. And this plays through the angle position and timing that we've recorded. And that's all set up with this one, record servo. And then it goes through the range for whatever position you're at and the angle you're at. When that record button has been pressed and it's in record mode, then it starts sampling and adding those values and timings to the position variable. And then the main loop is just gonna run those functions when you hit record. It'll run that record function. When you hit play, it'll hit that play function calling those here. So like I said, one of the reasons this works really well is that we're able to ask the servo where it is. Actually the only reason it can work is that we can ask it where it is while we're turning it. So we haven't sent it somewhere, it's just we're turning it like we're turning a potentiometer knob because we are, it's inside of there. So if we look at how we got there, what I'm gonna do is I'm gonna actually now jump to the beginning of the process and grab this calibration code. Let's see, someone asked, see Grover asked, what animation sample rate would provide smooth motion for a typical video recording frame rate? I think if you did the, you'd have to do some math to convert it, but I think I'm broadcasting at 30 frames per second. I say I think I am sending that, but that isn't necessarily what YouTube is getting and sending along to you. But I am recording to my computer right now and so the recording is at 30. So whatever the sample rate that would get us to 30 frames per second, I guess in, yeah, it's 30 frames a second. So whatever subdivisions we're using here to get us to 30 frames a second means that we wouldn't lose frames of a servo motion to video capture because I'm recording to disk at 30 and that's give or take what I'm sending out at. Let's see, does it tell me right now on restream.io says we are currently at 30 but a second ago it dipped down to like 11. Now it's a 27. So that's gonna be an impossible game to match that. So see Grover did the math of 33 milliseconds would be the match to the 30 frames a second. Thank you. So let's see this one. Let me make sure I got the right. Yeah, this is the right one. Okay, so what I'm gonna do now is I'm gonna resave this calibration code as my code.py. And what it's gonna do, wait, I didn't copy and paste apparently copy all that select all that delete it. Paste. Okay, so is this saving the right spot? I think it is. Okay, so now what's happening is see moving to zero done moving to 180 done while that was happening each time it got to the two angles that I told it to go to it read the feedback on the potentiometer over this pin A3. And so it's telling me that my essentially raw read on my raw voltage was 10,192 when we were at zero degrees and 46,784 when we were at 180 degrees. So now we know now we have a calibration value that says here's exactly what the potentiometer reports when it's at a given angle. And you could try this on other angles see okay what's it at when we're at 90 is it exactly halfway between those or maybe it's a little off from that. Here too is where I played around with my minimum and maximum pulse width range to get the zero to actually be where the physical zero is and the 180 to be where the 180 was. So without these it won't actually go zero to 180 and I'll demonstrate that right now just so you can see it and let me try to encourage the servo to stand straight so watch this I'm gonna resave and it probably won't go fully so it's kinda it's kinda missing the mark right it's really shy of the full zero degree angle and it's close but not quite there so you can start I think this might default at 1,000 minimum and 2,000 maximum and then you can just start nudging those values out and there may be a clever way to do that with the feedback but I didn't bother with that I was just able to type in some likely numbers I think I started at 200 and it didn't back away from that until it just gets there you don't wanna go too small or you could have it grinding against a physical stop. So that should report as you see there the feedback was 15,000 roughly and 44,000 so that's the potential I'm saying I got to something it wasn't really zero and I got to something it wasn't really 180 so now if I resave you'll see it's gonna get fully to the zero fully to 180 and now the numbers it reports are gonna be pretty close to what you saw before. Question from the chat is this a continuous rotation servo it is not this has physical stops and if you think with the continuous rotation servos if you send it these kinds of commands it's really just like sending a speed command because it never reaches the stop and it just will continue trying to go to whatever angle you said but it never reaches it and so the values aren't degrees but essentially a speed control so this is a regular non-continuous servo rotation. Let's see so the values that I got there I then take those and we're gonna open up the feedback code here so what this one does is it uses that feedback value to seek a position and you can see my values in there are not quite exact it changed this time so this time I got 10,208 instead of 10,069 but it's pretty darn close so I won't bother changing those but now we have the calibration setup and we have the minimum and the maximum angle so what I'm gonna do is I'm gonna take this and we'll feed it back in so I will resave code PI to the board and now I've added it's going to 0, 180, 0, 45, 180 and you can look at those and you've got a little pause between them and you can kind of do a verification that those angles actually look right to you and so now instead of just going where you tell it to it actually uses the feedback loop of what the potentiometer is being dialed to internally to make sure it gets there so this is more accurate than if you had a non-feedback servo and told it to go somewhere so we can look here at my little demo angles we can go let's say, let's change this to let's go 0 to 45 to 90 to 45 to 0 so it went to 0 and now whoops there's at 45, there's at 90, there's back at 45 did it not go back to 0? Why does it not go back to 0? Did I wiggle? I think I wiggled it, sorry. Resave that. Oh I've broken something, why does it not get to 45 there? What did I do? What did I do? It's not getting to, I'm confused let me set that back to what I had it at and let me reseat the, now that's in there really well oh what's going on? Let's re-save 0, 180, 0, 45 yeah now it's going to, why did it not like I don't know why it didn't like that, all right and so let's see how that works if we take a look we have a function called getPosition which takes the feedback values minimum and maximum and it maps those to the angle minimum and maximum we also have this seek position which has this tolerance value and it sets the angle position to be this while absolute getPosition minus position is greater than tolerance pass so that is sort of honing in on that angle and it'll stop seeking it once it, once it agrees maybe that's what was happening with that not wanting to go back to 0 thing, I don't know why but it seemed like it was confused there and so then finally as we saw kind of building back up to the finished thing if I reopen our original code which hopefully I didn't change this after saving it boy this computer's acting slow you can do it, come on and just checking the stream to see yeah excellent condition it says now all right we save yeah I didn't resave this after I fixed something hold on let's get rid of button update which I was gonna use if I did this with the debouncer and also these LEDs need to be commented out where are you I think there's another one all right we save okay so it says servo record play now it's ready to go hit record this is just a progressive back and forth until it reaches the final thing hangs out there a while and then back to the beginning uh-oh did I screw that up I wonder if I ran out of buffer all right let's try that again it'll be a little faster okay play it back love it and this one kind of loops because I had it go back to the same position that it started how cool is that that is so hands-on so much faster than trying to come up with that kind of timing and organic motion just in code I love it it's really nice to have quick iteration and quick feedback and in a case like this real direct manipulation of it nothing beats that trying to just come up with angles and timings is never going to be a satisfying and probably rarely be as accurate you can iterate so quickly through animation we can just get your hands on things so very very cool very exciting and that's gonna do it so I'll save trying to hook it up to I was gonna go and try to hook it up to some puppets and things maybe my woody puppet from Toy Story there just a hand from my slappy doll but we'll do that another time let me check out the chat here oh it looks like my discord is of all the things to get real slow and sluggish let's hope it's getting there good okay we're still alive great and he asked what's the difference between a continuous rotation servo and a stepper motor oh and then people started coming up with answers stepper motor is essentially a servo motor that uses a different method of motorization yeah so I think there's a lot of overlap there because I think servo refers to the feedback loop and so you can have a feedback loop with things other than what we call a hobby servo so and I forget the full word for it but servo means essentially that we're doing feedback which you can do with with pretty much any kind of motor if you put an encoder of some kind and send feedback back and then steppers like this is a servo motor that uses a little DC motor plus a potentiometer wiper but a stepper motor can be a servo that uses a coil arrangement of multiple coils to essentially send a stator to different positions it kind of energizes an electromagnet and hands off the stator the fixed magnet to different positions so those can be confusing because they overlap but yes, steppers can have really fine grain rotation because they can have a lot of little coils as well as micro steps where it has like full power on a coil then reduce that to three-quarter and add in a quarter on the next and then progressively move and just like you can imagine with an electromagnet you can hand off that power alright well I think that's gonna do it for today thank you everyone for stopping by oh let's see someone said a cup of coffee in our YouTube chat said shortly after the Dino input device was divulged in making of types of scenes behind the scenes footage there was a commercial device called the monkey that did the same thing I wonder if they were related I remember the monkey being sold in the back of Cinefx magazine I mean sold it was probably 20 grand or something like that but your studio could buy it I really tried to convince IBM where I was working at the time to get one which there was no good reason for it I just wanted to play with it I did not convince them but there have been devices since then there's about a $1,500 posing dummy that we had a couple of demos of them a couple beta units of them when I was at Disney Animation and they looked like a sort of like a high quality anime posing doll type of device and it had a bunch of encoders in the joints and it had pretty stiff joints so you could get it somewhere and have direct input into something like Maya or Motion Builder so that you could capture a pose by physically posing it which is pretty cool love that stuff that stuff is a lot of fun one of my great frustrations building that kind of stuff on my own is that Maya, which is the main app I used when I was rigging characters never made it that easy to bring in things like MIDI or Joysticks so you kind of had to roll your own drivers Python plug-ins and things to read them but it's been done and now they exist to plenty in Maya and Blender as well where you can do things like read servos write keyframe animation into your animation software adjust it, tweak it within limits of the physical device and then play it back on the device so pretty cool stuff all right, well I hope you all go out and have some fun with this the guide is this right here jump back to the guide where'd it go analog feedback servos by Bill Earl that's not it where'd you go are you it? you're not it how about you? hey gosh darn it let's find it again analog feedback servos by Bill Earl and that'll work on any of the servos we have I haven't tried on the others so you'll probably find variations in the min-max values necessary at least and maybe the pulse width but this Bill Earl guide goes into some nice info about open and close loops as well as having the feedback calibration and full code for recording that you can use inside of CircuitPython as well as I think there's a version in here for Arduino that's gonna do it for today thanks everyone for stopping by and I will see you next week with another JP's product pick of the week and a John Park's workshop so that's gonna do it Fraterford Industries, I'm John Park this has been John Park's workshop I will see you next time bye bye