 Hey, hello, and welcome to the show. It's me, John Park, and it's time for John Park's workshop. I have had quite an adventure bringing this show to you today with various technical difficulties, including a computer that just won't behave. And then I'm moved to a second computer, and now the audio on it is sort of behaving. Couldn't play music, so I'm guessing you were shocked by the no bleeps and bloops. That's right, Andy Callaway over in our Discord chat said, hey, no bloops. That's correct, no bloops. But I think, more importantly, I've got the microphone working, and we can do a show. So how about that? I will be working to try to improve this thing. I had a major hiccup with the computer that I usually use in here. It has been crashing into a recovery mode that takes a while to get back out of, and then it did it again. So it could be time to swap a hard drive out, and that we'll see. But here I am on my laptop as a MacBook Pro. It's performing admirably. It's a 2019 MacBook Pro, 16 inch, super fast machine. Not the new silicon, not the new Apple M1, but pretty good. Yeah, we'll try again at the end of the show and see if we can get any bleeps and bloops. But I don't think so. I'll just beat box for you or something. Let's see. What's going on in the chat? Hey, Mr. Certainly, Andy Callaway, Dr. C Grover. OK, you're on. OK, you're on, says, but? Question mark? But what? Did I say something and then not finish it? Who knows? So let's see. Let's get on with it. First of all, I want to mention that we have a jobs board. You may have heard of it. I don't know. You should go check it out. It is at jobs.aderfruit.com. And if you give me a moment here, I'm going to fix a screen cap so that I can bring in, let's see, that's going to go to, yeah. OK, this will go to wacky mode here for a second while I try to bring this in. But it's going to be a lot of that today because these configurations are touchy. So hang in there, please. Here we go. Here's the jobs board. And let me try to scale that out a little bit. Let's see, what's the scale percentage looking like on there? All right, we'll go a little bit smaller. That's the jobs board. It is totally free. Go to jobs.aderfruit.com. And you can look for positions that people have posted where they're hiring. This is open to anyone. It's free. You can post a job if you're looking to hire someone, if you're looking to bring someone on freelance or as a contractor. If you are looking for work, you can sign in with your email address. We promise to never spam you. And then you can post your resume and info in this Available for Hire section up here. And you can see there there's a bunch of different listings for people and their skills. So go check that out. It's at jobs.aderfruit.com. Let's see, what is next? Oh, I have a show on Tuesdays. In fact, if you're watching this Tuesday, that's when all of my computer problems began. The computer just exploded on me. And I had to very quickly get the laptop up and running. So this setup I have right now is a little fancier than the one that was going on on Tuesday. But the show on Tuesday is called JPS Product Pick of the Week. About 15 minutes long, I do a little intro to a new product, a little demo. And you get a great discount during the show. So if you watch that show live, it's usually a 50% off discount. This week was this Neo Key Socket Key Switch Breakout. And I'll show you a little recap, unless the audio for it doesn't work. You tell me. The Neo Key Socket Breakout for Mechanical Key Switches. It has a Neo Pixel built into it so that it can underlight your keys. It has sockets so that you can push your mechanical key switch into it without soldering. And then you can try different switches out whenever you want. I have these set up as USB HID keys. So these are sending shortcuts to my broadcast software, which means if I press one, we get this current camera view of me in the corner. Two, it switches to a duplicate. Three, is that little product webpage. Four goes to a little product photo. And five clears that layer out entirely. It is the Neo Key Socket Mechanical Key Switch Breakout. Hey, that's gonna loop there. How about that? So I was told that the audio was funky, but acceptable. Also, I am now, after jumping back from that video, seeing a audio lag. So tell me, does my audio lag from my video? Because that was a problem that I think PT was having, although he said it was related to animated GIFs, but having played that video now jumping back, I'm seeing a lag. So you tell me when that catches up to this part, if you see that, I will start and restock the stream real quick so that my video and audio can catch up to each other. So I'm checking the chat. By the way, if you're wondering about the chat, Adafruit is a great chat channel in Discord. It's adafruit.it slash discord, and that will get you an instant link to go and join in. Minor lag, less than a second, says Mr. Certainly. Love the factory, says no audio lag. All right, I'll give it a, let me just take a one second pause here to stop and restart this stream. See Grover says live mic audio is in sync. Okay, I'm wondering who's seeing it on what? Any Twitch people, any YouTube people? So YouTube is not lagging, says Todd Bot. Hi, Todd Bot, thanks. But Mr. Certainly on Twitch, got a little lag on Twitch, okay. Let me know if it gets bad and I will attempt fate and hit a button. All right, let's see. Next up, how about the new thing? You ready for the new thing? The new thing is the circuit, Python, par, sac, sac, sac, sac, sac, sac, sac, sac, sac. All right, I made up that song. I have a song that I started working on, but I'm waiting on some time to properly fill that song out before I add it to the live stream, but it will be in the recap. Okay, so let's see for the, I'm gonna do another little bit of setup here because we lost my Atom capture, not that one. Let's go to this one, back to that one. Go to the black hole and I will grab an Atom. That's my text editor, by the way, that I like to use. And let's see, let's switch out what we're looking at. Not that, not that. It might have been that, no, I don't think it was that. Let's open up this, okay. I know you're not seeing anything when I'm going to the file browser here. Sorry about that. All right, so let's load that up. Yes, that. Okay, I have so many layers to contend with. All right, let me make that a manageable size. And let's bring in, how about this down camera? Move that over there a little bit and a me. Yeah, that'll do it. For the Circuit Python Parsec today, what I wanted to do is show you a little bit about digital out. So last week, in fact, we looked at digital input, which is using these general purpose input output pins as an input. We want to read buttons, we want to read switches and that sort of thing. These pins are very versatile. That's why they're called GPIO. Last week, we used the I, now we're going to use the O, which is output. So these pins can be configured instead of reading and waiting for voltage. This says a switch has been closed. These can send out voltage or output voltage. So in this case, I'm going to use the output pins to light up some LEDs. So what you can see here is I have a Metro. This is the ESP32-S2 Express. And I have five of these GPIO pins. I'm going to set them as outputs and they're going to write voltage out to these LEDs, which are then going through a set of resistors to ground so that we don't send too much current through them. And here you can see what the code does. I've got importing times that I can pause, importing boards, so I get a definition of all these pins. And then I have the digital IO, import digital in out and import direction so that I can tell it to be an output instead of an input. Then I'm setting up a series of pins. So I'm using on this board IO 12, 11, 10, nine and eight. That's this little set right here. And then I'm creating a list called LEDs. And I'm setting all of those LEDs in this one for loop here for pin and pins. I'm setting up the pins as digital out, digital in out. I'm setting their direction to be output, and then I'm adding them to that list. So then what happens in this true loop, I'm going to go ahead and turn this on. And you can see it is going to, for each number, zero through four, it's going to send current, send an output to an LED and then move on to the next one, turn them off and then start all over again. And this could be anything that you want that's low enough current. So you're not usually going to drive motors and things like that, but LEDs are perfect type of indicator and a way to tell that you have something happening, but it can also be other control voltage level signals. So that is how you can, inside of Circuit Python, set up digital output pins. And that is your Circuit Python Parsec, or should I say Circuit Python Parsec, sec, sec, sec, sec, sec, sec, sec, sec. Having fun with that. Doctor over in the chat says, I need to learn Python. Hey, Circuit Python is a really terrific way to learn Python. So go to our learn guides and check it out. You can also just go to circuitpython.org and you will find a lot of links there about how to get started, which boards you can use. There's I think over 200 boards now that run Circuit Python and not just Adafruit boards. In fact, let's pop over there for a second. Let's see where that Chrome capture window go. There's one. I'm going to open up a new tab in here and go to circuitpython.org. And here you can see there are sort of the key sections are downloads, libraries and Blinka, which is for using Circuit Python on a single board computer, like a Linux or single board computers. If we head to downloads, you'll see a list of microcontrollers that run Circuit Python. And in fact, there's 202 of them here. The first one that shows up there is actually not from Adafruit. That's from the Raspberry Pi Foundation. That's that Pico RP2040 board. And then as you scroll through here, you'll see all sorts of boards, general purpose boards, some really specific ones. I think this one might be for driving higher current stuff. There are a few like that and on and on. And since it's such a big list now, rather than scrolling through forever and ever to find something, you can use the search. If you're looking for a particular board, you can type in a search here, let's say seed. And here are boards by seed studios that run Circuit Python. You can also set up filters here to say, okay, I wanna find one that has GPS on it and is a particular, let's say it's also got wifi and so on, so you can do some filtering there to pick a board. All right, so let's now, head on over to the workbench to look at a new project that I've got coming up that I've just started working on, in fact. By the way, my camera switcher is the one thing I didn't get hooked up in time. I actually, part of the process of taking this whole setup that was going all plugged into my iMac Pro and moving it to this MacBook Pro is just a ton of ports are needed. And I miss, I have like, I don't have a hub for USB-C and I needed one more hub to be able to get enough things plugged in. So actually, you know what I'll do? I'm gonna unplug that. I do have enough. In fact, I'm gonna unplug this metro and plug in this extender. And that actually should allow me to use the camera switcher over there. So I'm gonna manually switch, then I'll head over there and, oh, you know what, I think I'm lacking, yeah, I'm lacking the necessary USB cable over there. So forget it, no fancy camera switching today. But what I'll do is head over to the workbench and I'll set up a overhead view in the corner there. And then I'll talk a bit and then I'll switch them. So what I've got set up this week for the project of the week, let me take off these glasses here, is a little simulator of a parking assistant. So if you have a garage or a wall or a fence that you always park against and it's pretty tight, you need to make sure you get right up close to it, but you don't wanna go too far. Some people, if they have a garage, they'll, at least in the old days, used to hang a tennis ball from a string. And if one particular car with the windshield in the right position in the right angle touched that tennis ball, then you knew you had parked deep enough in. Some cars, of course, have cameras and other assistants, but on a car that doesn't, you may wanna set up your own little ultrasonic parking assistant. So the way the ultrasonic parking assistant works here, I have it set up with, okay, I'm gonna switch cameras now. I have it set up with a fun house, which I've stuck against this little wall here, just using some magnets. And I have a ultrasonic sensor. And the ultrasonic sensor is essentially like sonar. The idea is there are two little elements there. One sends out a ping, a high-pitched frequency ping. And the other waits to hear that reflected sound and it essentially counts the time. How long does it take for that echo to go and come back? With this, you can estimate distance. And this one is particularly good for distances of about a couple of feet down to an inch or so. So I think maybe up a five, three centimeters, something like that. I'll check the specs and I'll show you that in a second. But for this demo, what I have set up is I've got a toy truck here. This was my kids played with this, a toy garbage truck. And right now, actually, I have something that I'll have to try to figure out what's going on because I have an external Neo's Pixel strip here that's not working at the moment it was. And I think it works when I have it plugged into the computer and not on this power supply, which is weird because it's a pretty beefy one. So the only thing we're gonna see change are these LEDs up at the top. And I've put a little diffuser up here so you can see this top one. So if you see this green light, watch that. And as we get closer to our parking spot, you're gonna see that change to yellow. So you can see the light there just changed to yellow. And now as I get closer, it's gonna change to red. And so that means we've, let's go a little closer. We've reached the limit. You don't wanna get any closer. So you could tune that, tune those values. That's all I did was I just kind of held my hand over it while I was coding it and set up some numbers. I think 20 centimeters is yellow, anything beyond that screen, anything closer than five is red. So you can see as we back out, we get a little change in that light there. My hand there so you can see the reflection. There we go. And so this is just my first sort of prototype version of this and what I like to do is first of all, get these neopixel strip working and maybe do some flashing of lights, maybe increase the speed of the flashing as we get closer and closer. So you have some break points of color, but then you also have some sort of tempo of the flashing so that you know you better slow down before you hit red. So what I'll do is actually, I'm gonna take this off of here and we'll plug this in over on my work station where I think these LEDs are gonna work. This neopixel strip is gonna work again weirdly. And then we'll take a look at the code for it. And I've also got a little bit of a hack here for turning this sensor 90 degrees when you're working on it. So I'll show you how that all is set up. So let me switch to this camera here and get that out of the way. So are people blaming Lars for my neopixel strip not working? It's probably accurate. Oh, someone's, there's a, if you had to discord there's a terrifying photo of a Lars claw. What's he doing back there? Gross. All right, so I'm gonna plug this USB cable back in. And what you'll see here is so with the breadboard and this ultrasonic sensor in sort of the normal orientation, it works well for this angle. So it's essentially parallel to the desktop here. If I wanna point this up, which is really helpful when you're coding on your desk and you wanna put your hand over it, what we wanna do is we want to point it up so I need a 90 degree angle bend. So what I'm gonna use is a little set of header pins that I've bent. And I do need to flop the orientation of these cables. So I'm gonna take those, flip them around. Sorry, that's probably just my hand in the way of the camera. There we go. And if I plug in like that, now I can, you'll see here I'm matching up the voltage trigger of the ping, echo and ground. So that lines up with that. And then I have those plugged into power and ground and a couple of pins A1 and A0 is what this requires, is two digital IO pins so that it can send and receive. And let me try to get everything in view here. Yeah, that should work. And I'll go ahead and give it power. All right, I have to switch over to Discord for a second and reconfigure that so that I can share this terror on the stream. Yeah, there's Lars, our murder puppet friend. If you're just joining us, he's a real hero around here. Thanks for that. Doctor says I can't tell if it's normal part of the show or because I'm new and unfamiliar with the memes. Yeah, there should be a primer on Lars, Lars. We don't have a lot of in-jokes around here, but we do have a soft serve ice cream truck based murder sloth puppet. If you look up Lars in the learn guides, you will find I did a learn guide on adding a sound chip to a stuffed animal that features our friend Lars. So here you can see weirdly enough the neopixels are working. And I'm very confused by that because I'm just powering over a sort of typical, maybe two amp or even one amp USB hub here. And back there I was on a three amp USB wall outlet. So don't know why that's happening, but what we should see is as I move something in front of the sensor there, sometimes your hand actually isn't the greatest thing for reflecting it back point blank as you get closer, it kind of reflects off at weird angles, I've noticed. This works well, it's just got a coaster. And then as I get lower, you can see there we're gonna go to red, yellow and green. And if you look at the screen here, you get some of the glare off of there, you can see, yeah, it's pretty in focus, you can see the distances it's measuring. So I think this is in centimeters. So right now we have about 29 centimeters, it's probably seen the camera that's looking at it. And then there I've got about 10 centimeters, six, five and a little less than five we get to that red light there. So let's have a look at the code there. I'm gonna go back to Adam and close this and open up the code that's on the board. If you're new to CircuitPython, by the way, one of the convenient things is that it's a runtime executable that you feed these code.py files to, so you can open up your microcontroller as a USB drive and open up the code that's running on it. And in this case it's just this plain Python file plain text file. So here is what's going on with this code. I've got some library imports of time, board for pin definitions. The HCSRO4 is the library for the little ultrasonic sensor here. I'm importing NeoPixel so I can do this external strip and then I'm also importing FunHouse. So the FunHouse library, the main things I'm using it for are the dot stars that are on top of it. So these glow-in lights up here that we're also changing the color of, those are dot stars. It's easy to use the FunHouse library to talk to those. And then the next thing I'm doing is I'm setting up three variables for some colors that I wanna use, green, amber, and red as hexadecimal values. And then I set up the FunHouse and turn on the dot star brightness to something pretty dim in this case, you might brighten this up if you're using this in practice as a nighttime garage or parking space alert. As long as you have like a covered garage or you put this inside of a waterproof case, like an OtterBox or something like that, you should be okay. And then I'm filling the dot stars with green. So this is this command, FunHouse.perforals.dotstars.fill and then that variable that I created for the green color. The next thing we're doing is, you know what, I'm gonna see if I can scale up this screen a little. I should leave well enough alone, honestly, cause I can't believe the stream is working given given all that went into making things work today. Whoa, my audio just echoed. Sorry about that. Oh, that's interesting. I wonder if that was going on with the audio. That's a little bit bigger. All right, then I am setting up the board A2 pin for the NeoPixels. That's what this NeoPixel strip is plugged into is this A2 JST connector right here. So that supplies ground, power and signal to the NeoPixels. And then I set those up as 30 pixels as a strip called pixels. The Sonar is the name being given to setting up this little ultrasonic sensor using the library. You set the trigger pin, in this case to A0. So that sends the impulse. And then the echo pin is the one that receives it. And that's set up on A1. And then here's what's happening in my main loop. This sometimes doesn't return anything so you can set it up inside of a try accept loop so that it doesn't just crash. So you will see that in my serial output here. Let me open up the serial display. So you'll see sometimes it sends a ping and doesn't get an answer. Sometimes it does and so that try accept loop helps us not to have any problems with that. Then what I'm doing here is pretty straightforward. If loop, so I have if the Sonar distance is greater than 20 then I fill the NeoPixels strip and the dot stars with green. So pixels fill show and Funhaus peripherals fill. Then when we're between five and 20, so less than 20 greater than five, that's when it goes to amber. And then when we're less than five, that's when it goes to red. And then we do a little bit of a sleep here, this 0.1 second delay. And that is it, that's all it does. You can of course add some sound to this if you wanna get a shrieking alarm. That would be a nice addition to it. You could do some graphics for it, maybe a little setup, either calibration so that you can set it up from the on screen or just use the buttons on the Funhaus to increase or decrease the levels. But I think it's a pretty fun project. I'm gonna build this out a bit and I will be putting together a learn guide on it. You can look for that in a couple of weeks. You can also expect the water sensor one and I'm just about done with the mail slot sensor one. So I have a little bit of a backlog of learn guides but I think I'll be putting out the mail slot one today or tomorrow, so that one will be coming up next. Here's another fun photo from the Discord that C Grover has put in that is a, looks like a variation on the tennis ball from a string. Low self-storing parking alignment system. Low tech self-storing parking alignment system. That's great. All right, so let's see. What else have we got? Any questions in the chat? I'll bring, let me bring that chat back. Where'd you go, Discord? I'm gonna turn this off so I don't have a green underglow. It's kind of creepy. Bring this, scroll back a little bit. Let's see, what else has been going on? Yeah, thanks, who did this? Thanks Andy Calloway for the Lars the Prince. I love. Oh gosh, yeah, that's upsetting, that photo you found there. Let's send it right back there. Ooh, nice photo Hugo making your own garage door. A brick under the front wheel, that's a good one. Dexter Starboard says, amazing how little code it takes to make a useful gadget. Yeah, boy, I agree. I mean, I really do think that modern microcontrollers with Arduino and circuit Python or with make code, you can get a lot done, actually a lot of useful stuff done in a tiny amount of code. And it's a lot of fun, it also would be pretty functional. All right, well, thank you all so much for coming by. Sorry that I had to delay it an hour, but cross fingers, I will get to work on my main workstation and get things set up again. I gotta get this laptop back into my studio to use it in there, but that's gonna do it for today. So thank you so much. And let's see, we've got Scott is gonna be doing his deep dive. I believe he's got one tomorrow. Usually does them on Friday at two o'clock, I believe. So check the blogs, check for also here on the Discord for any announcements about that. And then I'll have another JP's product pick of the week next Tuesday and this workstation on Thursday. So I hope to see you all there. And we got a bunch of shows in between there too. Noam Pedro, we got a bunch of great content from Colin Cunningham that you can check out on our socials. And we have the show and tell featuring all of you, our community and Desk of Lady Ada and Ask an Engineer. I hope I didn't miss any in there. We also usually have a layer by layer and three hangouts, I should say. So a lot of good content here for you to watch if you're into this stuff. All right, thank you everyone so much and I will see you next time. Let's see if the song plays on the way out. Bye.