 And welcome, it is time once again for another episode of John Park's Workshop. It's me, John Park, and here we are in my workshop. It's hot in Southern California, I think it's 90 or hotter today. So I've got the AC cranked in here in the workshop, so you'll hear me talking a little louder because I can hear it. I know you guys say you can't hear it too badly, but it messes with my brain. So we've got all kinds of fun and interesting things going on today, so I'm excited to get started. Let's see, first of all I'll mention that we have Eight-A-Box 18 coming soon. So if you're a subscriber that should be in the early stages of getting put together and shipped out. I don't think we have a, I haven't heard a definitive shipping date, but I think we're getting close. Some of the parts have been held up here and there in the sort of worldwide shipping crisis process that we have going on, but that one is coming up. We should be doing an unboxing somewhere in, I believe, mid-May, so just a few weeks from now. And if you're not a subscriber, you should probably take a look at subscribing to Eight-A-Box 19. Is that the one that's after that? I think, yeah, I think this is 18 we've got coming up. So you should be able to subscribe for 19. So go and check that out. Go to the Eight-A-Box website, you can go to Eight-A-Box.com or Eight-A-Fruit.com slash Eight-A-Box and find out more. And let's see, other news and things. If you weren't aware of it, we've got this jobs board. There's the Eight-A-Bot Help Wanted sign and what I recommend is you head over to this site right here, Jobs.Eight-A-Fruit.com and take a look at some of the positions that are available if you are looking for work. There are always new positions being posted. Right now I saw this one experienced design specialist in Westminster, Maryland, as well as this content intern in Canada, our neighbors to the north. So just a few of the positions that are up and available over there on Jobs.Eight-A-Fruit.com so go check that out. Let's see, in other news you may know that I've got a show on Tuesdays called JP's Product Pick of the Week and it looks a lot like that. This week's product pick of the week was this Neo Trinky and I thought I'd give you a little one minute recap of that right here, right now. Check it out. It's the Neo Trinky. It's a USB key for NeoPixels. It runs Circuit Python. It runs Arduino. It is your best friend. It is a key chain and it's a whole bunch more. This is an iPad and then you'll see here I'm using a long USB extension cable and then I'm going into one of these little adapters that goes from Lightning to USB and then I have my Neo Trinky plugged in there. This is currently set up to act as volume up. Really one thing to do with the Apple system camera and let's take a picture by holding down the volume up or volume down. They both work. You can see in here when I take that picture, it takes that picture. Very nice. Let's wave everyone. It is the brand new Neo Trinky, your best friend and mine. Yeah, that's right and check it out because if you watch the show while it is happening live, there's a discount on the product pick of the week. This week it was 50% off so you could get that Neo Trinky at half price. It was like $3 and something at that point. I think it's normally around $7, $6.95, something like that. If you can tune in while it's live, good for you. The time on that is 4 o'clock Eastern time, 1 o'clock Pacific time in the US on Tuesdays. What have we got next? As you know, I've been putting together this new segment, this new show within a show and it's called the Circuit Python Parsec and look, I've got a logo. I don't have any music yet. I'm working on it. Here it is. It's the Circuit Python Parsec. Let's get some setup going here. I'm going to bring a session of Moo. I'm going to bring in an overhead camera and I'm going to bring in a me. For the Circuit Python Parsec today, I want to go back to the basics and I want to talk about some really fundamental things that you may want to know if you are working with Circuit Python, just learning Circuit Python, if you're new to programming, maybe you're transitioning from a graphical based programming into some code where you're typing or maybe you're already very experienced but you're just moving over from another language. Here's a fundamental thing. How do you read the input of a digital pin? If you look here on, I've got a Metro Express right here, Metro Express M0, there's a bunch of pins here. General Purpose Input Output Pins, GPIO, and sometimes we want to use these as input pins so we want to be able to read things like switches and buttons. In this case, I have a little button, a little breakout board for a button plugged into ground on one side and I have it plugged into a digital pin, pin D7 on the board. So in order to set this up, what we do is if you look at my code here, I'm importing the board which gives me the definitions of what pins are connected to this board and what they do. I'm importing this library called digital IO and specifically I'm bringing in the sections of the library for digital inputs and outputs for direction which allows me to say whether I'm going in or out and pull which is using an internal pull up resistor. Then the next part of the setup I have here is actually just so I can see an LED blink so we'll ignore that part. But then we have this little bit of setup here where I'm, let me click on my Moose session so I can highlight things as I talk. So you can see here in this section, I'm setting up one of these pins as the button pin and I'm calling that a digital input output on D7. I'm setting the direction of that pin to be an input so it's reading from an, from an external thing inward. And I'm setting that up to use the internal pull up resistor on the chip. And then my code for doing something interesting with this pin is simply the main loop of the program where it says while true, what happens? We change the value of that LED to be the opposite of the button value. So when I press that button, the button value is going essentially from high to low and that's sending my LED from low to high and this is because the nature of the pull up resistor. So there you can see LED value equals not button value and that means we get to click on the button and light up the LED. Now of course you could do many, many more interesting things with it than that but this is the very beginning sort of foundation of how do I do stuff on my microcontroller and one of the key things you want to do is interface with an input device from the outside world and for that we use the digital in. That is your circuit, Python, Parsec, Parsec, Parsec. Got to work on that echo. All right. So by the way let me know in the chat if there are specific things you'd like to see as I start going into circuit Python kind of from the ground up and I might not necessarily go in order so we may do more advanced stuff. You can see I started with some slightly more advanced things with my first couple of these and now I'm doing some basics so I'm okay jumping around but let me know what you'd like to see and people may wonder when I say in the chat what am I talking about? I'm talking about this right here as well as the YouTube chat. I'm sort of keeping an eye on both but if you're really wondering where the main chat is for a lot of the Adafruit Live shows then you're going to want to head over to Discord and it's the adafruit.it slash discord will get you the instant invite link to go into Discord and you can see that we've got some good comments here. In fact, here Todd says you're making the button physically lower when pressing so it's going from high to low true to false. Not really but that could be a useful mnemonic. That's right the physical button is moving. Yeah that's a confusing part with these things is a lot of times you'd think it's kind of off until you press it and then it goes on but depending on the type of resistor we're using are we grounding that pin normally and then when we click it we're sending it to a high value or is it the opposite which is the case here. So sometimes that meaning of the button is kind of opposite of what you intend which is why you can see I just in this case said okay the LED value is not equal to the button value it's actually the opposite of it. So Hissy Grover asks the park sec I think Phil thought that that's what it was last night maybe I'm I'm open to that I was actually joking earlier with someone about doing a show within a show within a show and having an actual one second long park sec inside the park sec alright enough of that so yeah but thank you everyone for stopping by and also thanks everyone for stopping by over in the over in the YouTube chat Jose Corujo says how much for the Neotrinky take my money now let's let's check actually I gotta I mentioned what I thought the price was but if we go to just click on this shop link here and type in Neotrinky it's $6.95 they are in stock and if you were lucky enough to get it during the live stream of jip pa pa pow then it was half off alright next up what have we got oh you know I have a cool new project of the week that I'm working on before I jump into that though I wanted to take a look at the learn guide that I just finished for the previous project from from just a couple weeks ago so let me let me load up my browser you can you can watch along as they do this in fact let's bring this up over here so I'll go to learn.adafruit.com and I'll head down to the new guide section and just click on view all and there you can see actually this is the newest guide and this is my funhouse motion detecting lights with lifex or lithics none of us know how to pronounce it bulbs if anyone has a definitive answer to that I'd love to know I think they call it lifex in one of their videos that's probably correct but you can see here I've got a web page here this learn guide here that takes you all the way through it so starts off in the overview of telling you about the project so the key thing with this project is using the funhouse and a little PIR sensor in fact I've got one right there this is a little infrared sensor with a sort of Fresnel lens that gives it a 60 degree viewing angle I think my right I think so and this detects people from about five meters away or anything that's sort of a large infrared heat source that's what it's detecting and this is plugged into the front of our in fact I'll show you right here I've got a little little bit I did about plugging that in front of our funhouse board so with the funhouse board here you can see and go to the close up of this very large scale version of it you can see on that little PCB there's a plus sign for the positive voltage there's the output signal output and there's the ground there on minus and you want to line those up with these three points on the board and plug it in from the top down I don't think I have a spare one I can grab oh here I do let's grab this one so interesting thing with this is that we used a sort of reverse mount header for that socket and you can you can mount this from I get that aligned properly we can mount that from the front there push that in like so if you mind that polarity and I think I have yeah I had that wrong okay so if you mind that polarity you know in fact I'm going to go to the down shooter here so you can see this a little better all right so here you can see we've got our positive on the left there so it'll go in like this the first time you do this it takes a little bit of force but what you're pushing against on the backside is just this header here so so you can push down pretty hard on what I recommend is grabbing the little PCB by the sides so that you don't bend the connection of the the top there so if we give that a little bit of a push and a wiggle in it goes and it's actually easier subsequent times if you pull that out if you maintain that orientation cool thing here is that we can actually flip this around and stick it into the back of the board and I found this was actually easier way to have it set up while I was working on code for it because I didn't have it pointing at me while I was trying to set things on on the screen here had some little user interface elements and buttons to use so this way it's pointing away from me and I can just wave my hand in the back that also means if you're setting this up as some kind of alert system let's say you want to trigger a camera to take a picture of a wild animal if it's big enough I suppose this is probably the way you want to have it oriented not back at yourself so going back to the guide here at the page or two so that's a little bit about inserting that there I wanted to show you that in a live video I've got a page on just the bulbs set up so when you get one of these bulbs there's a nice little quick start guide that takes you through getting it set up screwing it in using I think there's a QR code that you can enter on the app if you're going to use their their app on your iOS or Android device but then you'll pretty quickly want to go to their cloud site I think it's cloud.lifix or lifex.com and there you can get using your login information you can get an access token in their API the developers portal and then you'll be able to use that in your secrets file in the circuit pi circuit python codes you have a secret secrets.py file on your fun house that the code.py will access I also talk about testing the connection here I don't think I have one plugged in right now here but I showed this a couple weeks ago you can do things like from Python or even just with a curl sending HTTP requests you can talk to the bulb and you can also get information back from the bulb about its state which is kind of cool so heading to their portal they've got a lot of information there so there's a link in there for that and then I've got a whole page here on coding it setting up your secrets.py file downloading the project bundle and setting up that code on this on the fun house and then there's a little bit of a code walk-through to tell you how it all works check that out and one of the things I didn't really explore in here but I think is a fun idea is to do things beyond just changing the lights color when you trip it but maybe send an animation you can do animations on it you can send to multiple bulbs so if you have multiple bulbs they don't have to do the same thing they can but you can also have them do different things in fact this was kind of interesting I had two bulbs I set them up with the same name called it lamp and I had one here in my workshop I had one inside my studio and even though they were on different Wi-Fi networks when I tripped the bulb using my fun house inside it changed the one out here so actually could tell if someone was in my studio my light in here would change which is kind of cool this is because this is not an ad hoc Wi-Fi network between the fun house and the bulb it's actually the bulbs are you're talking to them over the internet so you're going through the the lifex cloud which means you don't have to be on the same network to trigger them which is pretty cool and then this is a little bit of a demo of setting it up here in this case I just set it up with a mounted it on the wall set the lamp near it just to take the photos of it but now you essentially have a room detector so someone goes in there you're going to see some lighting changes which is a lot of fun so I'll be curious if anyone sets these up and does some interesting things with them if any of you've picked up any of these bulbs they are I think they were they were sold out for a little while I think they're mostly sold out on the the lifex site but you can find them at I think some of the big box hardware stores home improvement stores as well as on online on places like Amazon that's where I got mine yeah Johnny Bergdahl in the comments says you might want to try putting the sensor in that backside first that might widen that socket a little bit before you try going in from the back end that's a good point because I think that's the tightest spot is there on this side all right so now that brings us to project for this week I'm going to head over to my workbench get a bench cam set up now alright so what I've got going on this week what I wanted to play around with you can see my overhead here and I'm gonna detach this for a second so you can see it up close this is a type of water sensor that is really great for doing a leak detection so if you have something that should be dry and you want to know when it becomes wet this is perfect these are inexpensive you can get them all over the place just look for water sensor sometimes they call them water depth sensor and I think you may be able to use them for like really broad range is it empty is it halfway is it full but I found the mineral content in the water I have is basically it's dryer it's wet is kind of the best way to use this there are better sensors for doing things like depth but with what these do is I'm using this as a digital input so that's easier than doing it as an analog in this case and it's just gonna tell me I have a fun house setup here in fact let me plug in my camera switcher let me view this in a full full-scale view so you can see it but what I'm what I'm picturing this for is let's say you have a water heater and it has a little drip pan underneath it that should be dry and you definitely want to know if something bursts and it starts leaking so this is a really great sensor that because you can reset this you can set this so that it is just a millimeter above the the bottom or even touching so long as it's not a conductive surface if you have a plastic pan that would that would work fine and the moment some water gets in here it is going to trigger this sensor the sensor is going to detect that there is there is water in there and then what I've got it connected to in this case is the fun house so you could use this with nearly any microcontroller but the cool thing about the fun house is that it is internet connected so you could have a email go out you could have a text message you can have an integration using if this than that to something like discord or slack as well as sounding alarms so what I've built here today is a let me see if I can switch cameras here is it going to let me I think I need to go activate my app there I forgot to add a button for that let's highlight this here I'll just switch it manually first just in case there we go so just for testing purposes to get going with this all I'm all I'm doing on the the fun house is I've got some of these lights up at the top these are five little dot stars and I have them set at this kind of amber color which means dry we're not lit up right now it's just as water sensor here on the text and for now I just have this kind of grayed out so when this gets wet I'm going to beep my little alarm I'm going to change my Neo or my dot stars rather RGB LED dot stars to blue and I'm going to highlight the text in blue so what I'll do the little setup I have for this is I put a little measuring cup here kind of beaker and I'm going to pour some water this is I think filtered water distilled water may have low enough conductivity that it won't trip it so this will work best for tap water that type of thing okay so you can see as as the water goes in there it's just barely in and what I'll do is I'll take this out and dry it off you can probably just dry it off with your finger but any pretty much any water on there is enough for it to trigger as okay this thing is wet and so in fact I'm just gonna put some of this water on my finger and this might be a demo you can see a little better in that overhead soon as I touch that with some water you can take a little drop of water on there it is going to get a little handkerchief it is going to trigger that so the way these work we zoom in a little bit is there are a series of copper strips here and they are essentially every other one is a sensor pin or a think voltage I don't think it's ground I think it's voltage and so when those get bridged with something conductive like water this should work with you know anything conductive presumably if that is let's see is a screwdriver yeah but the water is what it's designed for then that sends the digital signal that it's been switched just like that button I showed during Circuit Python Parsec and then that sends the alerts to the to the fun house so what I thought would be fun to do now is just take a look at the code that I'm using for this especially pretty similar to the button code just a little bit more setup to make it'll do a few more things so let's grab this and pull that off of I love these little magnet feet I'm just using a piece of steel there to stick it to unfortunately workbench over here I should bring that along with me actually says that things will stay put otherwise they're gonna flop around let's go down shooter here about me up there hey there's so many of me hold on a second you can see how that's plugged in there I'm just using a this is one of our JST 3 pin I think it's JST SH is that right pH I can't remember which one's the bigger one maybe it's pH and then we're going to signal power and ground and I'm using a little jumper connector there that interview and let's give this some power so let me plug in a USB-C cable in the chat someone says when I had swamp coolers this water sensor would have been useful to let me know the water pump stopped working this water no water means no cooling see this will boot up mess with that focus just a little touch there we go and let's actually bring up the code and so in Adam I'm actually just going to open up the code dot pie that's on that board that's what's running on there and over here okay so you can see what's going on here I've got the board definition for pins with import board digital IO same thing as before using the debouncer I love this debouncer because it allows you to really easily do things with switches that are both only on the change of an event like a rise or a fall as well as checking the value of it which can be kind of a constant thing I'll show you how I'm using that a moment and then I'm importing fun house and that gives me access to a bunch of the nice convenience convenience features like using the screen setting the dot stars with just a simple line like this and so on later what I'll be doing is the necessary network stuff to send things up to Adafruit IO as well when it gets triggered so that you can find out let's say you have a remote location you have a second home or a cabin or something like that and you want to get an alert when one of these trips this would be a pretty good setup for that type of thing as well and I presume you could do a few different sensors as long as they weren't too far away on one one of these boards probably have three of these sensors plugged in with longer wires if you have multiple things that you're checking the water level on or for the presence of a leak rather then I'm setting up this sensor pin so this is using the a1 pin you can see it written right there it's the a1 pin that I'm using could use a0 and a2 as well setting that up as an input and using a pull down resistor internal and then I'm setting up the debouncer so this this variable name sensor is actually the debouncer checking that input pin setting up some labels on here or rather a way to turn the label color on and off let me grab some of this water here could use my iced tea but I'm just gonna drink that see an action there again so you'll see the pins the the text is going blue and the dot stars are going blue there as well they go back then I'm setting up this one label and that's how using the the funhouse add text function we get this water sensor text position x y coordinates and the color it's gray to start with and then show the display so this is what shows any lines of text we've put it shows them up on the screen and then this is the the main loop of the program so while true we do sensor dot update that's the debouncer so the debouncer every cycle of the program running checks the state of any buttons that are that are connected to to to the debouncer then on these three events there's three things that happens if that rises that means we've gone from low to high and in this case that's that's what happens when water goes on the sensor then we are going to fill the dot stars up at the top blue that's it they just get set once so I'm not constantly sending dot star requests to just this one time even if it holds there high the water is staying it's just gonna only send that command once which is nice and efficient when it falls so when I dry it off then we're just sending this if sensor fell with the debouncer we'll set the dot stars to this amber color that I defined earlier and then this one is more like that demo before of holding the button down so if the sensor value is high which is what's happening when this is wet then we play that tone which is I'm just playing it for like a quarter second which is why you're going be be be really annoyingly and that goes on continuously until until we dry off that sensor and then lastly the label color this is this function that I set up here this set label color is based on a conditional value and the sensor label is the the one that we're changing so whatever the value is true or false the label name of that text label and the color so this is gonna send that to that bright blue when we when we have tripped it and that is it it's very simple so of course I'll add in my aid of fruit IO credentials into the secrets file as well as probably a maybe just arrest that'll be faster arrest message will get sent and then from there things will happen so the aid of fruit IO feed will gain a data point saying that it's been changed as well as the time and then from there we can do things like watch it with if this than that or Zapier send an email out and do other things so that is my plan with it if you have other thoughts about that let me know in the comments let's see the yeah someone said that the leak test could be nice for something like people who build liquid cooling PCs for example yeah if you're putting liquid inside of your computer I imagine having a leak detector would be great I I have a fairly involved espresso machine it's kind of a an industrial grade cafe machine it's big it's old it's Italian it's a boiler room basically in a box this big and I might stick the I've had leaks even little ones that are going over time a steam is escaping from from one tube it might be a good idea to stick the sensor under there we'll see a lot of my projects end up being being helpful for espresso machine stuff all right let's see what else Kevin Walters asked does the neotrinky have capacitive touch on the end yeah actually let me bring up I'll bring up the discord chat here one second my camera switching is slow today there we go that was actually a question in the YouTube chat but yes so I've shown this couple times but I love it so I'll show it again I've got an iPad up here I can show you that you probably saw this if you saw that make code minute thing a minute ago oh you can't see that right now because it didn't move the the discord chat so this is the neotrinky it's plugged in over USB to the iPad so it's got these two capacitive pads and you can see when I touch them they're sending a HID keyboard command volume up that tells it to do the trigger release and then I'm also changing the colors of those those neopixels so yeah it's two separate capacitive touch pads in fact I'll show those under the the down shooters you can see them a little better this is kind of upside down there we go yes you can see pad one and pad two there you can touch them from the bottom as well actually I'm kind of curious I know that if you look at where's my other one here's one if you look at this guy this is a at samd 21 same one we use in our trinkets and this thing is an awful lot like a trinket but you know clearly we've only got like four pins broken out we have two capacitive touch we have a reset button and we have a neopixel line so I'm curious could you use some of those other pins if you wanted to get get creative with a soldering iron and some badge wire could you access some more of the GPIO that's a question for for the chat there what do you think is that possible it might not be practical but practical thing would be get yourself a cutie pie or a trinket oh and Janiske 7 says no and Pedro made three 3d printable cases for the trinket that's right I actually put one on a keychain here and I covered the neopixels with a little bit of diffusing plastic which might also give them some protection but yeah I think a Todd bot mentioned if you have that in your on your keychain you probably whack some diodes off of it or capacitors eventually yeah that's a good question AT maker Bill says are any pads broken out on the back just programming pads so you can see here on the back you've just got well you got a reset but I think these are for for your programmer if you want to flash the chip directly oh see Grover has it has a nice tip let's try this out he says here let's pull up discord and let me pull up Adam there you see says plug it in import board and dirt board to see if the pins are defined oh and top up I think top up's right the SWD and SWC can be used as pins okay that's cool yeah let's see what happens so let me grab this trinky and let me plug it into a little USB hub I'm gonna bring up Adam here okay so I just unplugged unplug a few few circuit Python things so I get the right serial port this would be this will be changing in circuit Python 7 let's see screen dev TTY USB so this is who it's not seeing it let's see why are you not working that's interesting because it is actually doing its job that hello trinky is me touching those cap touch pads you know what it might be because Mu is open let me close Mu down as we have the battle of serial port things grabbing serial ports no reset the board no all right let's see what else could help us out here is it I think this one's not in Arduino sketch I think this one's circuit Python but you know let me try another board yeah okay maybe right yeah that one didn't want to be connected to so if we do import oh well I had this one in plugged in still too I had like so many things darn it okay let's try this again so many things plugged in how about you sorry I can't show you a camera if that that viewer will lose the other window no now yeah that one's all right are any of these I'm sure some of these are circuit Python sketch let me try to open the code pie on it just to see yeah sure enough this is not showing up I wonder is it my USB hub I'm gonna get the hub out of this equation let's see if a oh my gosh AT makers bill just showed speaking of too many boards yikes all right so let's see if I can get one of these show up as a circuit pie drive there's one another yes okay think this will work good and trinky okay so let's see import board okay so that's all it's broken out in the board definition so you might try putting the trinket version of circuit Python or the Gemma version of circuit Python on that trinky if you want to attempt to use other other pins but that could go horribly wrong or you try to make your own board which is which is another way to go so all right well thank you thank you for putting up with that experiment good to know and if Todd if you have info about using those other pins as something other than SWD SWC that would be neat to put in the in the chat there get creative with it all right so I think that's gonna do it thank you everyone for stopping by to another episode of John Park's workshop that's gonna do it for this week and I will see you again next week and have a good one bye bye