 Hey, how about that look now we have audio? That was just that was just so hilarious. Hi Let's start this over again. My receiver my mic receiver Was not on for the wireless Hey, welcome to the show. It's me John Park. We're here for another episode of John Park's workshop this time with sound even So thank you for joining. I've got some fun projects I'm working on here in the workshop some that I've just finished some that I am just starting Yeah, I was pointing. I was trying to point at That oh god the cameras backwards Right there. That's the computer perfection. I've just finished that project and learn guide should be up soon It's probably no coincidence that Lars has a pair of scissors there. What the heck? Now audio. Thanks everyone for for chiming in on that. I appreciate it You'd think at this point I've been doing this for what? Four years five years something like that and yet still somehow sometimes I forget to turn on part of this audio setup So what else I've got a coupon code for you for today that you can use when you're buying some stuff in the Adafruit shop I've got a JP's product pick of the week wrap up Recap we've got a new circuit Python parsec for you And like I said, I'm kicking off some projects. So Let's start off with that right there. That's your coupon code So head on over to the Adafruit store find some neat stuff that you want to buy And get yourself a discount on it. No need to pay full price. You can get 10% off So if you head to the Adafruit store, that's it right there. I just go to Adafruit.com You'll see we've got a couple of new products listed there There's a little link for view all new products and then some categories of some stuff you might want to look into Go find some neat stuff throw it in your cart anything you throw in there That isn't a gift certificate software or a subscription, but actual physical goods stuff things Those are going to be 10% off you just throw that coupon code in the cart on the way out and you'll get your discount and by the way that also is stackable with the the freebies so If you get enough stuff, you can see here if I just go to Adafruit.com slash free You will see we've got some freebies at the 99 dollar Order size you'll get a free permapro to half size breadboard at a hundred and forty nine dollars or more you get a KB 2040 And at 200 or more you get free UPS ground shipping in the continental United States So head on over to Adafruit buy some stuff get yourself a 10% discount as well on the way out with that coupon code roulette Which I only just found out today means little wheel in French About that never thought about that word rule. I bet that's how they say roulette No, here's big French So let's see comments in the chat by the way Hello, and thank you for joining over in our YouTube chat as well as in the Discord if you're somewhere else and you're wondering where to Join up in this in this chat. It's probably over on the discord. So you go to adafruit.it slash discord You'll see it Right there. That's what it looks like you can see I'm in the live broadcast chat Channel right there That's where this conversation is happening But we've got a whole bunch of other stuff going on in other channels all the time something like what 30,000 or 35,000 members now in our Discord so head on over there and join the conversation and also thanks to the people for hopping by over in the YouTube Uh, Dave Odessa, I have not forgotten you. Yes one day. Maybe we'll get 1080p I am I'm nervous about that only because I had issues in the past, but Yeah, 1080p would be great. Maybe I'll be brave enough to try it next week. We'll see maybe hold me to that. We'll see At least we got audio right so What else did I say I said hey I've got this show right here. That's the product pick of the week show that happens on Tuesdays at four o'clock eastern time Do your time planet math to find out what time that is in other places? You can even ask over in the discord I think you can you can ask for For the show times in different time zones not all of them, but some Anyway on that show I like to pick some new product or some oldie, but goodie and give you a little rundown a little bit of a Demo and a deep deep discount this week. We got 50% off On that one right there the host the USB host. So here's a little recap I got for you It is the feather RP 2040 USB host rather than plugging in let's say your mouse or your keyboard straight into a computer you can use a microcontroller this one right here to Intercept that incoming USB and do stuff with it We have one core of the two and both of the PIOs Doing all of the USB host duties that leaves the second core for everything else take mouse information and apply some Logarithmic filtering to it so that it actually slows down the cursor movement when you move the mouse quickly mouse Slowly left and right. It's moving a kind of what I would consider a sort of normal mouse pace But now if I move the mouse quickly it actually slowing it down It's actually making a little bit more accurate Which could be really useful as an assistive technology device if you have a bumpy ride You're on the train. It is the feather RP 2040 with USB host It is the feather RP 2040 Yeah, sure, maybe that'll just keep looping over and over again. Sorry about that Technical difficulties. They're the spice of life actually to paraphrase So, let's see what else have we got the By the way, yeah, like like I said, I'm excited about that that that feather and I'm hoping we can start to Develop some cool stuff for midi with that as well as other Other uses it's Arduino only right now, but maybe we'll get development in circuit Python for it We'll see that could be could be tricky the kind of speeds required, but who knows But exciting times and and I am I have one right here I am a big fan of These these feathers that scrunch everything up to one end so that we can fit a cool Accessory on the end. What do we have so far? We've got the DVI feather we've got the USB is that it right now? I think there's probably some others that lady. It has been working on So how about this next up? I've got a cool. I think a cool little circuit Python Parsec for you So check this out All right, so for the circuit Python Parsec today I wanted to show you how to do a really nice type of color blending with neopixels inside of circuit Python So what you can see here? I've got a blend of colors going from red to green So I'm specifying two endpoints and the code here is solving the color gradation between them So what I'll do. Let me just do a little demo. I'm gonna give it a different color. I've defined some colors here So how about I'm gonna go from blue to Yellow and I'll hit save and what you'll see here is that it is going to calculate for Eight steps. That's how many pixels I'm telling it to do this between The RGB values that fade it from red green blue color components of one color into another Now if I go ahead and Run the full code you'll see here Really nice results from the full 64 pixels we get much more gradual gradations here So you can see I'm going from red to blue then the next one here is teal to amber and then magenta to amber Really like that amber So you can do this with any colors you want and the way this works is in my code I've imported neopixel. I've set up a 64 neopixel strip and then I've defined a bunch of colors And then I'm using these two key functions here This function is I called create gradient and it wants a start color and end color and the number of pixels And what this does is it goes through and creates this variable called step r step g and step b And these are the difference or delta between the color component that we're starting with and the color component that we're ending with We then cast those to a list called gradient that has each of those tuples of RGB values for the 64 steps that we're going to be going through Then I have another little function here called display gradient that just takes the number of LEDs I want to use the start color the end color and how quickly I want to do it and it feeds that into my Function that creates the gradient then I've also got a function here for convenience called blank screen So the main code here is just doing display gradient 64 and then a couple of colors I wait a little bit for that blank screen and then Do that all over again And so this is one way that you can create a really nice color gradient between two colors inside of circuit python And that is your circuit python parsec Yeah, let's look at those gradations for for a moment here. Oh, you know, unfortunately my Camera capture here is pretty good, but not great for for color rendition So some of these are looking even better in real life This one here has a little bit more pink at the at the top of it as it as it gradates down there You can also see we get some funny little Neopixel refresh rate stuff going on that the camera is picking up that probably looks looks Yeah, looks kind of cool if you go go sideways with it because it's always a sort of a scan line thing so and I also mentioned there are ways to do this in hue hue saturation value HSV color model in the rainbow IO but one of the the cool things that you can get here in Going through the RGB gradation is you can pass through black Which you can't really do with the hue saturation value because it's Just running around the circle that the hue part of the circle without adding extra components to it So you can see here if I do Let me adjust the code here, and I'll go from how about orange To black that'll just oh that's gonna do it over eight pixels. Let's do it over 64 look nice running running running There we go so to be able to fade through Through the sort of center of the color circle is difficult in HSV But kind of straightforward in in the RGB color space, which is cool And you can also imagine doing things with gamma correction There's some cool stuff that Phil B is posted about gamma correction will give you a more perceptually linear rather than the exponential type of Color transitions that we get with just straight-up RGB. That's fun stuff you can do with color This is just by the way a feather plugged into a eight by eight Neopixel Matrix and then I've got some some nice little 3d printed. I think this was designed by Noah and Pedro for one of their projects is a nice little sort of color separation or light separation blocker grill and then I put some of our LED Plastic on top the acrylic for diffusion. All right, so let's see what else is going on. Let me check out the Anything else going on in the chat. No, it looks like we're good so projects. Yeah, so I have I've demoed this guy and I think we're just about done just about wrapped up But one thing I did want to maybe do is demo it with better sound So I demo demonstrated some of this last night on Show and tell but it was really just that little speaker being picked up on my lapel Mike, so what I'm gonna do is actually try to use a Guitar cabinet microphone if I have a long enough cable on here. There we go And we'll see if I can get this to Give you a nicer mix of the sound here. So Just get a little bit set up here. So I'll show you this is the the mic. I'm using Right there. So that's designed to This is a Sennheiser. I believe and it's designed to be put in front of a guitar cabinet to mic the speaker on a guitar cabinet and what I'll do I'll actually hold that right about there and I'm gonna turn on a second Fader on my mixer here. So that's gonna bring this one in Please tell me if there are any horrible feedbacks and screaming noises that are that are bugging you It shouldn't be but like that happens. Let me know And what I'll do is I'll grab a battery Plug in The computer perfection Synthesizer and so if you're new joining us and you haven't seen this before this is a 1979 Toy that I gutted and replaced the innards with a Metro M7 that's running our circuit Python synth IO Library to do some sort of drone synthesizer sounds. So this is gonna hold notes when I press them I'll just demonstrate that as well as the ability to change the Speed or frequency of a low frequency oscillator that's modulating Sort of the timbre of the sound as we move between a couple of wave shapes. So let me start so I'm gonna Turn up that sound and I'll just wait a moment to hear if you can hear both me and the sound Or if I need to back off of either of those so There's a slight delay in broadcast. So it might be a little faster on twitch if you're watching there But I'm gonna wait a moment to hear What you can hear before I go Demonstrating that any further and Let's see. We got a fader symbol. Okay, perfect. Thanks Charles B. Appreciate that. Okay, so This green button here I am repurposing to Cycle between different speeds that I've set for that low frequency oscillator that shifts the waveform So I'm gonna tap it once to increase that speed So you can hear this is a sine wave That is being used to adjust that mix of two wave shapes Tap it again faster Okay, we can of course get bored of those sounds and add some new notes in can also Hold down this red button to add one octave below the current pitch. So what I'll do is cut the sustain So it'll fade back out now. I'll Hold that red button while I press a note and we're gonna get an octave below it as well as the original note Hard to do this way. Yeah, that'll work So now we get a nice rich deep tone as well as the octave above it means we got a lot of rich Harmonics a lot of rich frequencies to hear as we pan between them with that low frequency oscillator And now I can long press That button to hold to start to slow down that LFO I'm gonna get this real slow. I'm gonna get as slow as I've got it get this nice Movement to the sound there. I also have a different set of waveforms that we can mix between so if I move this switch here This one has a mix of I think it's a sawtooth wave on one side and a sine wave No, sorry and noise on the other just pure white noise That's the top speed that I've got there and you don't have to sustain it You can just play notes Go back to the other waveform and you could set those to be any notes I have two sets of repeating five note intervals that I have on there So that's it. You've you've probably seen a lot of of this guy by now Also, I'll show off a little more there. I've got my Neopixels doing their thing Which is when a note gets pressed the two adjacent Neopixels light up with that little very High-density thin Neopixel strip that I put in there. So I'm gonna turn that Microphone off there. We will use that again later. I think because there was something else I wanted to demonstrate on a different synthesizer But You can see hopefully why It's so exciting that we've gotten mostly from Jeff Epler. Thank you again. Jepler this ability to both create the LFOs and to assign them to other parameters because if without that we would be left Trying to add knobs that that we would have to manually move to do those kinds of adjustments or faders or whatever Which are nice and fun to have as well, but you only have so many arms So pointing LFOs as modulation sources at other things is really nice Yanisco, thank you. He said nice coloring on the lights. I think you're talking about these. I had no option other than red Even if I set these Neopixels to be green or blue Red is the only thing that's coming through this really nice plastic filter on here So that's the option you get you get red And I can't remember if it filters it out to the point I think you don't really see it very well if you try doing like a pure green I just I think it doesn't look like much of anything at all In fact, that might be a fun fun thing to explore for a second. What why not? Let me Let me plug This into my computer, I'll show you the code and we'll noodle with it a little bit and We can we can look at what the lights do if we try Setting those to other colors. So let me find a free USB port here A lot of things plugged in and I'm gonna switch cameras to How about that mode right there? Let me Open up, please don't do that weird thing. All right, hold on. I'm gonna hopefully I didn't just ruin This is not the code editor you I use normally. Oh It's that's why it's Two things plugged in. Okay, I shouldn't have ruined everything, but we'll find out Yay. Okay. It didn't overwrite it. So I'm gonna take the exposure up a bit Okay, you can see that pretty well and And Take the color correct this a little bit that looks pretty much like it does in real life. Okay So in the code here, you can see yeah, Andy Callaway, you can have any color you like so long as it's red. That's right So in my LED setup I'm doing this Pixel map which is what correlates the physical location of the Neopixels on the strip with the Kind of positions on the computer perfection. You can see here. I'm setting these to red Right here. If I go ahead and set those to Green and save this Okay, those are full brightness same brightness You don't see much and that's because of this red filter on here Probably the same with blue. They might be a little Blocked a little more. I think blue is On such an opposite end of the spectrum that barely any of that makes its way through that really strong red filtering of that plastic There we go. So now it's back back to being whoops There we go back to red. So in fact, we might get a slight brightness increase if I go full white, but I bet it's not much Yeah, it's it's not worth the Extra extra milliamps there to do that. So kind of neat kind of fun the Blue filter here, you can see that definitely cuts a lot of that red As soon as that goes down this this translucent blue Dome here, which by the way has survived since 1979 really nicely I'm amazed that this isn't brittle. This is a they've made this from a great plastic I also didn't yellow that much did not probably wasn't in the Sun Because a lot of the times the bromide bromine there's there's a Chemical inside of this plastic that's used to make it anti to make it fire retardant that often would Raise up to the surface and yellow these plastics on older gear from that era particularly computers that Put some green LEDs under the buttons. Oh Yeah, yep, by the way Did you see this? Let me let me show you this you will see I'm gonna get real close up If I do change that color You probably will see a little bit of light that's gonna reflect off of the button Base that doesn't go through the filter. So let me make let me Let me check my focus here for a second So I'm gonna do blue and You'll probably see Some blue light leaking around the edges there There it is. You see that a little blue light there Is is just bouncing off of there and not making its way through the filter, which is kind of neat alright, so Let's see. I think I've gone over most other code stuff on this Maybe I'll go through the guide when it's actually published next week and and run through some of it But otherwise it is All this good synth IO stuff. So Yay some stuff that I'll show About filtering next which is a feature that's that's happening right now that Jephler and Mark gambler Maybe some others are working on That will give us the ability to filter Certain frequencies from the sounds that we're hearing some from the sounds that we're playing So I think this would be a good time to talk about that I've probably talked about filtering before I've shown it a lot. You'll see you've probably noticed that Filters are one of the Favorite things to show off in synthesizer demonstrations and even just in playing music because they are very noticeable you can correlate a knob twiddle with a Big change in the in the sound based on the the character of the sound that you're hearing But I wanted to just give a Little demo here that I think will be helpful as we enter into doing some Filter stuff inside of synth IO, but I'm going to I'm going to demonstrate this with An existing synthesizer I have I've shown this before oops not over there back over here I've shown this synth before because it sounds great has a bazillion features that I like and Has some good visualization Of what's going on. So this is this synth. That's called the micro freak from Arturia I'm going to go ahead and Put it in focus first of all and I might I might focus in a little closer here That little OLED once it's fired up There we go This synth is either by the way, I don't have it updated But it is the the little synth that keeps on giving they've just updated the firmware To a 5.0 release that adds sampling and granular synthesis and some other features. So it's you know, it's software It's a digital synth. I Think the filters might be analog But most of this is digital so it can get major updates and software and they've been updating it over the years Which is great So I'm gonna go ahead and power this off of a USB battery. Hopefully that one lasts because it's a good way to avoid ground loops and again, I'm gonna turn on my Cabinet mic so that you can hear a mix of My voice in this in there Okay, so Tell me how that mix works Lower it for me Still hear myself So again, I'll wait a couple seconds here for the stream to catch up and let me know if you can actually hear me speaking As well as that Charles be not bad. Okay, would you would you want it changed in one direction or another more? I'm gonna move the mic a little closer There we go So that mic should not be picking up my voice too much it's pretty directional and Any other feedback? There comes the feedback. I'm watching the discord there Little more on the synth. Okay, great. I Guess I could watch my levels there. There we go. We're about even now. Okay, so I'll leave it at that Let me know if that's not adequate so what I'm gonna do here is I'm gonna go to a Basic Synth patch here Okay, so what you're hearing? It's a little bit buzzy, which is good. It's got some harmonics in it that are gonna be filterable So if you've got a nice buzzy sound Thanks, Tyeth That's working well as is Then what a filter can do is it can cut off upper frequencies if it's a low-pass filter It can cut off lower frequencies if it's a high-pass filter or it can cut off everything to the right and the left of a certain range If it's a band-pass filter and there are other types Notch filters and things but those are the three that are on here and you can see right here There's this thing that says Type LPF low-pass filter BPF band-pass filter HPF high-pass filter So we'll go with a low-pass filter right now and if I just Twiddle one of these knobs you'll see the Cut-off frequency is indicated as well as a nice little curve there So that's telling me that we're gonna cut off frequencies above 26.9 kilohertz And as I lower this My cut-off is happening lower and lower to where this becomes a really bassy muted kind of sound Okay, having it fully open like that means I'm really not cutting off any frequencies that that are audible If I do the High-pass filter same thing if I crank it all the way to the bottom It's cutting off anything below 16 Hertz, which I can't hear Probably a whale can but as I raise this I'm going to Cut off frequencies that are Increasing like from the bottom up so I'll only hear the upper stuff Okay, so that's what those do band-pass is right in the in the sort of middle it picks a Range that it runs with and I don't find myself using those as often. So let's go back to the low-pass filter and The second feature that we really enjoy playing around with with filters is a Parameter called resonance and what this does is it actually gives a little boost to the frequencies right at that cut-off point right at that little Knee where you see that shape drop off. You can peak that up. So Watch as I raise the resonance And then I can slide that around and I think that graph does a good idea a good job of showing you the idea Which is that we're actually boosting frequencies right at that edge of where we start cutting them off So we really emphasize that one part of the audible spectrum there Same with the high-pass filter Why Okay the Last thing I'll show about this is just and I've shown this sort of thing before But what I'm gonna do is I'm gonna move Whoops not that I'm gonna move the little camera of me out of the way here And update that What I'm gonna do is remember I've talked about this ability to take our in synth IO low-frequency oscillator objects and essentially Modulate other things with them. So if I want to automate Let me let me just hold a note or a chord Right. So if I want that to be constantly Moving in and out at this regular pace then I can take a low-frequency oscillator and modulate that cutoff frequency So it's just as if someone's sitting there doing this or you've hooked up a motor But we can do that in software So to do that I'll go And I'm gonna take this modulation matrix and I'm gonna just match up the columns and rows of the LFO and the cutoff and then I'll give it a Attenuation a certain percentage. I think this goes up to a hundred. Yeah, so I can say 50 ish percent So it won't totally cut off But we'll hear now Right, so it's like I'm moving that cutoff knob real fast. I can slow this LFO down with this rate knob and I can also Where is it I Want to be able to freely change that whereas the thing I'm looking for it's not in shape Now I can't remember how to tell it not to It's doing it in like time divisions of a beats per second right now And I can't remember how to tell it to stop doing it that way click you. Yeah, okay So now I can just pick a Frequency which is kind of more like how it works in synth. I owe and so that type of change in in the Speed or frequency of that LFO is what I'm doing on the computer perfection project with that one green button that I was tapping speeding it up slowing it down And we can make it a little more subtle by changing essentially the strength of this low-frequency oscillator on the modulation Target so the target here is this cutoff knob now. It's as if I'm Wiggling it, but not it's full range from zero to a hundred. I'm just wiggling it in what zero to 20 zero to six here Right, so it gives us a little more movement it's a little more useful Musically than a full sort of crazy effect often Not always some some musical benefit from that so Yeah, I think that covers the the upcoming Filter stuff. There's also the math blocks that are being used to add and multiply waves together Maybe I'll demonstrate something like that next week But that that's all I wanted to cover on that. So let me know if you have any thoughts or questions in the chat I'll I'll Like Gary tees comment when I was doing the high-pitched stuff said and all the dogs go wild Also, Todd has posted a pretty cool Synthesizer that's designed for kids. There's another one the Lip blocks I think is what it's called That looks exactly like a Fisher price toy Super cool. In fact, look at this thing. I was just talking to someone about this online blip blocks playtime engineering blip blocks They make three of them here's this one's hundred eighty nine dollars. I think they were doing a sale or special You'll you'll find them sometimes on a little bit of a discount, but full-blown Synthesizer that does all these things that I'm showing and talking about here except with an interface that's made to explore So you can see that and put a text on it to tell you what it's doing But if you look at the manual to show you oh, this thing's an LFO and you can direct it into one of these multiple targets Really cool gizmo there and they have a couple different ones and they have some new new version coming out That's like a sampler in the sequencer, but that one looks super cool I keep hoping I'm gonna find one of those at a good will or something at a thrift store for five bucks because they Think it's just a Fisher price toy and not a really cool synthesizer Anyway, that's the blip block So Let's see that takes us up to Okay, so I got some questions over in discord Okay, you're on says what version of circuit Python includes the new filters the beta 8.0.2. Is that what it is? Let me check. I think that's the one I've been using I was grabbing stuff from s3, but now I'm able to go right to The beta is the one I grabbed it from so if we go to Circuit Python.org Pick your board, let me make this a little bigger so Downloads up here This is the metro M7 that I'm running it on it'll run on other boards though I think the RP 2040s most of those will support it So 8.2.0 beta zero Is the one I've been using that has the oh sorry you asked about filters No I don't think filters are in that one. I think filters are in a s3 if Todd bought you It looks like you're answering or if jewellers around. I haven't played with the filters yet So it is not merged. It's in a draft PR. Yeah, so that's 8048 Is where the filters are also by the way if you're curious about The development that's going on with these you can actually head to our Discord and in the Circuit Python dev topic or channel. There's a synth. I owe feedback Thread in there and you'll you'll find a bunch of discussion going on in there about our Development So whoops Where'd I go? Oh, I'm all over the place There that's where I went. Sorry. I got distracted. I just are reading my Texts there nothing scandalous. So let's jump back up to live broadcast chat. Here we go So, yeah, Steve you can you can check out filters there and the development of that I think jeppler has posted some demos of filter stuff that he's Been experimenting with and I think if you check out last night's show and tell There was a demo by gambler of some Synthesized drum sounds and I suspect he was using filters to Create those synthesized drum sounds. So he's got a he's got a gist up for that that he posted In the chat if you just scroll up a little bit earlier alright So, let's see. What are we up to now? Let's Let's take a hard right turn into PlayStation controller stuff. So Let me show this and talk about it. So this is a pretty unique PlayStation controller here That is from I think Takara Makes it there are consumer products electronics games manufacturer in Japan they never released this in the US, but this was for a PlayStation 1 Game of life game. So I don't know if it was licensed or just similar, but for anyone who grew up playing The game of life you recognize that spinner in the middle there, which is how you pick Your your randomizer life events and I think how far you move on the on the board and things like that so they made a Controller that you can see has pretty much the standard set of PlayStation 1 controller buttons So there's a d-pad. There's start select the two shoulder buttons are represented up at the top there L1 L2 R1 R2 and then the triangle circle square and X at the bottom right there. So what this Spinner does this is really something you'll see a lot in the kind of cool odd ball Controllers that that have often been created is that they're piggybacking on an existing Controller Protocol and so they got to find a way in their software to deal with only Expected events from the existing controllers, but add on their neat weird physical thingy So this was PSX or PlayStation 1 where there were no analog anything So the analog sticks didn't come until like think the DualShock 2 on the PlayStation 2 Maybe there was a PlayStation 1 that had had that simulated. I don't know But for this type of controller what they do is they piggyback on one of the other buttons and so much like a turbo button if you look at look at any controller that has a Turbo button on it. It's just spamming some existing key for you without you having to press it This thing turns out spams that Circle button right there When that gets spun So every time you spin that it's just pressing the circle button So the way that game must have worked is that it expected when you were when it was time for you to spin for your turn It probably I'm guessing ignored the circle button by only listening to Presses that start with a incredibly high rate. It's my guess but who knows maybe you could Cheat and go five spaces by pressing the circle five times real fast. I kind of doubt it So the way this thing works. Let me let me jump over here is by including an optical encoder wheel and Sensor so Right under there you can see there's a Little Probably infrared transmitter and infrared receiver Little package here if you can see that too. Well, there's some little shiny LEDs in there So this is a kind of like a break beam sensor it's going to reflect light off of this disk and then when black passes it's going to register that as a As a press and so as that spins by really fast it's counting those and Sending along the appropriate Button presses of the circle button to the game one of the neat things about this that I noticed is when You finish a spin it actually does that little bounce back and forth thing now since this does not have Uniquely Spaced slits on it or a second encoder. It can't tell direction So there are there are rotary encoders that can optical rotary encoders that can this one cannot so doesn't matter which way you spin it But this will register as another couple of extra hits at the end there So I don't know if they were using that to To any effect in parts of the game, but I'm guessing that moving around the board It's not a color sensor. It doesn't know what what color is under there, but it's just a set of steps So wherever you were that might you know be interpreted as 12 steps forward on the board so Phil Turone found this thing. He has a knack for finding unusual controllers and And sending him to me and saying hey go on eBay and get one of these things and see what we can do with it So first of all, I really dig this as a PlayStation controller. It's kind of if you ignore everything up here. It's kind of a nice NES shaped controller with the exception of these things up here and the extra buttons But these two these two and the d-pad are kind of an NES controller It had one of these player one player two switches on the bottom That were used in some games that were to player that could be played with two regular controllers Or if you have a special controller in order to make it fair You can pass it to player two and flip that switch Is how often that's set up this this a and b that it lists at the bottom there I think that's probably what that's for But what my first thought was is okay, this has the standard PlayStation I think it's a nine pin Port here and what you do is you go and you buy yourself For like three bucks one of these PlayStation extender cables, which you can then cut in half and now you have a Receiving side that you can plug into So in this case we have the pins on the controller and we can plug into this half here If you cut that in half you end up with I think they just have eight wires here Even though there are nine pins there I think is one just listed as unused if you look up the pinouts on them so I took these tinned them and Made myself a little breakout Which you can see here's little sort of temporary breakout that just breaks the Wires out to header pins and then I can run jumpers over into something else. So Googling this what I found was a PlayStation PSX and PS 2 controller library that had been written for Arduino There's a couple of them and one of those had been ported to circuit Python and runs on the Pico So I figured I give that one a try. So what I do here is just plug in the roulette wheel the game of life controller On one end and then I can plug into USB on this end on the computer and we can see what kind of Button presses it's going to register. So let me go ahead and Unplug the little synthesizer and put that away to This camera right here In the corner well again adjusted some camera settings if you don't mind Boop boop. Oh, that's saturation. I dropped it way down. Didn't I and it's very warm. Yeah, it looks more like real life Okay, let me focus that again Okay, I'll leave it like that so I'm gonna Again head on over here and plug that USB in Open up that code that's running on there and I'm gonna toggle a Terminal here. Okay, so now see some serial output. So I'm gonna leave the cursor down here for a second. So we just see Some Buttons getting read. So what I have is a Or print statement that'll show me the Button within one of the two eight bit bit masks. Oh, I've got a double me on there and In the case of I think it's basically One half of the controller and the other half the controller it sends these I believe bit masks of which buttons are pressed All as one kind of quick report. So it's not slowed down and sending one report per button and I'm also printing out time monotonic just so if I'm holding something I can see it Kind of increasing. That's just a thing. I like to do to be able to tell When I'm Holding a button down because sometimes you can see on this side. I'm not Now I can't tell if it's registering presses or not So quick quick easy way to change that if you're pressing the same thing over and over again It's just to print time monotonic along with the button press. So the code for that you can see right here And I'll increase that size a little bit make it a little easier to see So that's that's just happening on some of these so what happens when I spin the controller You can see I'm getting Whoa get my cursor out of there. I'm getting a bunch of these presses of Button five which is the same as the circle button over here So those are Sending all on that side. This is sending on this side and then what this code does is it is Converting those into USB HID keyboard presses So this let me let me show the The library for a second. That's not it Okay, so this is the one that I found that I'm using right now. It seems to Be a good start, but it is very slow at sending the the keyboard presses and I'm not sure what's what's throttling that It seems like it's kind of choking So I'm gonna look at some of those Arduino libraries and and some other Code and sources of inspiration for getting this to to work well But this was a great way to start because it's gives you a nice fritzing diagram there of how to Plug in the controller wiring into your Pico. So it's reading on a bunch of GPIO pins and then it just is getting power and ground I Think it wants five volt. I think anywhere from five to seven point two or something like that is what the PlayStation controller wants So anyway, if that if that's interesting to you, this is none Dan none Dan here Pi Pi ps2 And there's a version of this for the ps2 controller with analog and rumble and then there's the version I'm using which does not have those features So What you'll see if I go ahead and click up in the code editor here I'm just gonna put a Comment line. So if I press Oh Triangle X square those happen to be In code correlated to send the O I K and L if I press the d-pad W a S D or W a S D there we go So all of the buttons on here just press Keyboard commands, which is a great way to use this sort of thing if you just want to plug it into a computer and then map your keys Let's say in an emulator or something like that map your key presses to Or your button presses on the controller to key presses Especially simple when you're not doing stuff like an analog the Issue that I'm having here is when I when I spin the spinner. It's a it's gonna press the O button But it doesn't Really press it as many times as it should so I think something is going on with the timing and the the flooding of the USB HID keyboard Commands so it's just given up it'll It'll send one or two But it's choking quickly so I expect to see pretty much the same number of those or close to it as the The serial read and that could be I have a I may have a Unrealistic expectation there of how quickly USB HID can press stuff, but you'll see if I just press if I spam Some of these keys it can it can handle that kind of a rate I Think the controller in here will not Respond to the Sensor the rotary encoder until it gets above a certain rate so you can see if I just click this it's not Oh, let me add some other stuff so That's me clicking it three times Those don't seem to show up. So I've got to give it a bit of a spin for those to show up So that's the issues that I'm dealing with there The question is what to do with it so Phil the more we're talking about might be fun to do one of the Clicking types of games tapping types of games You see these on the iPhone a lot, but they probably exist also on the PC I haven't looked to probably find some on HIO or somewhere like that But games where you're just spamming some button a bunch it might be fun to be able to just spin this Like I said, it's not Directional so we can't use this to To pretend we have a rotary encoder and do a game of Pong or brick out or something like that arcanoid Doesn't know what direction that you're spinning it in so it's really just a button presser with with some panache so let me know if you have any thoughts on Ways to use this as well as ideas on what might be Broken with it at the moment in the code there if you want to take a look at that So that is what I've got with the PlayStation controller and That's pretty much it. That's what I've got for you for today. I will mention again. We have a Coupon code for you that'll get you 10% off in the store. So on the way out type in roulette And that will get you a nice big savings as you head out And that is like I say good on any stuff you can buy any of the new products I won't work on gift certificate software subscriptions. So just get some real stuff Anyway, that is it for for me for today. Thank you all for stopping by Dave Odessa, maybe I'll do 1080p next week. Maybe I'll be brave. We'll see See how that goes. I'm just so happy that I'm mostly knock wood Not getting drop frames and things at the moment. All right That is it. Thank you everybody for stopping by for a different industries. I'm John Park and this has been John Park's workshop Please tune in tomorrow for deep dive with foamy guy then come on back next week for another product pick of the week Three hangouts show and tell ask an engineer and more Thanks, everyone. Bye. Bye