 and welcome to the show it's me John Park and here we are with John Park's workshop first of all I want to thank everyone for stopping by we've got a a bunch of great people over in our chat if you're wondering where the chat happens on these shows it's over on discord so go to Adafruit's discord server that's adafruit.it slash discord you'll get an instant invite head on over there and check out the live broadcast channel that's where we've got some good people hanging out and so what I want to do next is ask for your feedback on my audio because I had to do a slightly different setup today than I usually do because of some audio stuff we're going to be doing later and so what I am hoping is that we we don't get any feedback and weirdness so it sounds like C Grover in the chat says the mic is sounding great peaking at negative 6 dB which is excellent and and I'll and I'll ask you later when I turn up the the second sound input how things go so thank you thanks for watching out for for that for me let's see what else is going on we have hopefully a smoother show in store today as far as the bits traveling through the internet because I have dropped the resolution of the show hopefully didn't notice but I'm dropping it down to 720p instead of 1080p just because we're hitting a lot of speed bumps in the encoding heading through restream and into YouTube I'm not sure where the bottleneck was could be my my internet provider who knows but this is this is an experiment in seeing how smooth it is looks like so far my dashboard in YouTube is saying excellent connection which hey that's nice because that's not the sort of thing it was saying to me last time it was it was all angry all right well let's see before we go any further I want to mention some little housekeeping items such as our jobs board so if you head on over to jobs dot a to fruit dot com you can check out our jobs board we've got all kinds of positions posted up there by people who are looking to hire perhaps you I know it's not like to point but perhaps you you know that's how they point at Disney oh you can't see it I think it's maybe three fingers in the thumb maybe that's an inoffensive gesture I don't know got gaffer's tape on my bandaid today by the way the bandaid wouldn't stay shut if you head over to a to fruits jobs board you can post your resume if you're looking for working you can also look for jobs it's all free all you need to do is log in and with a a to fruit log in and then you can use it for all of your job hunting and people hiring needs and that can be freelance work it can be full-time part-time contract remote on location all sorts of possibilities all right let's see what else I've got this show that happens on Tuesdays it's JP's product pick of the week that's the little logo right there and on that show we spend about 15 20 minutes looking at a new or favorite product sometimes it's an oldie but goodie sometimes it's brand new some sometimes it's in between and this week I looked at the itsy bitsy RP 2040 not to be confused for Blade Runner 2049 but maybe maybe I'm adding to that confusion I don't know okay I do know and one of the cool things is you will usually get a pretty significant discount on the product pick of the week this week it was 50% off on those it's a bit see RP 2040s and then I like to do a little demonstration of the product in action as well as a recap and that's what you're gonna see now it's a little one-minute excerpt it is the itsy bitsy RP 2040 a powerful little board we've got lots of flash on there lots of GPIO pins can do circuit Python on there all day long and I'll show you a little project that I put together because you may ask yourself well what kind of project would I want lots and lots of GPIO pins for in a small form factor so you can see I've got my little itsy bitsy plugged into a small breadboard there and then I'm breadboarding these wires into key bit that I pulled out of an old synthesizer it's a eight column and eight row diode matrix that means I need 16 pins plugged into my itsy bitsy and I have some leftover pins that I decided to plug in a little neopixel strip using our keypad library I can read the diode matrix and know which keys I'm pressing I decided to have it send off MIDI commands and at the same time send commands to my neopixels to light up it's the itsy bitsy RP 2040 alright yeah so let us know what you do with yours I I tell you the itsy bitsy is a really cool form factor I love how much GPIO it's got and it's small size so love to hear what kind of projects you dream up with yours alright so how about next up let's let's dive into our circuit Python parsec yeah let's do that right wrong window hang on that's the one we want there we go alright let me get this set up here oh no someone said audio is out of sync is this audio out of sync now I'm gonna wait I'm gonna wait to dive into this for a second to see if we have any audio sync issues hopefully not it looks clear on this end so far but yeah the oh look yeah there's YouTube saying that it's having an issue okay well I'll tell you what I am going to kick the broadcast button hold on one second all right so that is my server restarting there and I'm gonna let it cook for a second before we get too much further and you let me know how the sink is the other thing is I am recording oh good okay back in sync that's what people say getting messages about this very thing I am all right good seems like we're we're back thank you for the warning thanks for letting me know all right let's get this ready I'm gonna bring up my atom window right here where'd you go Adam it's my little coding environment there and you know what I am gonna attempt to fate and fix something on the fly which is the size of this window could be improved so let me just do like so and here it comes yeah that's a little bit better okay are you ready I think I'm ready for the circuit Python parsec today I want to show how you can create a color helper module what is this all about well when I'm using neopixels I have certain colors that I like to use a lot I want to reuse these colors and rather than just copy and paste them from some document into my code what I've done here is created a separate file it's a separate module and you can see it right here it's just called JP colors dot pi and in this I have defined a bunch of colors that I like to use so red green blue you'll notice they're pretty much solid colors but not as bright as just going full-blown 255 or ff if you're using hex like I am here these are a little little dimmer which helps with evening things out and some of them are dimmer than others because of sort of gamma issues you'll also see here I've got this amber color that I really like to use a lot and it's not one that I typically remember a what exactly is amber what's a good formula for that so once you've tuned those and dialed those in once you can save those variables in a class here in this class I've created is called color I've defined a bunch of color values and then I save this as a separate module file on my circuit Python device then you'll see inside of my code dot pi when I want to use that I'm simply importing it right here from JP colors import colors that imports that class from that module file then whenever I want to use colors I can just simply call them by name down here so I'm I've created this little function called chase that creates these nice little chase effects and the only input that I have to that is what color chase are we going to do so if I want to use my amber color then I say chase color dot amber and the rest is taken care of for me so I have cyan magenta red black and white here so black is really off but it's easier to think of it that way and so that is a really simple way that you can create some variables that you want to reuse all over the place in a separate file and that is how you can create a color helper module inside of circuit Python and that is your circuit Python parsec yeah look at that beautiful amber color that's one of my favorite so it kind of feels like an old analog bulb sort of look a very very warm analog bulb or neon indicator bulb kind of look so I dig it all right let's see what else let's let's dive into some some new territory here today so I'm gonna bring up let's let's talk about okay so we got a couple things I want to do let's talk about this you're ready getting ready so the project that I was working on last week let me switch out what I've got under the down shooter here was this 4x4 keyboard show that to you right there okay so this is one of our ortho neo-key snap a parts see it back there under the frosted window and this is a QT PI M zero and I've put some jade switches on it and I've got some nice little windowed keycaps you can see they're a little LED flying across there and I'm gonna go ahead and set this under my camera and refocus that for you let's have a look here as I do that into better focus that's pretty good yeah we'll leave it like that okay so the code that I've written for this I just published it and I'm working on a guide for this this is done in Arduino and the reason I chose use Arduino in this case instead of circuit Python is that I'm using the itsy or not the itsy the QT PI M zero which just is so constrained for space that I wasn't gonna be able to put the keypad library MIDI and some of the other stuff that we needed on there so we went and went and said hello to our old friend Arduino and what I'll do is I'll show you first of all here's what I'm running on there and then we'll talk about what it does and how it does it and I'm gonna give you a bit of a backgrounder on driving a modular synthesizer it'll be a software modular synthesizer using this code so let me open up my Arduino window here so I can see it where are you there you are okay so what I'm doing in here is I'm importing the tiny USB library which is really nice allows me to work with USB MIDI really neatly I'm importing the keypad library so that Arduino keypad library works an awful lot like the one that Dan wrote in circuit Python then I've got Neopixel and I've got MIDI now you'll see here I'm setting a couple of user variables actually three of them that matter a lot oh and I will pause install for a second while that comes back into into play that's really frustrating I was hoping that dropping the bit rate of this was gonna fix issues and it seems to have caused some different ones this is also possible I'm running maybe ill-advisably I'm running VCV rack which is a resource heavy program in the background but this does not seem to be acting like a computer resource issue so much as an internet resource issue so we'll see so that should be back up and running and hopefully back up in sync and I'll wait and I can't remember if I mentioned but I am recording this also to disk so that I'll be able to have a clean sync version if necessary if we need to republish this later then sounding completely fine but the video gets iffy huh all right there's one other move that I can try next week which is to change the canvas size all right so looks like we're back in sync so in my sketch here in Arduino you'll see I've got a variable here called latch mode and on the keypad I wanted to be able to either latch keys which means I press them and they light up and they're doing something they continue to do something or have them be toggle sort of momentary so right now I have it in this sort of toggle or momentary mode you'll see I've also got the beats per minute so we can set the beats per minute of the program and that means that this little blinking that you're seeing going by here is set to a certain tempo that my music is gonna gonna be working in and then we also have a MIDI out channel so we can send this to different channels the next thing I do is I have a little bit of math to get me the beats per minute by dividing the beats per minute or rather dividing 60,000 which is the seconds by the beats per minute so 60,000 seconds in a minute I'm setting up my MIDI device here I'm setting up the keypad to be four by four or rows four columns and then I've got the pads that these are gonna be playing so this is a sort of remapping of if I press key zero it's gonna play MIDI note 57 which is an A and so I've got a couple of octaves of a little a major scale plus a little G sharp thrown in for style points then we've also got a pixel order remapping because the neopixels run in a snake pattern but the grid is a grid and then what's happening in the main body of the code is that we check keypad to see if any of the buttons have been pressed when they've been pressed we will then look and see if we're in toggle mode then it's just gonna yeah if we're in toggle or momentary mode I should say it'll just play the note and then release turn off the light if we're in the latch mode then it's gonna hold that and keep the color and the last thing I have down here is in my little sort of clock that's ticking at the tempo of the beats per minute I'm sending a MIDI clock signal so that MIDI software can read that and do something with it and I'm advancing my little red LED across so let's look at a better view of that actually here and I can pull the extra extra me out of there there we go so here you can see this is ticking along at 120 beats per minute and what I'll do now is this is where audio could get super iffy but check it out let's turn up all right so let me know if you can still hear me and the sound because I can I can mix that a little bit here or a lot here so here's the scales I have it's essentially two of the same scale and then the same one repeats there's a lot going on there thanks James folks as good mix appreciate it that's good news there's a lot going on in the synthesizer side of things that I'm gonna show in a second and particularly interesting is some of those effects that are dependent on the tempo so there's a few reasons why we would want to set a tempo when we're playing the synth one will be a drum I'm gonna pull in I want that to be in in synced clock time as well as some of these little modulations that you hear these little tremolo's and things those are happening also at the the frame the tempo or some multiple or division of the tempo that we've set if we want to check out for a second before I dive into that synth side of things if we want to go what happens with the latch mode being true currently this is sort of an idea a launching off point this program it is not feature complete for example it'd be really nice to hold down maybe the four corners and have that change my mode between latch and toggle or some other arrangement to get into a settings mode where we can adjust the beats per minute I don't have any of that right now I'm just gonna go and change that right here inside the Arduino sketch and and re-upload it so with more development time of course you can add a lot of really cool features and I'm always excited to see if people take something like this and run with it and do some cool stuff so uploading right now from Arduino crossing fingers that that doesn't just bring the whole thing crashing down to the ground it claims to be uploading that's good oh an error occurred while uploading what happened around it double check my settings here before I try that again cutie pie over 10 USB and I probably had the wrong port maybe the right port is picked and how many other plugged in that could show up a lot better what the device right now no it's not you know what I'm gonna power off this guy let's see it comes back up oh plug it back in hopefully it's not a demo worst-case scenario which is I've now so somehow bricked the thing all right it's compiling that's a good sign oh you're getting the max headroom effects oh right I'm gonna pause here for a second right I have just restarted it so if you said that it was paused on YouTube that is because I was sending them no data let's see if that kicks it back in and while that's going on I'll see if I can convince the board to come back to life it is acting super super bricked I may need to get to the reset there hold on thank you for your patience here we've got multiple weird things happening yeah okay this is not showing up hold on one second I am so by the way one flaw in my design I realized is I don't have a accessible reset button so drilling a tiny hole in the back case there might be a good idea so that we can get at that reset on the cutie pie be nice if we could use one of the key switches as a reset button during startup or something or through some key combo but I don't know if I don't know if you can tell the board to reset with anything other than the reset button so let's pull this right here oh okay that's good I see a sign of life telling Arduino to reupload to the board here so if you don't know this sometimes with Arduino if it's having a hard time putting it into sort of the soft reset mode you can double-click the the reset button while it's getting ready to upload and then it and then it's more likely to find the port so it looks like that worked in this case I'm gonna leave that back plastic off of there for now so now if that worked it's restarting I think it's pressing the reset button let me lift that up and off for a second let's pull the little kickstand up I think it was just sitting on the reset button hopefully that's all it's going on so now when I press a button what it should do is send the MIDI note on and never send the MIDI note off until I press it a second time so this is the latching mode so this is good if you want kind of a little background drone or something like that going on so that's just gonna hold those and then if I want to turn one of them off just press it a second time so what I want to do those I want to set this back to a temp fate and do it again so I'm gonna set this to false change my latch mode see if it's happier about that sort of soft reboot reset that it needs to do there I found it I think you can see hopefully you can see my little text down there so the toggle mode now non-latching mode more like a typical keyboard so that's working now so now what I want to do is especially because it seems like we have a working stream right let me know when this comes back in if we're back in sync and I shake my fist at streaming and internet yeah I cursed it I said it seems like we have a working stream and boom it froze okay so if this is working again what I think is I'm not gonna go into huge depth on this because I'm afraid we'll lose sync but the sort of key things that I wanted to do and maybe once I get this under under control another day we can do a deeper dive into this I may use a setup where vcv rack is running on a separate computer and acting as a as a display output because this could be causing some problems I haven't streamed this in in wirecast before but this is the setup that I have which looks a bit complex but the main things that matter the main things that are going on these are series of modules that each have sort of discrete tasks that they do and the first one here being this one called midi to CV so that's what's bringing in using the core midi driver you can see right there says Qt Pi M0 so that's what this 4x4 here is showing up as to my computer's a midi device over channel one and you'll see when I press a button that little gate icon is lighting up clock is always pulsing there and the volts pro octave is also sending out over these cables to a bunch of different places so these cables are routing essentially a conversion of the midi pitch information into what's known as volts per octave so in the modular Euro rack modular world a volt is one octave so partial volts equal the semitones that we can go through or sort of non-standard scales you can kind of sweep between any pitch you want using this voltage and gate to is a type of voltage that's sort of a square wave that just says turn on a voltage controlled amplifier or turn it back off so the fact that we hear something and you'll see this little display over here called VCA if I hit a bunch of them you can see it a little better right so that little VCA meter there that little green meter is opening and closing essentially an attenuator that allows the the sound to come through my clock is going through this clock divider and multiplier so that I can add in drums so here you'll see this is going to be in sync with my 120 beats per minute so that clock is in sync with the effects the other effects I mentioned I have some things like tremolo's or little modifying modulations that are going to be you'll hear them when I hold a note and those happen also in time that kind of stuff is happening also at some multiple of my clock we want to be able to set things in sync also it's kind of nice for me at least looking at the tempo marker going by on this little display here and I just like it looks cool it really shows off these these type of windowed keycaps of course we've got those neopixels on there lighting up I think there's a little bit of a glare on there but I think you can see that and so I think that's hopefully we're still in sync audio and video wise and what I'm going to do now is actually get away from that window I'm actually closed down vcv rack just in case that's been causing issues in the background there so let me switch camera views here and we'll say goodbye to vcv rack one of these days I will get my setup to be happy with that test that little more and and hopefully we'll be able to turn down that input there okay so it's not going to try to try to bring in that mic so let me know if you have any questions about that let me know of course if the stream is still happening and in sync I do not see any angry messages from YouTube so that's good now okay so on to the next thing so next thing I wanted to do was just sort of kick off a project and I I think you'll like this because it's a somewhat of a continuation of last week's project which is because when we don't want to waste anything and when we took this or I took this and turned it into unplug this one and turned it into this I had to remove some of these strips of of PCB keys there so we went from the 6x5 down to the 4x4 which means I have a bunch of extra leftover so here for example is a little chunk of 5 that I've got and what I want to do let me switch over to workbench here what I want to do is turn that little extra there into some sort of a little mini launch pad type of gizmo so the case I want to use is this really neat aluminum one let me switch switch cameras out there there we go so this is a little aluminum four key case that we have in the store having the Adafruit store so I'm gonna need to bust off one of these let's see what's the top that's the top that's the top so I can feed in my data for the neopixel from the top my voltage ground and column and then I'll connect to row row row not my boat so let's pry off a fourth one that I don't need and you can see how this is gonna lay in here and this is designed to have your keys snap right in from the top so this has the nice tight tolerance there zoom in a bit so you can see click click those will snap right in there and then we want to be able to click those into our little PCB and then there'll be a little bit of wiring necessary and we'll need a microcontroller in there so I was playing around with this a little bit and found out a few important things so this this is it's interesting lady it was talking on ask an engineer last night about the fact that it is awesome to start with your enclosure and then build your PCB and the rest of your project because once you've got the enclosure down enclosure down you can start measuring things or get some some technical drawings and make everything fit in this case I've got this enclosure but these already exist right these little these little PCBs here let me pry up the one that I sat into there these already exist and there's a bit of a mismatch here that we're gonna have to get creative about to make this work in this case and the reason is this has a little acrylic I haven't peeled the the backing off of there has this a little acrylic base that goes on here and that presumes a few things that presumes that you've got some holes here for your screws to go into it has little standoffs little brass standoffs and I went ahead and unscrewed one because these are actually threaded I think probably for m2 these are threaded the same as the screw that goes into there so we can actually start off by just gripping those with some pliers and do a little removal there it's just a tight fit there so it takes a bit of work to get that out and there we go okay so that will allow me to lay these flush flip it the other way so without if you don't remove these these are just not gonna fit because the the mounting holes are in in the way of this PCB so that'll be step one step two let's actually go ahead and pop in the rest of the keys here and by the way you could if you had a sort of horizontal set of these I don't any more I think I've snapped those all apart you could use this sideways like this and have your LEDs at the bottom but I'm gonna just set it up vertically at least for now see if I change my mind on that both are valid both are super useful ways to have a little macro pad and of course work in either orientation but if you want the LEDs at the bottom of the key or at the top of the key that's gonna work this way so now these will gently press fit into the PCB so that's good to go now and you can see this is the clearance that we have oh sorry let me switch switch my view around there this is the clearance that we have for a microcontroller so either a cutie pie cutie pie RP 2040 or a itsy-bitsy those will fit in there great in fact I think this case was probably designed for a micro USB as far as the the shape of that cut out it might have might have been meant for one flipped this way but you can see my my fit there of the itsy-bitsy is pretty good we might put some capped on tape to avoid any shorts there but if that goes in like that looks like micro USB cable fits in pretty nicely hey but there's no way that this this generic cover is gonna happily still screw into place and hold all that with the with the screws that it came with I've got no holes available for that so something different's gonna happen I have to happen and what I'm thinking doing is 3d printing a little extension to this that will allow us to to use the parts that we that we have here so this is just a somewhat happy accident this piece of 3d printed case that I had from a different project fits in there nicely just kind of gave me the idea of what we could do which would be add a little extension there that the itsy-bitsy can fit in we'll need a hole there so that the USB port still fits in place and maybe get that to you'd see I have one mounting hole that is still visible there it might shave a little off of that PCB that's in a non-critical part or might come out come up with some other method maybe it's just a really good tight press fit maybe you just want to put some foam tape in there or something but if if we have a little extender like that it doesn't have to be this tall just a little bit so maybe a two millimeter extension on there would be enough to do everything we want and then we can still use this pretty neatly so that's the the kickoff there of of what I'm planning to do and stay tuned so that'll that'll be some 3d printing and and design that'll do and maybe we'll we'll get into that on air but for now that's that's where I'm at with that and if I get a nice nice easy method using a 3d printed part for that I'll of course share that in a guide so that you can grab that and and use your own the reason of course for for this being necessary is that these type of cases are really designed for you to make a custom PCB that has your microcontroller and your keyboard key switch PCB all sort of built into one designed to fit this space with screw holes and mounting and all that and then this will fit on top of it or you could do some hand wiring of switches and just need to fit the microcontroller in there but not a lot of space so I'm gonna extend that a little bit so there you go that's the idea behind that that's a kickoff of that project and let's see you know I'm curious to find out let's jump back over into the discord how are we doing on our sink can we sort of safely blame vcv rack for hogging resources somehow I think it looks like this the stream is healthy at least YouTube is saying excellent connection right now so maybe that was not such a great idea on my part to to have vcv rack open on the same machine I don't know I think there's other people who stream vcv rack stuff so who knows what's going on see Grover says nice switch case enough room left over for piezo buzzer yeah that would be a fun addition in there looks like some people are sharing their their projects using the ortho snapper parts there's a picture from doctor about a little setup going on let's see so there's a question here screwed up snapping my ortho's apart making a split keyboard forgot they were zigzags so now I have rows that are all out on one side do I need to not zigzag numbers in my neopixel matrix for the keypad let me see let me look at the picture here a little bigger so from what I can tell you just need to run one wire from the end of one row to the beginning of another row that's your neopixel out to your neopixel in and then you'll be able to treat it as one is that right oh no wait no I'm you're right you're fine actually yeah the the neopixel will will run this way so that should be fine unless you see oh I see so you have some snapper parts there that I'm not saying okay yeah so just run your neopixel out to your neopixel in at one end and then it will do this the sort of u-turn shape and you do need to solder all your V ins coming down all your grounds coming down all your columns coming down and then you'll go into the rows on the side of it so you can probably look at the example fritzing that I put up for the numpad 4000 because that one I had some break apart situation and hopefully we're back and hopefully back in sync so yeah boy that's frustrating I don't know what the heck is causing that because apparently is not our VCV rack oh well so yeah doctor following up just make sure you have the logic the rest of the keyboard still zigzags yeah and that you can take care of in your your two little lists there of which keys are correlated to which matrix buttons alright well I think we're gonna cut our losses here before the thing goes back out of sync thanks so much for stopping by today and I appreciate you putting up with wacky AV issues it's a challenge and I appreciate you being here for it so thank you everyone and I will see you next week with another JP's product pick of the week on Tuesday and another JP's workshop on Thursday thanks everyone and see you next time bye bye