 there we go. The machines have taken over. Could hear me a little too well. That was too much. So, hey, here we are. It's time for another episode of John Park's workshop. Thanks everyone for stopping by over in our chat. DJ Devon III said I've literally been pressure washing all day. Would be nice to do it virtually. We will, yeah, we'll be taking a look at some of a couple of projects today and that'll be one of them is the pressure washer simulator, power wash simulator game. Let me know in the chat, did the echo go away? I'll wait a moment before I dive into anything too significant to see if that has taken care of itself. I think it will. Who knows what's going on? What did I change? I don't think I touched anything. I promise. Something changed itself. So, I see people typing over in our chat. Let's see what the verdict is. This is our chat, by the way, if you're wondering. Head on over to adafrew.it slash discord and you can jump into our Discord chat. Good. Thanks, Jeff. No echo here now. Good. There was just that moment of echo, I think. And so that's our Discord chat. You can head over there if you're looking for a chat if you're somewhere like Twitch and you don't know where all the people are. That's our live broadcast chat channel on our Discord server. It's a good place to check out. Also, the YouTube chat. Hello to David Dessa and Johnny Bergdahl for stopping by over in there in the YouTube. So, let's get on with it. What's going on here? I've got a discount code for you. I have a recap of the product pick of the week. I've got a new Circuit Python parsec, and this is going to be the first one after wrapping up the Circuit Playground series. So, thanks for hanging out for those. It's time to move on. We've exhausted the Circuit Playground library commands as far as I know. We've done all of the things that you can do with Circuit Playground as far as sort of the high-level commands for these boards, for the Circuit Playground Express, Circuit Playground Blue Fruit. So, I've got a new non-Blue Fruit, non-Circular Playground Express, non-Playground parsec for you today. And then we'll talk about a couple of projects that are some updates, really, some ongoing projects. I've got the Lego Brick color sensor for the color synthesizer, color sensor synthesizer, that's not easy to say, as well as starting to put together the pressure washer nozzle. And I've got a coupon code for you today, and what I want you to do is pretend that you don't see this, because I think this is going to auto show up, and that's not actually it. I've got to change that, because I forgot to. There's today's coupon code. That should not be in a let's change the typeface, too. Let's put that in bold, not black. There we go. Coupon code today is nozzles. It's fun to say, and it's fun to get 10% off on your order. So, if you want to head over to Adafruit, if you want to look for some stuff to get to make your project come to life, then head on over to Adafruit.com. You can head to the main page here and then look for some products, some new products, some search, however you want to, but if you find some things you want and then head on out to the checkout in the checkout, there will be a coupon code slot, and you can type in nozzles, and that's going to get you 10% off. Wait, is it plural? I hope it is. No, it's not. It's nozzle. Oh, no. I'm telling false information. Sorry about that. Nozzle, just one. Oh, man. I hope that didn't screw anyone up, but there we go. Nozzle, singular. That's the coupon code, not the other thing. That was a lie. Nozzle, 10% off. Head over to Adafruit, and by the way, when you're there, when you're here in the store and you want to get some free stuff along with your discount, then just head on over to Adafruit.com slash free. That will tell you what we've got for free with your order, depending on how much you spend. This, by the way, is how we keep things running here at Adafruit. We sell these things to you, and then we get to make more things and show them to you and document them and write up guides and do videos. But it's all about these things, I know. It's very capitalistic of us, but there you go. That's how it works. However, if you want to get some freebies and you have some bigger plans in mind and have a bigger order in mind, if you head over the $99 or higher level, you're going to get a free PCB coaster. That's that aluminum coaster with the gold plating with the Adafruit logo. If you go to the 149 or more level, you'll get the coaster and you're going to get a KB2040, our keyboard, beloved keyboard microcontroller. If you spend $199 or more, you will get free UPS ground shipping in the continental U.S. as well as the KB2040 and the coaster. If you go all the way up to $299 or more, you're going to get a free Metro M7. This is the SD card version. It's the one that's red and says Digi-Key and NXP on it. That will stack with all the others so you'll get the Metro M7 for free, the ground shipping in the U.S. with UPS for free, the KB2040 for free, and the coaster for free. Those are some things that you can get if you have big order plans, but either way to slice it, you can get 10% off of your order today until about midnight East Coast time in the U.S. when it turns off and goes away with this coupon code right here, nozzle. Go get yourself some stuff. Maybe you'll be inspired by some things you see on today's show or elsewhere on the Adafruit social media channels or you've got some plans of your own in mind. I've got a question over in YouTube. If I say nozzle twice, can I get 20% off? I'm going to say no. I'm going to guess that doesn't work. So let's see. What else have we got here? Let's jump into the product pick of the week. So on Tuesdays I have the product pick of the week show. That was this one right here, the man crow, return of the man crow. Nothing you've ever witnessed before has prepared you for the man crow. Why you may ask? Well, that's because this week's product pick of the week was a feather and that's all it took, maybe that in the season. All it took for me to welcome our familiar, our friend man crow into the scene. But what I do on the show on Tuesdays is I pick a cool product. It's maybe something new. It's maybe something old. It's maybe something returned. That's why this one was the return because we didn't have these for a long time. The Atzymd 51 chips were nowhere to be found during the parts shortage and so we couldn't make the feather M4 but it really has always been one of my favorite feathers and now we've got it back, back in force. We got a lot of these chips so we were able to make them. Here is a little one minute recap of the show. Check it out. The feather M4 Express, one of my favorites, one of the original high power, high octane, heavy duty feather boards. This one uses the Atzymd 51. It is a powerhouse of a chip. You can run Arduino on it really well. You can run circuit Python on it incredibly well, especially with floating point math. It has this lovely little prototyping area. You can use this little proto area here. There are a set of ground and three volt pins at the edges and then you have this little grid here of pins that you can use. I've just added a potentiometer right there. I'm using my little knob to adjust some brightness values there. I can hit the different buttons here to change some colors. I can even adjust some of these color values with my joystick here. We are so excited. This one is back in stock. Like I said, it's been a while. The return of the feather M4 Express. Yeah, that was it. Hopefully you could hear that because I couldn't. What is going on with this audio? It's the audio monitoring that's funny. Let me know in the chat, in the YouTube chat or in the Discord chat if that video played with audio. I'd love to know. Let's see, Devon 3 is typing. Is it going to be anything? Oh my gosh, the suspense is killing me. There's so many three dots. Three dots. Look at it. Look at those dots right there. Nothing yet. Weird glitches. You got weird glitches. I don't know what's happening. Sorry about that. You did hear it though. Okay, thanks, Jeff. Sounds okay, Devonessa. I don't know what's going on with glitches. Weird. Okay, moving on, let's jump into a little Circuit Python Parsec. We'll get all set up here and show you this one. Check it out. Good suggestion. Pen Pengu said, if you need help with audio, check out the Adafruit Discord server as an extra channel with help with audio. Maybe I can figure out a good way to preview this without it just broadcasting everywhere. That's a pain. All right, but here we go. Get ready for it. Here's the Circuit Python Parsec. For the Circuit Python Parsec today, I wanted to show you how to invert text labels in order to highlight them in your displays. You can see an example here. I have a little macro pad controller and I'm using it to control this M8 audio tracker. When I am pressing the keys on my little keypad, you can see I'm getting nice little highlights up here on the screen of the macro pad. This is a Raspberry Pi based thing. I can go full screen or windowed mode. I can play audio and you'll see the little play button highlight. Pause that. Maybe I'm going to edit mode and this is where it really shines because you can see here I'm holding down this edit key and I get feedback that that key is held, especially useful if you don't have labels on your keycaps that are exact. I can edit this value here up and down and play and stop that right there. Before I go into the code for that, I want to show you an example. I'm going to plug this one in over here on a different device. This is on a Pi Gamer. Pause that. Let me fire this up and make sure that that guy is in good focus here. I just have this one cycling and I'm just going to mess with my brightness for a second so that the colors don't get washed out. There you go. You can see we've got some nice green highlighting going on there of the letters. The way this works is when you set up display IO text labels. You can see here an Adafruit display text. I'm importing bitmap label as label. When I am doing anything with the labels, I'm setting a background color for the label. You can see this one right here. In fact, you know what? Let me reopen. That's the code from the macro pad. Let me open the code on the Pi Gamer here and start that explanation anew. Here we go. Anytime I'm working with this display IO layout and display IO text, I can use the import bitmap label as label. Then I'm using those to not only write text but also set the color of the text and the background of the text. It's kind of automatic. You don't have to use rectangles or anything. It's just a background color for every piece of text, kind of like highlighting, which is how we're using it here. If you look at what I'm doing in the main loop of the program here, you can see I set labels color. This is one of the 12 or 15 labels I have. Labels color to black, and then I'm setting the background color to green. That's 00FF00, so that's hex for green. Then I wait a quarter of a second. Then I set the color of the text to white with labels dot color, and I set the background to black with labels dot background color. That's a really nice way to highlight your messages without having to do a whole lot of work on the screen here, and it works for OLED screens like that first example, or TFT screens like this one here on the Pi Gamer. That is how you can highlight text and text backgrounds with color inside of Circuit Python using bitmap labels. That is your Circuit Python Parsec. I have no idea if that played the song because again, I can't learn the audio, so it probably went Circuit Python Parsec. There you go. Hopefully that was useful. I like someone's comment. Andy Cowley said, getting a Lotus123 vibe with that display. Yeah, what more do you need? Everything's gotten so fancy. You just need some mono spaced text with some highlighting. That'll work just fine. You can see, by the way, in the bottom example here, I'm also just using it on empty labels. Those are just quotes and spaces, also a nice way quickly inexpensively to make some little highlighting bars without having to draw rectangles or use any of those techniques. All right, let me turn down the volume of that so that doesn't freak me out any. This thing, by the way, I think I've shown it before, but I wanted to show it again because I haven't had it out in a while. It's kind of cool. This, let me fix the focus, and I'll brighten that display exposure that way. This is a Raspberry Pi. This is a 4, and I've got one of these heat sink cases, these aluminum cases. I don't have the top heat sink, but it's actually not so hot that it's freaking out. I have one of these nice Pimeroni displays on here. This was actually a touch display, so you can use that. Let me go to you can use that to move a cursor around on there. This is the Dirty Wave Mate or M8 headless version. This is actually running code on a teensie for the synthesizer code, just using the Raspberry Pi as a display, basically, and then I've got my little macro pad as my input. There is a real version of this that's actual hardware that's much, much cooler, much better than this. Look at that sometime if you're interested in small pocket-sized sequencer, tracker, synthesizer, gizmos. It's the Dirty Wave M8. All right, get that out of the way there. Let's see, what else have we got going on here? Yeah, Todd Bott mentions I forgot about grid layout. That is another piece of the puzzle here. Let's go back to this for a second. That is another piece of the puzzle here. You can create these display IO layout, library grid layout, and then it will do a lot of the complicated spacing for you to just lay out text labels on a grid, or I'm sure you can use things other than the text labels. But these are pretty easy to set up. You can see here I've got just this one list here of the text objects, and those get populated into this grid, which you can set up positioning of it, the width and the height of it. I actually didn't edit this to fit this screen just because I had pulled that code off of my macro pad. But if you look here, actually, this will be a little experiment in adjusting this live. Let me ditch that exposure a little. There we go. If we increase the height of this, let's say to, I don't know what this screen is, let's try 64 and save that. That should have widened it out. Let's see. Getting bigger and bigger, we can go wider with it too. Let's try 164 bigger, 200, maybe too wide. Yeah, so you can see you can kind of fill the existing area there. There's self padding values here. We can increase the number of spaces between things to fill it out. This is all math you could probably do, by the way, just knowing how many cells, rows and columns you want in your grid, as well as the size of the display you're working with. So you could do some nice little math to auto fit different screens, which is convenient if you're porting your code from device to device. This one's on a pi gamer. Be the same screen for a pi badge, but a little different on something like a clue, something like the macro pad. So that'd be a nice way to make your code portable. Yeah, so that's the, thanks for mentioning that, Todd. That's the grid layout inside of display IO layout. So maybe I'll do a separate, maybe it'd be cool to do a separate parsec on that, re-familiarize myself with it. Let's see, there was another question. Touch deck. Oh, yeah, DJ Devon 3. The touch deck, I think I, that's right, it's a TFT touch feather wing with a feather. I think feather M4, do I have it back there? I don't know where I moved it to, honestly. But yeah, that also used, I think that used the grid layout in order to populate the buttons there. I think that was code from, oh, thanks stuff with Kirby. Hey, nice to see you, it's been a while. 160 by 128 is the size of this thing. Does it let you use the full size of that? Why did it let me make it 200? I guess I just have space hanging off the edge. That was FOMI guy code, I believe the touch deck was based on FOMI guy code, if I'm not mistaken. Or he at least advised me on it. Okay, let's now move on to a couple of projects. So, you can see today's show name down there, let me go to a bigger camera, nozzles and chimes, which for those of you in the Eurorack world, I decided would be a really good name for a Eurorack module. Sounds like a very hip module, nozzles and chimes. So, don't make one named that until I get a chance. No, go ahead. So, nozzles and chimes. So, nozzles is the power wash simulator project I've been working on using the B&O 0559 DoF sensor. And that is, I've got it over there, I'll show you some stuff related to that. Main update really is that I added the Wii Nunchuck as a set of extra controls beyond just my heading information I'm grabbing off of the sensor. So, I wanted a button to spray, turn on and off the spray, switch the orientation of the nozzle, get a little thumb stick action for moving in WASD key kinds of directions. And the chimes side of it, DJ Devon 3 suggests I could use the power washer to hit chimes, which would be cool. What I am doing though is my Lego project, you can see a piece of it sitting right there, my Lego color sensor. So, updates on this. I have actually returned back to the original sensor I was using, which I'm going to get the name wrong on it, so I'll have to check my notes on that. But the color sensor I originally went with was using a really slow integration time, which is essentially how long it reads its samples before it spits out an answer. It had the default of, I think it was almost a second, I think it was 999 and I think it's measured in milliseconds. So, it was just very slow, but that sensor has a really lovely white LED on it, so you don't have to add your own in order to see the Legos with even lighting. C Grover figured out that yeah, in the library there is some integration time and integration count settings that you can adjust in order to get a fast read, and it's a trade-off that you'll play with for speed versus accuracy, but I think I've got some numbers that are working well, so I want to show that. And speaking of C Grover, I am playing with his Synth.io Chimes library, so he's written some code to do physical modeling. I think it's physical modeling of bells and other resonation objects, so striking tubes and rods of different materials with mallets made from other materials and getting some of the really nice harmonics that you can get with something like a tubular bell, so he's got some nice sounds and I've integrated those in there, so I want to play around with that and show you what it's doing, but it's nice, it's versatile because we're using Synth.io, we can point it at different waveforms or add-on libraries like this resonant physical modeling work that C Grover has been doing for chime types of sounds. So let's talk about these. I'm going to first, let's jump over to the workbench here and I want to show you, oh no, that camera is down, hold on, let me fix this. Please stay alive, little camera. I've just got to lift the back on that so I get some cooling, hold on, that'll help. Yeah, there it is, okay. Let's back out on this one and I'm actually going to swap those cameras. There we go. So the, let's talk about the nozzles first and then we'll get into the Lego color sensor a bit. Parts I've got here, so you can see I pulled apart a pressure washer nozzle or pressure washer gun and added my electronics to it. Let's get, you can see I have a massive amount of wiring here. I've got a, I've got a USB extension cable I can take out of there. These I think we actually still sell these in the shop. They're really useful. This is a USB-A extension cable and it's probably about 10 feet long. Let me coil this up. These are great because generally speaking, your device, no matter what plugs into it, you can go USB-A on one end and so these are these nice extenders that give you the space you need for some of these types of projects, controller types of projects. So let me get that away there. So you can see this is the nozzle, the gun. It has all of its functional parts removed. So here was the trigger. I considered leaving this in here and using it to trigger a button and I may still do that but the convenience of having two buttons and the thumb stick on this Wii nunchuck controller is pretty nice. So I'm thinking about maybe mounting it in here so that you can still sort of one-handed trigger that or just having it out to the side second hand so that you can do all of the movement stuff with it or even mounting it somehow to the nozzle. Interestingly, this nozzle does have a little side handle on it to help with some of the combating the pressure on a couple of different directions that that screws into the side of the barrel there. Just out of interest, let me switch the cameras here and show you what came out of the spray gun as you might imagine there's not a whole lot to it. Let's get that view there. So that is the parts that matter. Zoom out a little bit. So at one end you have the hose adapter for your high pressure line that goes to the pressure washer pump. So that's a, I don't know what that fitting is called, but there's a little quick release fitting goes there. So water, high pressure water is sitting right here waiting for you to pull the trigger. When you pull the trigger, you're just pressing this, there's a very strong spring. I can barely press this in like with a piece of metal that just barely wants to go. So you actually need the strong lever that you get from this trigger. There's a little point here so you get a long moment arm there for pressing against that. And then that just lets the stream go through. On the other hand, and here you have again a sort of fitting for either different nozzle angles, different angles of nozzles just like in the game. Or you can also add on a extension to it to make it longer and then have a better reach with it. And then here's the different nozzles that go on the end there. So there's that little quick release fitting there. So that's like the 20 degree angle or 40 degree angle one. So you get different adapters on there. But I'm tossing all that for this project. This by the way is the little sort of sliding fitting for this handle here that screws in. So you can imagine you could use it just like this if you had an incredibly strong finger and just wanted to dig into that evil little nub there as your trigger. You could use it like that. I wouldn't recommend it though. So this one is a nice one for this project because it's essentially just two pieces of injection molded plastic and some little rubber grips have been applied to it, screws together. Some, if you look, especially the ones I've seen on Amazon, will have a separate barrel that only connects if the metal barrel is on. So that could be a challenge to adapt. I may get one of those just to use in the guide so that it's apples to apples. This is one that I got at Lowe's. So the way it's working right now, I've got a QDPI RP2040 here. I've got a USB cable that's USB-C cable that's permanently coming out of the end there. Since I wanted to use that extension with an A extender, I have a little USB-C to USB-A dongle adapter thing on there. Then that runs with a Stem-AQT cable to my BNO-055, which is the nine-off sensor, and then another short cable, short length of Stem-AQT to the Weechuck adapter breakout. So let's, why don't we take this apart? I'll show you it. I'll put it back together and then do a quick demo of it. So I just, I don't have a, do I have a, oh you know what, let me just grab a drill driver here. So these are just some coarse threaded screws that dig into the plastic on the other side. So you don't want to do this over and over and you don't want to overtighten those or you'll break it. But it shouldn't be something you're doing a lot. And there are what, about 12 screws in here. I just have, while I'm working on this, I just have a three or four of them in there. So here we go. Let's pull this apart. Leave a screw. No, we're good. Want to jostle things. All right. So there we go. That's what's inside there. So you can see nothing matters up here. Here is my nine-off sensor. And I just used for now a couple of pieces of closed cell foam to wedge that in there. I may do something a little, a little more stylish than that to hold it in there or even just double foam stick, double stick foam tape. I didn't have to modify this at all. I haven't, haven't cut any plastic away or anything like that. It all just had the right spacing in it to run wiring. So you can see here is my cutie pie. Again, there's a pretty nice piece of plastic that some of the metal tubing went through that allows my USB cable to just stay in there and not get pulled out. So it doesn't really need any additional tension protection. What's the word I'm looking for? Strain relief. We don't need, we don't really need any extra strain relief on that. It's stuck in there. The main excess I have is my Weechuck cable just because that's a pretty long cable to begin with and I didn't feel like cutting it, but I could. We could cut that off and solder it tighter if we needed to. But there's a pretty good, pretty good amount of space there to hide the cable in. So you can see there we've got i-square-c, stem-a-q-t cable running to the nine-off sensor and then a second one running to the controller adapter there. So let's put that back together and I'll show you how that's working. I showed this last night on Show and Tell as well. So the while I put this together, I'll talk about the state of things. It currently calibrates pretty well. This chip is pretty amazing. This is the B&O 055 from Bosch. It calibrates automatically on its own just through motion once you start it up. It locks in on the gyro, the magnetometer, the accelerometer and that's pretty good. But the main issue I have is I need an offset because unless I position the monitor so I'm pointing the gun at true north, I'm going to have offsets that I have to account for in code and those can change depending on large metal objects, magnetic things. So we really want a calibration procedure in this. And so C Grover who loves and is excellent at this kind of stuff is looking into some calibration routines that we could use, which would be useful not just for this project but kind of anyone who's trying to do these types of motion sensing, useful motion sensing, controlling using that sensor or similar sensors. And on the suggestion of LeMore, we're going to add a piezo buzzer so that if there are steps where you wait for the beep and then move it in a certain pattern and then it gives you a long beep when you're calibrated and you're ready to go, that would be great. And I'm also going to be able to use some of these buttons probably during startup. Either it'll calibrate every time you start up, that's probably the best way, or maybe you could enter a calibration routine by using a button combination or a button and joystick combination of some kind. So let me close this up. Really it's just a matter of keeping the wires out of the way. This is a well made, very sturdy chunk of plastic. So it makes for a nice housing for this without having to fabricate it from scratch or 3D print it or something like that. We actually especially find a broken one somewhere. If you have an old pressure washer that you're not using or broken, it could be a place to mine for parts. You could use a Nerf gun for this, a squirt gun, a couple pieces of wood, whatever you like. A creative project. All right, let me just put one more screw in here so it kind of stays together. And I should have probably checked the chat before I close that up just to make sure there weren't any questions in its open state. Let me pull up my Discord here. I should get that set up more permanently over here again. Hello, Discord. They are... Yeah, it does look like it's from PowerWashers Simulator. I'm surprised. I don't think the game PowerWash Simulator has licensed any partnerships with real pressure washer people, but they should. Okay, good. Yeah, no panics there. So what I'll do is I'll fire up this laptop here that I have the PowerWash Simulator running on and I'll switch cameras out. I can keep this from falling apart. I can plug HDMI into that so you can see it. Just got to get rid of some glare. So actually, this should work pretty well because I'll be able to see a screen mostly and sort of mostly be pointing at it, but you'll be able to see that one. Let's see, there we go. Plug this in. Power, just to keep it from turning itself off or going into a low power mode. Oh gosh, all sorts of things popping up. Hold on. Let's start steam and let's plug in an HDMI cable to this. Actually, I've got an HDMI to DVI that'll work. I've just got to steal it off of here. Okay, let's see that there. Let me go to my library, launch the PowerWash Simulator. Actually, you can start it up. You can plug this in whenever the only annoyance is that I've got like a little Windows, I noticed, a hard drive because it's a circuit Python drive that shows up. So you'll see a little menu item pop up there. So what I'm going to do is just go into a level I've already played. Go to free play mode, locations. How about the playground? Go to the playground. Resume job? Yeah, it's 0%. So you can see there's the default controls. There's quite a few. So some of these are just not going to be available unless we start adding more buttons or button combos. Okay, so you can see the pop up. It just noticed the drive. It is doing its calibration right now. I don't have any other than kind of moving it and you can see my cursor there on the screen as it calibrates. So mouse cursor is now being controlled. I haven't looked at the absolute mouse stuff yet that David Glaude sent. So this is relative mouse and it just means when we are outside of the center band in these two axes, it adds or subtracts a certain number of pixels to the mouse relative mouse move. So we can adjust that number to make it move faster or slower. At some point we might face stuttering. But here, yeah, you can see this. All right. Hey, that's not bad. That's a pretty good center. I'm basically pointing at the screen, having to point a little bit up. But you can see I can now move around this filthy, filthy playground, bumping into objects and I can control. Oh yeah, it's getting a little stuttery. Control my camera view with the spray nozzle. And of course, if I start spraying and you saw one of the things I did there, if you look at the little cursor, it shows the orientation of the spray nozzle. So I can rotate that with the C button here. And we can move around. Here, let's go wash this dinosaur off. Oh my gosh, it was filthy. Look at that beautiful clean purple now. Let's go side to side. Oh my gosh, so satisfying. It takes a long time, by the way. Someone asked about this game. It is a kind of a meditation because you can spend hours cleaning a place before you're fully done. Done with it. All right. So you get the idea there. Yeah, I'm getting a little stuttery. I don't know if it's just that screen. Might be a little smoother on this one. And so on and so forth. Ah, very satisfying. So that's the state of this thing. You can see it tracks pretty well. And so the issue more than how it tracks is just to get the relative offsets so that at any point we'll be able to say, oh yeah, I need to re-center. This is not actually where I want to be pointing it. If I move the laptop over here, it's going to be spinning all the time. So right now that's kind of dependent. So that's that. Now, let's see. I think, yeah, I don't think there's any code to talk about or show. Actually, nothing. I don't think anything has changed in that, really, just the form factor since last time. So let me hop back over here. And questions. Chimes not spimes, Randall Bone says. Looks like a pretty good ray gun. That's not bad. Good. All right. So next up then, let's jump back into, that's enough about nozzles. But I promise there's nozzles and chimes. So let's talk about chimes. This is both the Lego color sensing as well as synth IO. And I'm just going to unplug some stuff, because I want to bring it over here, actually, so I can talk about it. Just turn. Try to shut this down. Shut down. Shut down. I'm just shutting down that Raspberry Pi elegantly instead of just yanking the power. So this project, as you may remember, I am using Lego bricks and a color sensor. When I sense different colors of bricks, I'm going to play different musical notes and maybe do some other synth IO things. So synth IO will be running on the microcontroller. And I'll have the sensor in a little glove or a wand or something like that. So I've mentioned this last time, but I hadn't gotten my Bricklink order in yet. I ordered as many different colors as I could get for the 1x2 brick. And that is a lot. I think there are over a hundred that have been made over the years. And there are about close to 70 that you can readily get for this brick. And so on Bricklink, which is a good place to order both new and used bricks from individual sellers, you can get yourself an order together and get as many colors as possible in order to figure out which ones will be the most easily recognized by the color sensor. So there are some colors that just won't look very different from each other. If you get three different shades of blue that are pretty close to each other, that could be difficult. It can take more time than you want to take in the integration steps than is useful for musical instruments. They could probably be, I don't know, probably all of them could be distinguished, but if we make them very different from each other, we get better integration time, better results from faster speeds. So let me go to the down shooter here. So look at all these beautiful, set up the exposure here and focus. So I've separated these out just because they're from a different couple of sellers and I needed to remember which ones came from whom so I could have a prayer of telling the colors apart just by name. So I'm building a little spreadsheet so I know which ones are which. So this is in basically, I think this is in an alphabetical order right now, if I'm not mistaken. So you can see here we've got these are hard to tell on this camera. These are actually different blues. This one's got a little more indigo in it. Let me see if I can adjust the color temperature or white balance. That's a little more like the real world. Yeah, there we go. So now you can see, I think, a little better color distinction between those. So those probably can be told apart. This is going to be quite a bit more red in this one. But like I said, it would take longer than if I wanted to tell this blue apart from that green. Some of the lighter colors seem to be a little easier to track to. This yellow will have more distinct results than a sort of more traditional yellow Lego, this lime green one, for example. I've also got a bunch of the translucent ones in here just for fun just to test. And I may make myself like a little Lego color reference poster with their names and their Lego numbers and so forth just for the geekiness of it all because that would be fun. But yeah, there you go. So those are a whole bunch of Lego colors. It's just a few that I don't have that are still sort of reasonably available without going into super rarity. But what I've got right now on here are a few selections that definitely are distinct enough from each other to work well. I didn't probably need to go to those lengths. Oh, I love this. By the way, everyone is awesome set David Loday posted is that is such a wonderful set. We have one of those. That's actually what I first tested this on before I built this whole contraption. I just grabbed that set that we have built off the shelf and used it. You can imagine like the brown and the black were weren't great for for this. But the the set is exactly that's exactly right. Yeah, I should be able to play music on that and get some some nice results. So thanks for posting that David. So here is my same little test jig before I start doing this by hand and this gives me pretty consistent results as far as lighting because I'm using that little lighting a little LED there. There's the sensor. So so this makes it a little more scientific to begin with. Eventually I want to have enough slop in the system that I can be holding that or wearing that in a glove and not have to be exactly the same distance from all of them. But this is this is where I'm setting it right now as I build this system. What is running on here is the same as last week I've got a feather RP 2040 prop maker and the reason for that choice mostly is that it has the built in I2S amplifier so I can plug in this nice little 4 watt speaker into their 8 ohm 4 watt speaker. So over the stem of QT I squared C cable we've got okay and I forgot I want to do I have a good mic cable here no I'll just hold my speaker sorry I'll hold my microphone near here and then I'll boost the volume on this real quick. So let me let me go to the code and see if I can set either the mixer volume I can't remember now how am I doing volume on here a mixer level is at one but I think it's my envelope that is constraining that because it should be louder I'll show you this code while I'm looking for it maybe someone will see it in there for me brick tunes that's right Dexter here's some brick tunes I got to use that in the name for this that's that's for sure let's see what's a word I can look for sustain oh maybe this isn't using an envelope like that it might just be in the yeah it might just be in the library okay so I will hold my I'm just going to hold my mic sorry there's going to be some noises here let me turn it down okay so I'm going to hold my little lavalier mic over the speaker as I move the light sensor around so you can get a feel for that okay so that's what it is sounding like right now I am let me show the code again I am currently holding I think if this is still the way I had it set up I haven't looked at this in a couple days I was holding notes until I was over one of these blank spaces here so that we have a very low level on one of the one of the lighting values or one of the color values so let me see if I can find it so gap state you're seeing the code right yeah so if the sensor channel for 15 nanometers which is the lowest I think that's the lowest that it checks is less than or equal to 40 that basically means that we're over one of these gaps so I'm saying we're going to set the gap state to true and that would stop a note from playing if one was playing otherwise if that 415 nanometer is higher than 40 which again was just the volume or the level that I measured at the lowest we are hovering over one of these bricks and then we check and see oh do I do I recognize one of those is one of those a known color so the way this this part works here is if if we're seeing some brick then we grab all channels and I think let me let me see I can't remember what I'm printing let me open up the little repel here terminus toggle panel disco tool uh name is feather okay uh so am I printing anything right now probably just stuff like pink no brick lime okay so there's a good example when I when I went over the lime brick here what happens is it says the RGB 888 color which is the 8 bit color coming from just the red green and blue channels and this one is a I think 9 channel or 10 channel sensor so if needed I can make finer grained um comparisons but right now red green blue is all I'm all I'm checking for so there's just four of those nine wavelength channels that this thing returns and those just happen to be these red is the seventh data channel green is the fourth and blue is the second so those were sort of cherry picking the red green and blue from those nine color channels so that uh you can see here in this case lime green it's showing up as something like 113 to 120 and red 195 to 209 and green 85 to 83 and blue so you can see there's a a little slop value there and that's okay because it gets compared to my initial reference value so what I did was I averaged these made made some um reference tables and if you look up here uh this is my brick color values and these are their names so the pink lime orange yellow green light blue red and white uh these were the red green blue channel values that I got after testing a few times not super scientifically but that those are ballpark gonna represent those and you can see they're all pretty different from each other um in some cases for example lime and orange they they share a pretty similar uh red value or how about this one orange and yellow right they have almost the same red value 170 and 169 but green is quite different 80 versus 170 blue 30 versus 40 so thanks thanks green channel for being that much higher on uh on yellow versus orange because it allows us to distinguish those then when we are um sensing one of those bricks we're running this color match uh compare colors function uh real quick question from daniel rushikoff who says what are you building uh this is a lego color sensor that when it uh senses a color it will play a sound so you can't hear it too loud right now i'm going to move my mic closer okay so that's what i'm building uh right now sorry if you just joined us and i'm wondering what this is uh and daniel to the question is of do i read the chat i do but not constantly because i'm too easily distractible as you may have noticed uh so the color uh match variable here is this compare colors and so i'm feeding it the color i just read uh i'm checking it against all of the um list reference and then i have a tolerance value that's kind of a slop factor how how tight does that need to be how close does that need to be um and that uh function is this one here this was a um i believe this was part of one of c grover's um existing libraries but i he's been helping me with this and he was able to pull out this chunk this nice little function here and you can see what it says it says it says compare two color tuples so i've got my red green blue that i've measured i've got my red green blue that's in my color table and then we have a tolerance band how far away it can be from that and so you've got the the three eight bit values uh for red green blue the three eight bit values for the table and then the value range of zero to seven sixty five i'm not sure why those numbers but um the the the person to ask is right there in the um discord chat c grover and just check this oh i'm getting live updates from c grover who said he just realized the color sensor color channels could be used with the euclidean method to further distinguish some similar colors oh good uh live updates this is the best part of collaboration thank you um so then we are uh creating these um two numbers to compare color one and color two which are based on those those tuples and then here is the the math for figuring out the the difference between them uh and deciding if that fits within that tolerance band and then we either get a true or a false there's this return boolean uh delta colors less than or equal to the tolerance so when we detect what seems to be a brick it's not black uh or it's not lower than 40 on 415 nanometer wavelength uh then we will uh print out the name of the color we will play a chime with this chime dot strike and then i have a scale setup and i've just assigned one of each of these bricks to one um note inside of that scale doesn't have to be a you know set of semitones or a or a sequential scale it could be a sequence that that hops around uh we could turn this into a sequencer if we wanted to where we play a song just by moving across color bricks which is kind of nice for things like um a puzzle or a game or an escape room kind of thing if you want to you know say oh you've got to solve a thing to figure out these colors and then go play your bricks and you'll hear a tune you go oh that was you know the big ben clock that's a clue for this so there's there's a lot of uses for this besides just a very sort of strange musical uh interface input interface uh and then uh that gets chimed we set the brick state true so that prevents it from just looping over and over again so we can set the state of that and then we can flip the gap state so i just use those little state checks to not iterate constantly on playing one note over and over again it just plays at the one time like that uh so that is that that's how that's working um i think i let me see if i can show you the data because that's kind of interesting the raw data coming off of here let me let me see yeah i'm gonna just do print data i think that'll work i also have it just playing a scale at the beginning so i know that it's working uh there you see it so it says no brick okay and so there it's just that it will loop on over and over so there you can see those are the um nine one two three four five six one two three four five six seven eight sorry the eight uh channels there's also near infrared and clear just kind of like a brightness white white light i'm not checking those either but you can see uh from these i'm pulling out uh just red green and blue which are as i said the seventh fourth and second items in those lists but that's what that's what the sensor provides so you can see if if we're having problems with some particular brick there may be one of those color channels that i can also start looking at uh davo desa in the chest says if the studio light changes how much effect does that have on the color of the bricks that's a good question uh i haven't made any changes to the reference colors between my workshop here and my studio inside where i worked on the code so that's uh pretty different lighting i can turn off some of these lights here and i think it i'm guessing it's still going to work so now it's quite a bit darker right here uh and you can see it still works and that's largely i think because the uh led that's built into the board is really close to the thing we're measuring in really bright um and so it may be just contributing so much more to the reflected color that the sensor sees that the ambient light has less weighting uh matters less um we could probably fake it out you know if we got a real big purple light or something and set it over here it'd be kind of fun to to test that out um i don't have i've got some gels here but i don't think i have a good little light source or flashlight to try it with um but actually no way i do i could just use the phone one of my thinking i can use the phone flashlight let's grab a purple gel purple gel let's put our money where our mouth is will this still i'm just using the phone light so you can see i'm gonna give it let me see if that's at full brightness all right hold on there we go full brightness this let's see we fake this thing out definitely oh that's showing up as what oh white still shows up as white that's interesting uh orange still worked not yellow red still worked green light blue maybe i was just not holding it as close okay if i hold it closer yeah i can definitely trick it um but that's pretty extreme case so that's that's good um you know color sensing light glove is like i've said before never gonna be your ideal musical interface if you're looking for precision um but you know also if you wanted to since we have the light source right on the sensor we could enclose it so that it covers things entirely has some sort of little shrouding um seagrover mentions the sensor is surprisingly directional too uh let's see other questions uh davidesa said it looks cool as potential for further development for sure yeah um with both of these projects again thank you so much to see Grover for his help and i'm really excited because i think once we get some learn guides out with these they will help people myself included hone in on some of the the more practical i just want to use the sensor to do this thing and uh get away from right now it can give you a lot of data but it's not clear how you can use that in a setting where you want to have repeatability or calibration so so both of these and i think with a lot of sensors the one of the tricks is to get it good and usable you kind of need some extra scaffolding around the the code that deals with stuff like offsets and relative versus absolute values and calibrations and that sort of thing so um really really thankful to see Grover for his help and of course everyone in the in the community for for their help in making these things so much easier to work with than they used to be uh all right so by the way also to answer answer if if this was a question daniel rushikov uh who i'm talking to the main chats or the youtube chat so thanks for asking questions in there and also the discord chat if you're looking for our discord it's at adafru.it slash discord and it looks a lot like that because that's it so you can uh you can throw questions up over there all right uh let's see before i go i will remind you if you want to get 10 off in the adafruit shop go throw some stuff in your cart and don't forget to add the coupon code of the day which is this right here it is nozzle it is this this is the coupon code literally the coupon code is nozzle i guess that's not really the nozzle anymore anyway it's just the housing but that's not the coupon coupon code is nozzle that'll get you 10 off in the adafruit store go get some good stuff look there's some stuff right there those are the free things you can get if you spend certain amounts of free deal monies uh and if not just take a look at products and new products check out this new products list cool stuff all the time going in there uh okay well thanks uh andy kelly clean and colorful workshop at least virtually clean uh that is going to do it for today thanks everyone for stopping by i believe scott is going to be doing a deep dive tomorrow so check back later or tomorrow morning to see uh when that's going to be happening and uh we've got the live broadcast chat channel as well as the live broadcasts announce channels both places that you can keep an eye on i don't know if he does a blog post but probably it's probably also a blog post um and is that it i think that's going to do it thanks everyone for stopping by braided food industries i'm john park this has been john park's workshop and i'm going to go play with my nozzles and chimes bye bye