 I don't know if my software just crashed or not, but it sure did get weird and slow. Sorry about that. Let's take a moment and I'm gonna reboot my broadcast software because it has a spinning beach ball of glorious doom. For people asking, what did Lars gnaw on? There we go, maybe it's working again. Yeah, my broadcast software just got real weird on me there but hopefully we're doing okay. I'll restart the software if I need to. Yes, Sea Grover asks, am I in my workshop or on the green screen? I'm actually in New York with a backdrop of my workshop back in LA, or am I? Maybe that's why there was a lag. All right, well, either way, I think we're up and running. We'll see, the first time I try to change cameras or audio on this, it could go bonkers. If it does, I'll restart. So welcome to the show, I'm John Park and this is John Park's workshop and I am looking over here at the Discord chat where people are letting me know that the audio may have been working. I think I just killed it again, yeah. It does not like me changing my cameras so if you can hear this, great, I'm gonna go ahead and restart this. So stick around, I think the broadcast will stay live but I've just got to jettison the software here. So please stand by. All right, so we'll start broadcasting again. It looks a lot better. Looks like Lars made it back from Florida, knowing Pedro said. There he is. Yeah, thanks guys, thanks for stopping by. Look, it's knowing Pedro over in the YouTube chat, everyone. These guys are awesome. All right, yeah, so I, unfortunately, what happened there, I'll tell you what, I set up this session earlier today, left and did some stuff and you can't do that with this software. It really likes to be restarted a lot frequently so I forgot to restart it but it looks like we're back. So let's get on with the show then. First of all, yeah, I was saying, hey look, here are our good friends over in Discord. Hello everybody, thanks for stopping by and I see you over there in YouTube chat as well. Hello, hello. So getting on with the show, first thing I'll mention is on our jobs board we have a cool looking position here. Let me bring up where my browser go. If you go to jobs.adafruit.com, you will see a bunch of positions including this one, a makerspace specialist at Princeton University. Princeton is looking to hire someone full time. Seeks a resourceful and collaborative individual to help launch our library makerspace as the role of a makerspace specialist. That sounds very cool. So if you're in the New Jersey area and you're interested, look it up. It's on jobs.adafruit.com which is an entirely free place to post jobs and post your resume if you're looking for work. It's a mighty cool one so go check that out. Let's see, next thing I'll mention I have a show on Tuesdays. You may have heard of it. It's called JP's product pick of the week. It looks a lot like that. And this week my product pick of the week was the Cutie Pie RP2040. Little nubbin' that it is. And I've got a little recap for you here. Normally the show is about a 15 minute show and there's a 50% off discount typically. There was this past week for the item. We only had about 70 of them in stock and they sold out in minutes. But come stop by any Tuesday at four o'clock Eastern time for my show. And usually there's a cool new product pick with a discount. So here's a little one minute recap. Check it out. It is the Cutie Pie RP2040. It has the USB-C connector on there. It has the STEMA QT connector on there. The little cast-related pads. Really cute little board. Great little board. It's fast but it's also got so much more flash memory on it. We've got eight megs of flash that you can put a lot of libraries on it. I have the Adafruit MIDI added to there. I have the drivers for this display. I have the display IO drivers for shape and text. I have the Nunchuck driver to use. Wee Nunchuck like this guy right here. It is the Cutie Pie RP2040. It sure is. So go check that out. And if you are interested in getting one you can go and sign up. I'll bring this site up again. If you head to Adafruit.com and in the little search bar you type in Cutie Pie. It's the first result that comes up here. It's this RP2040. And there's a little field here where you can enter in an email address. Hit notify me and you'll get an email once those are back in stock. All right, let's see. Yes, Starman says idle software is the bugs playground. Anything can happen. I've noticed that especially with audio. If I start to have weird audio problems it's because I forgot to restart Wirecast here. All right, so as you probably have noticed I've been starting to do a little tips series, series of tips for circuit Python. It's getting warm in here. And the as yet unnamed segment, I'm thinking of calling the circuit Python parsec because that's not a unit of time, a measure of time, but we all love Star Wars. So maybe that'll stick. Tell me in the comments if you like that one or if you have some other suggestions. And if you do, we'll sort of codify that. Maybe come up with some logos. Maybe I'll write a new little song for that. That would be kind of fun. And so for today's circuit Python parsec, what I wanted to show is a little tip on finding out some info about your board from the REPL or from the serial interface to your microcontrollers. So let me bring up, yeah, that'll work right there. So there you can see I've got a Feather RP2040. It's plugged in over USB to this computer. And then inside of Moo, what I'm gonna do, actually I'll show you the documentation that we're looking at here. Let's switch for one second to this. So here are the circuit Python readthedocs.io. And this is a section on core modules. It's kind of an interesting thing to look through. If you take a look at the OS functions, and I'm also gonna look at the board functions, inside of the OS functions, there's a function here. Well, first of all, what are these? These are, as it says on the tin, they're functions that an OS normally provides. So if you're using Python on a computer, there are some functions that you can do because you have an operating system. So here's a little subset, a strict subset of OS types of things that you can do right on your board. And I'll also mention this comes from the excellent circuit Python tricks page on GitHub that our good friend Todd Bot has started. It's github.com slash Todd Bot slash circuit Python dash tricks. And this is one from there. So let me switch back to my Moo session here. And inside of Moo, you can open up this serial window. So this is now a direct connection, a REPL. I can type things in directly on that board. So first thing I'm gonna do is I'm gonna import OS. So I've imported that library of operating system like things. And then the, I have a little cheat sheet here, so I get it right. The command I wanted to do first, where'd it go? Lost my notes. Here we go. So what I wanted to do is find out what board I have plugged in. And you might ask, why do you wanna do that? I've got it sitting right here. Well, I actually have multiple boards plugged in. In fact, I'm not even sure which one is gonna show up. I have my little camera switcher over there. That's a circuit Python board and I have this feather. So let's see what comes up. If I type in, I'm gonna print os.uname.machine. So this is a feather RP2040. Actually that doesn't tell me much because they're both RP2040s, I didn't think of that. And I can also check which version of the operating system is on there, which version of circuit Python in this case. So if I do print os.unameversion, it's gonna tell me I'm running 6.2.0 release candidate and that was the version I downloaded on the first of April. So a larger set of data will show up if you just simply ask for uname. So we can type that in and you can see now it tells us different versions of some of the stuff we saw before. And then the other one that's really useful if we know what board we have plugged in, we might also wanna know what pins do I have at my disposal. For example, that QDPI RP2040 has two I squared C channels on it. You might not know that looking at it. So if I import board, I've now imported the library for board pin definitions. I can now just simply type in board, whoop, not board, board dot and I'll hit tab for tab completion. Now I get a list of all the pins that are on this board. So I can see this one has A, zero through three, D, zero, one, 10, 11 and so on. I squared C is on here. I have a NeoPixel on board. We have the serial RXTX, SPI, the I squared C. So kind of an interesting way to find out info on your board without even having to go to a webpage as long as you remember these little commands. And so I thought those were both some pretty useful tips. So that is your circuit Python parsic. Waw, waw, waw, waw, waw, waw, waw, waw, waw, waw, waw, waw. Okay, I don't have music for it yet. And if you're curious about the link that ToddBot has, he's put that over in the Discord. If you're curious about the circuit Python tips on GitHub, go head on over to the Discord channel and you'll see it right there. You can bring that up in case you wanna just take a look. So I'll be looking at some other little tips and tricks like that. Ken Santamia says Pysec is good. Something like circuit Pysec. Ooh, I kinda like that. Yeah, that's a nice one. All right. So, and I hear jokes about the, instead of the Kessel run, the Castellated run. Did I really see that? Awesome. Okay, let's see, what else do we have? What's next today? I wanted to talk about, oh, first of all, I sometimes forget to do this. I usually forget to do this. I wanted to have a little look at the latest guide that I put out. So if we go to learn.adafruit.com and scroll down to the section that says New Guides, you can click on View All and that'll bring up a list of the freshest of fresh guides. You can see here, this was the project that I worked on a couple of weeks ago and I just got the guide published. It's the Funhaus Door Alert with email notification. Go ahead and click on that there and let's see, kinda make this a little easier to look at. There we go. Squeeze that in and it gets rid of that sidebar. So here I've got a little demo video. I can try to play that, it'll probably stutter, but this is a little demo of the door open and close and the little door sensor read switch magnet. And you can see there in the little picture in picture is my dashboard for the Adafruit IO and then what's also happening whenever that gets tripped is an email alert is being sent. So the guide shows you the parts that you need for this, including some little wiring shenanigans that you have to do. I'm actually gonna talk about that a little more today with today's project. And that's to get the Funhaus to use the read switch inside of one of its JST ports and then I have some info here about the Adafruit IO setup. So this is, I have some links to generic, what's Adafruit IO, how do I get signed up, how do I get my key? But this page actually is the sort of specifics of creating the door feed that we need as well as creating the dashboard and some dashboard elements. So if you wanna start a very simple Adafruit IO dashboard type of project, this is a good one to look at. And then I have some info here about email alerts and I show two different ways to do email alerts. One is using the Adafruit IO feed and the if this then that, IFTTT service. So if this then that website, you can go there, you can create an applet and in that applet you can add the Adafruit IO service as you can see here and then you can pick one of your feeds and a conditional as the trigger. So here we're saying if the data feed from door has a zero which is what gets sent when that door gets opened then we do an action and then you can pick from different services. Here I'm picking from the Gmail service which is inside of this if this then that and allows you to send an email either just to yourself because you've registered your credentials for your Gmail account or to I think up to 10 or 20 Gmail or any addresses, email addresses. And one of those that I show that you can do of course is your cell phone number. So in a lot of cases you can use cell phone number at provider or TXT for text message or MMS for media message.provider.com or net. That's an email that will make its way to your phone. And then the other way that I show how to do this is with the Adafruit IO plus service which is a paid service that unlocks more feeds, more data can be sent at a higher frequency to each feed and it also unlocks the ability to send an email to your registered email address when something gets triggered. So then you can create these triggers which are doing a similar thing. It's a reactive trigger that watches for that data feed from the door to send something like a zero and then that will send the email alert to you. And then I have the setup for this. So this is one of the first guides I've written where we get to talk about using the project bundle which is terrific. So you may have recalled last week I showed this on my circuit pie sec. Kind of like that. The download project bundle link in our inline code or embedded code in a project doesn't just have the code file but it's also got all of the libraries you need because every night we have some little server bots running around checking the code in the learn guide, GitHub repo and finding all the libraries that that code uses and then all of the dependencies on other libraries those libraries have. It all gets put together in your zip file and so no more searching around through your library download. You can just simply drag these contents over to your microcontroller in this case, the fun house and off you go. Then we have a little description of how this works and finally there's a page on building the thing. So this sensor you may have recalled last time I showed it with the bare wire sensor which is how it comes right now and a separate JST to mail header pin cable assembly and then I'm using some little wire connectors to plug those in. Today I'm gonna show you a sort of more permanent solution a little sort of soldered and spliced together solution and then I have mounting that up on the wall and it's ready for use. So that's over in the learn system, go check it out. All right, so for, let me take that off of there. For the project, the new project for this week let me actually head over to my work bench and I'll head on over there and I'll set up some different camera stuff once I get there about, there we go. Let's see, let me set those there. So, let's see if my camera switcher here I've got, I don't have a lot of cable on that I better not yank that out. I've got that and that there. It's able to switch those over, put this into view. So what I've got set up here are a fun house and in this case I'm actually using some of our little magnet feet that can screw into the threaded M3 standoff so we have there. So I can stick it to this metal stand, this nice ferrous metal stand so that just kind of keeps it in place. And then you'll see here I have a little bit of wiring coming out of this A1 port on the fun house. I've got power plugged in, USB power. And then on the other ends of this cable is actually a pair of sensors and I'm gonna tilt this up for a second so you can see this a little better. So these are a set of, it's kind of a pair of sensors that work together. It's called a break beam sensor and just like the big version that you find on a garage door to keep the door from crushing someone this is a small infrared LED light source and an infrared LED sensor. I think this is infrared is what this one is. And what happens is this is a, acts as a switch. So what I'm gonna do is I'm gonna build a sort of a mail slot sensor so I can tell when the mail's come in. I'll hold this up again. And you'll see here right now the fun house is lit up. It's kind of bright here, but you can see it's lit up. It's LED screen. And then when I take a piece of mail and put it through, you'll see it's gonna beep. And I'll hold it in there this time so you can see my little LEDs go red. And I have it printing out. Zoom in here so you can see this a lot better. Okay, not bad. So now if I put my mail in the way, you'll see I'm sending these LEDs red. And then I'm also just printing to the screen in sort of simplest way possible that I've broken the beam and I'm also setting the time in milliseconds since it's the time monotonic since the microcontroller started up just so that I can see separate events. And I know if I've spent some time away from it, what was the latest one? So the idea behind this is not just to beep and change some LEDs, but to send an alert to the Adafruit IO. So I haven't written that part of it yet, but it's gonna be very similar to the code that I used for the door sensor. But the way this will work is that you can build this into a mailbox or mail slot. And we happen to have one that's right on the front of the house, so it's not too easy. It's not too difficult to power it. If you have a mailbox that's way at the end of a driveway that might be a different issue. You might have to run some power. But what I'll do is I'll have a little dashboard that'll show me when the mail has arrived as well as I'll get a little email alert. So very, very similar idea. But this one using our cool little break beam sensor. So what I'll do, I'm gonna power this down for a second and show you, I mentioned this cabling. I'm gonna unplug that. So that's the little JST. I can zoom back in actually. So that's the little JST connectors here. And we have these for ports A0, A1 and A2. And those can only plug in one way. They're keyed connectors. So you're gonna see we have data on the bottom, power in the middle and ground on the side there. The door sensor that I used last time, that one just required, I think it was going to ground. I think we were, yeah, we were just using ground and the data pin. This one is lighting up this little infrared sensor or infrared light source. So this one uses all three pins. And I have two sensors, but you can see they're actually both plugged into the same piece of cable because one of them is, this is the LED side of it. This one just uses power ground. So this will run, I think anything from three to five volts safely. I'll double check that when I get back to the workstation. And then this one here, same they're using the same power ground, but this one also has the little data pin to say when it's been tripped or not. And then these will face each other and you can get some pretty good distance between them depending on how thick of a mail slot you have. You've got magazines and flyers and things going in. You might need a little space in there. Excuse me. And then what I've done in this case is I've taken, let's see, do I have a, this is not exactly the same, but what I've done is you'll usually find these are separate like this, even though they're plugged into a single connector. And they end up creating kind of a mess. So what I did is I put some heat shrink tubing that I didn't even need to heat shrink. So it's not tight on there, but I just put a few slices of that along the length of the little wire bundle to keep it together. And one on this end as well, two on this one, cause it was longer. And then right here in the middle, you can see we're sort of splicing down from these five cables down to just those three on the JST connector. So I can't show that because I've put some heat shrink tubing on each little wire bundle as well as over the whole thing. But you can imagine I've just twisted some wires together and soldered them so that we get a nice solid connection and I don't have the bulk of that little wire joint connector that I was using last week. So that's one solution for keeping things a little neater. So let's head on over to work bench or the workstation rather. And I will show you some of the code that goes into that and also answer any questions you might have. Let's see. So Tima asks, can the receiver part read the mail and send a transcript? That is advanced. No, this one's not gonna do that. Let me put these guys here and I'm gonna plug this in. Let's steal a data cable. By the way, let me go to this view here and I'm gonna refocus this one a little bit. I have found these to be really useful. As things are starting to transition to USB-C, I have a heck of a lot of micro-B cables laying around and these little adapters go from the micro-B to USB-C In fact, let me pull that up on the website and see if we've still got them in stock. I need to get some more of these. Head on over to shop. Let's do micro-B adapter. There it is, micro-B USB to USB-C adapter. So if it's a case where you're not using any of the high power or advanced features of a USB cable, you're just doing some simple micro-controller stuff. It's cheaper, easier way to use your existing USB cables and I happen to have a lot of really nice flexible and even color-coded USB cables. Almost all of my USB-C cables are big, thick, heavy boys right now and so there's a bit of a pain. So for a project like this, adapting with the little USB-C micro-adapter there is a pretty helpful little... hack to your existing cables. So let's plug this in and I'll actually use that piece of blue tack. Someone was asking, actually we were talking about this yesterday in the an Adafruit meeting among a creative engineering team, favorite ways to hold stuff down and pretty much all of us use some version of blue tack. So that's what I use to keep a slidey thing from sliding around quite so much in this case. So let me go ahead and plug, I think I had that into A1 and you can see those are not facing each other right now so it has beeped and if I point them at each other you can see they don't have to be dead on either. Oh, I think I was seeing some infrared. Did you see that little purple there? So there you go, that answers that question. This is an infrared LED and sensor. And okay, so let's take a look at the code running this. I will switch up some stuff here. Let's go to Adam, a little me back there or how about big me there and a little down here, that'll work. And I gotta find Adam, where'd you go? Here you are. Okay, so here I will open up the code.py that's actually on the microcontroller and I'll also bring up a little serial window here and I will close the serial window and move because it's probably won't like coexisting. Okay, so this is how simple it is right now. I've got some libraries I'm importing. I'm not even using time so I don't need to import that right now. I think I was earlier, I was thinking of using a little sleep to use as a debounce but I don't need that anymore. So I'm importing board. Remember we showed that earlier that gives us the use of all those pins, the pins that are available on the board. In fact, let's do that on the FunHouse. That'd be kind of interesting. Let's unplug this board over here in the interest of simplicity and I will do a screen session. So now I'm into the serial repl of this FunHouse board and if I hit control C I can now directly type stuff into here and I'll do import OS and did I wanna do this? No, but we'll do it anyway since I'm here. Let's print that info. Print OS.uname, okay? So you can see this is, it's kind of cute. The name at one point was maybe gonna be FunHome which I kind of like. It's more than a house, it's a home. So this says machine name is FunHome with ESP32S2. What I'll do now is I'm gonna import the board library and now if I just do board tab you can see what we have on here. There are those three JST analog or digital pins A0, 1, 2, and 3. We have a few different buttons on there that are called button down, button up and button select. We have all those cap scents on there. There's some serial for debugging and there's the dot star. There's the onboard LED, a light PIR scents slot speaker and then some of the TFT stuff including backlight, SDA, I squared C. So I think that's kind of a neat trick to just quickly see what's going on on your board. So, yeah, Mr. Certainly said some camera lenses filter out IR now so you can't use that trick to see if like a remote control battery is still working but this camera I'm using here does not filter it out which is nice. So then I'm importing the FunHouse library. I'm importing debouncer which is my new favorite friend for these types of edge detection, rise and fall events. It just kind of sits there doing nothing until something changes which is perfect for this type of sensor. I'm creating an object I'm calling beam pin on the digital in out board A1. That's that JST I'm plugged into there and then I'm setting that to be to use the internal pull up resistor and then I'm creating the debounce pin by calling this beam sensor equals debouncer and then specifying that pin which is really neat makes it super easy to use this rise and fall stuff. Then I've set up a couple of colors here using these variables red and green and then the hexadecimal values for a not so bright red and a not so bright green. You can also set brightness but this was a really easy way to do it. It's just not set it to F0000 for super scorching bright red but just 20. Then I'm creating the fun house object and I'm setting I don't even know if I need this I probably don't but I was playing around with those stuff and I haven't done any screen stuff with this yet so I just set the background to none and that means we still get to see the the wrap will show up on here. You can see that all that stuff that I just typed shows up here and then I'm using this nice peripheral layer that Melissa wrote in the fun house library which allows me to talk to the dot stars really easily funhouse dot peripherals dot dot stars fill and then a color green in this case. And then here's all that's happening inside of the main loop I while the main loop is running I check the beam sensor dot update. So checks to see has anything changed on the pin there that's being used with the debouncer and then if the it goes from high to low it falls that means that we've broken that beam. Oh, let me start it again here. Control D by the way will just restart the program if you've control seed your way over to that line entry in the rebel. So now if I take one of those out of the way you can see there the sensor value falls. I'm printing beam broke at and then I'm using a little string formatting to put in time monotonic. Ah, that's why I'm importing time. Okay, I do still need it. Then fun house peripheral dot stars I fill in with red and I'm playing that little tone. And then the, you'll notice it doesn't keep spamming. That's why I like using this debounce fell event. It's not continuously writing to the screen the beam was broke, the beam was broke, the beam was broke and it's not sending a million messages off to Adafruit IO once we have that set up. Instead it's just done it once nice and calm says the event happened and then checks to see the next time we have a edge in that riser fall. So now put this back. It rises like LEDs go green. I'm not printing anything right now and that's it. So that sets it up for the next time. So that's about it. The rest of it, like I said, we'll be setting up Adafruit IO so that we can see some messages go out look on a dashboard and you could potentially do other things with this if you wanted to have a set of neopixels light up a certain color when you get or even do an animation when you get some mail if you're really excited. This might also be something that you could use for some package deliveries as well. I think I have some ideas for maybe a different way to do that type of a project. And I think that's it. So let's see over in the chats, the discord chat. Discord chat. Let's see what's going on. Yeah, Mr. Certainly says USB micro, B to USB C adapters awesome for low power scenarios. Yeah, you don't want to use them for stuff that you didn't ever used to do with USB, the regular USB cable. So I don't think you ever saw three amp. It was maybe 2.5 amp would be about the limits of that on five volts. Todd has another trick for doing an import board, boarder and all of one line. I know you get a dump of what's in board. Oh, that's cool. Let's try that. We've got time. Sure, let me bring back up. I'll bring back Mu because that has a nice big font on it. Actually, before I do that, I want to show you some people if you don't know, if you've used something to create a screen session on a Mac in particular, you can do this from a terminal window. You can do this from inside of sort of console terminal windows that are inside of your IDE. How do you stop this thing? You can't, right? If you hit enter, it's currently not doing anything. If I hit control C, I'm just gonna get to the board REPL. This is an esoteric weird one. It's control A, control K, and then it says really kill this window and you say yes, and now you're out. So that closed down that serial connection with the board, which I need to do if I want to go look at it inside of Mu. Also, there's a chance that Mu would just do that for us, shut the existing one down when I hit that serial button. I'm not sure if it does that or not. So here I am in Mu, same sort of thing though. This is a serial connection. It just establishes automatically with the first board it finds. And now we'll try this. So I'm gonna do import board and dir board. All in one line. There's a semicolon there you can't see. And there we get everything that's on the board. Very nice. That's a very hackery trick there, Todd. Thank you. All right, and I think that's gonna do it. So thank you everyone for stopping by. I'll be, let me come back here. I'll be writing this one up as a guide. Also working on the Lyfix bulbs, the RGB light bulbs thing. So we've got that coming up. A bunch of cool projects with the Fun House. So if you are interested, go and sign up to get alert on the product page for Fun House so that you get an email as soon as those are back in stock. So that is gonna do it for this episode of John Park's Workshop for A Different Industries. I'm John Park and I will see you next time. And a little reminder, there's gonna be an Ask an Engineer tonight at eight o'clock Eastern time. The Lady Aida and the Mr. Lady Aida had to do other stuff yesterday, so it got pushed a day just this week only. It'll be back to its usual time next week. But tonight, eight o'clock on the East Coast in the United States of America, Ask an Engineer. Go check it out. Thanks everyone. Bye-bye.