Alright welcome everyone. We have 30 minutes. There's a bunch that I want to cover today. So first off as was mentioned I'm Jeff Holland. I am a program manager. I work in the engineering team out of Seattle So I was very excited for the chance to travel out here with a few members from our team as well and talk to you today About Python and specifically with Azure serverless now before we start just to get a feel for the room How many of you here have already used serverless in some form or fashion? That's AWS Lambda Azure functions Google Cloud functions Okay, great. So about 20% and then of those how many of used Azure functions specifically? Okay, I'm very few great. So everyone will learn something today. Let's get started then so for for those who Maybe didn't raise their hand Before I even start I want to set some context like what is serverless? What is with all of the people talking about serverless? How much is hype? How much is just vapor? And to kind of explain how I think about serverless I wanted to use this analogy and that's how did I get here today or how did any of you get here today and specifically this one the the public transportation in Switzerland is a little bit better Than when I give this talk elsewhere and maybe the United States But for me I landed at the airport yesterday morning and I had a problem to solve How do I get from the airport to the Congress Center and there was one option? I'm only gonna be here for a few days. I could have bought a car I could have walked from the airport to a car dealership. I assume there's one close I could have picked out a car put down whatever a couple thousand euros Registered that car with the government. I assumed that on an American passport. I could buy a car I don't even know pay taxes There's a lot that that would involve right. I would now be maintaining that car I would need to make sure that had fuel. I'd need to navigate to the Congress Center And now I own this massive asset of a car for my trip to Switzerland might be a little bit overkill So the other option that's pretty popular is maybe I could just rent a car Rather than just purchase one outright. Maybe I walk down to the car rental Like Avis or something and I say hey, I'm gonna be here for four days. Can I have a car for four days? They're like sure. Here's the keys You're gonna pay 50 euros a day in this car is yours So now it's a lot easier than buying a car. I don't have to worry about changing the oil I don't have to worry about paying taxes or registering the vehicle And now the only things I have to care about are making sure that it has fuel I still have to look up directions to the Congress Center and for times like right now where I'm not driving I'm actually in front of all of you talking. I'm still paying for my rental car whether I'm using it or not I'm still paying that daily rate So the last option which is actually what I'd use whenever I travel is rideshare And this is the ability so that I really go to the airport I opened up the uber app. I said hey, I need to get from the airport to the Congress Center Immediately a car pulled up. They said hey Jeff come on in. I jumped in the back seat Payment was taking care of I didn't ever think about directions. I couldn't tell you how I got here It just happened the driver was concerned about the fuel the driver was concerned about directions I just got in the car got to my destination and I only paid for that car During the time I was actually traveling So why did I give you this wonderful monologue about the decision I made when coming to? Euro Python and the reason is because you can kind of think of this in your different options For how you host your code and how you can run your code So if I have a Python application that I want to run I could go build or maintain my own servers I could get virtual servers in the cloud. Maybe I actually use my own hardware. It's totally feasible It's something I could do but there's a lot of things that now I need to manage and maintain I need to make sure that those operating systems are up to date I need to make sure that my machines have power if I get a big load of traffic I need to make sure that I have enough capacity. Those are all things that now I need to be aware of in managing Now there's also these platform as a service offerings, whether it's in Azure or an AWS or Red Hat or Pivotal These are nice. This makes it so I'm not often managing the underlying machines But I still am in charge of a few things. I need to make sure that it's skilled appropriately I need to make sure that I'm following the kind of constraints of that platform service and very likely I'm paying a fixed cost Whether my code is actually running or not Now serverless to me is very much like this rideshare world in serverless. All you care about is your code You write your code you attach it to the event that you care about and you publish that to the cloud Every other aspect of that application how it scales how highly available it is the security of the operating system All of those aspects that frankly aren't that much fun to deal with get managed by the cloud provider for you in the reason that this is Appealing to a growing number of developers and teams is because it allows me to focus on Solving the problems that I want to solve and some of those other aspects that still need to be solved Maybe I'm okay. Not being the person who's managing that So for Azure Function specifically we have a few languages available today as we start talking about Azure Functions net node Which includes JavaScript and TypeScript Java? Python is in preview today, but I'm really excited. We're actually rolling out the general available update for Python in this next week So very shortly if you keep an eye on blogs Python will be generally available in a few short weeks and as well PowerShell as a language Azure Functions itself is completely open source So not included on this slide or some community contributed languages like go and rust And when we double click on Python specifically There's a few key points that I want to call out here and after this slide I'm actually going to work through and we're going to build a Python Azure Function together So you can actually see the experience a few things the first Azure Functions is entirely open sourced You can see all of the code for every tool the runtime the Python All of that is on GitHub and we love contributions from the community. So feel free to get involved One of the awesome things about Azure Functions though is that the rich development experience that you get and specifically with tools like visual studio code So we're going to spend our time in visual studio code today and it gives you things like local debugging Rich IntelliSense easy published to the cloud now. You don't have to use visual studio code You can use pie charm. You can use sublime You can use any editor you really want the tools work across all editors, but we have a first-class integration with VS code You can trigger your code and you can say hey, I want this Python script to run on a number of different event sources It's going to scale Automatically for you and if your code is never executed if your code never triggers you never pay any money And even when it does trigger you get like a million executions free every single month So very often even when your code does run, you're still not paying us anything. So it's great You get some rich monitoring capabilities and you can also set up some rich CICD whether using Travis Azure DevOps or any CICD tool Jenkins you name it So let's go through now that we kind of have an understanding of what serverless is Azure functions in Python and we want to build something and what I want to build is a simple function a simple API They can analyze the sentiment of some text, right a very hello world kind of example And it's going to allow us to walk us through this experience in the tools So I mentioned we're going to spend most of our time in visual studio code So that's where I'm at now kind of an empty editor. I'll call out a few things There's a few extensions in visual studio code that I'm going to be using to make our life even better The first is this Azure functions extension, which gives us some nice Azure functions tooling The other one here is the Python extension, which is going to give us some nice language options I've got a lot of extensions. So I took me a while to get to the piece Python Obviously all of these with visual studio code are all free and easy to install But if you want to follow along at home, that's what you would need to do So now that I have the Azure functions extension I can go ahead and click in here to the Azure icon and say alright Let's create a new function So I'm going to create a brand new project We'll get a folder for it Let's call this one Euro Python And the first thing it wants to know is what language I want to write this function in Obviously, we want to do Python because we believe in the one true language of Python And I have all of these different event sources. I could make this run every five minutes I could make it run every Friday at 10 a.m. I Could have it trigger on an HTTP request Whenever an image gets uploaded to an Azure storage account or a message gets dropped into queue some data changes in a database You get the idea. There's a lot of different event sources that can say hey go run this script Now I mentioned we want to write an API for sentiment. So we're going to choose the HTTP trigger We're going to call this analyze sentiment. It's going to be the name of our function. I Could require that there's a key and some authentication to invoke this function in this case I'm just going to keep it anonymous and We'll open it in the current window So now the Azure functions extension in visual studio code is going and scaffolding for me this function project And it's gone ahead and open for me now kind of the base template for an HTTP triggered Azure function So this is all the code that exists in my project There's some metadata here that tells it what trigger it uses I also have my requirements dot txt file, which is empty right now But this is the only code that's actually in my whole project. It's very very lightweight It looks almost just like a simple script or a console application But instead of getting passed in like some arguments some string arguments from the command line I actually am getting an HTTP request. So when someone triggers this function, it's going to be an HTTP request And I can now use pieces of that request whether it's the body query parameters inside my code now The simple template is just a hello world function It's just going to look to see if you pass in a name is either a query parameter in the body of the message and Return back a nice and friendly hello, whatever your name was Now what I want to show quickly here before we start analyzing sentiment is again One of the nice things with Azure function is all of the tooling. So I'm going to go ahead here and set a break point And let's go ahead and say we want to start debugging And this is going to go ahead and start a debug session here in visual studio code I didn't have to do a whole lot to do that. I always want to show this flashy ascii art Right now on my Macbook. This could be Windows. It could be Linux. I'm running that open sourced Azure functions runtime So this is the same runtime that will be executing in the cloud But in this case, it's actually running on my machine It's noticed I have this HTTP triggered function and it's even given us this nice local endpoint that I can use to test So let's test it out now. Let's go ahead and send a request to this function So I'm going to go ahead here. I have another very cool visual studio extension That actually lets me send HTTP requests when I just annotate them with this cool Annotation so I'm going to say do a post to that URL and we want the content type to be JSON and Now this awesome visual studio code extension called rest client will let me send the request right here in the editor So I'm going to go ahead and send that request and as soon as I click the send button my breakpoint was hit I'm now debugging this function as I step through it I can see that I got my name property in this case. I left my name is Azure my name is actually Jeff But that's fine. You can call me Azure And when I finish the debug session I get back my response that says hello, Azure So that's kind of the basic experience creating the function debugging it the last step that I would do here is publishing But before we get there, let's actually add in some more complex code I want to do that sentiment analysis like I mentioned and I'm actually going to use a Dependency here that maybe some of you have used before called text blob Which gives me a bunch of machine learning capabilities to analyze text pull out the key phrases pull out the nouns pull out the sentiment and I'm going to replace this kind of basic hello world code and I'm going to faster than you could have believed type in because I didn't type it in type in this code to use text blob To look at the text and pull out the sentiment polarity Now you'll see this in a second But what it's actually going to return back is a number that number is going to be between negative one and one The closer to positive one is the more positive the sentiment the closer to negative one the more negative the sentiment Let's go ahead here. I make sure I'm importing the right stuff as well again using my amazing typing skills So at this point I pretty much have everything I need I could actually run this right now in debug And when I go ahead and run it I could show you now if I say debug again The first thing it's going to do is it's going to go ahead and pull in that text blob Dependency and use it to run for me. So if we now change this It's now running the same thing. It's now analyzing sentiment. I'll go ahead and change this. I'm not passing in a name anymore I'm type passing in text. I'm going to say I am so so happy Go ahead and save that and click send. Oh, I left my break point hanging around. That's okay And you'll see here now I get a sentiment of point eight, right? This was very happy I could even quickly come in and make this one change to I am so so sad and now it's negative point five So my code's working now. I have a simple Python script It's going to get an HTTP request and it's going to tell me the sentiment of whatever the text I passed in Now the one thing I want to call out when I use this library this text blob file locally How it's actually working is that it installed on my machine. I'll show you this at the home directory As part of the what is it nLTK library? There's these nLTK data models that right now are at my home directory that you can kind of see here When I publish this function, it's very important that my function has access to these same models, right? These are the models that my Python function needs So in order to do that I just need to make sure that I actually copy these models into my project directory, right? so now I'm here in the project directory Euro Python and I'm just going to copy the models nLTK data Into the current project. So now those models are available there and I just need to add one more line. Oh Did my super fast typing not work that time it did and this line is just saying hey nLTK You can actually find the models in the current directory. Don't go look at the home directory, right? So just a pattern that's worth noting if you're using things like models in your function You can just include those models in your project directory column directly then And now when I publish which is the last step It's going to take this entire directory the Python script the models It's going to look at the requirements.txt file and it's going to put them in a zip send them to Azure Now one of the new features that we actually are just rolling out now, which I'm going to show you is that when I choose to publish this I actually don't need this flag anymore Text blob requires some native dependencies It requires that I have native Linux dependencies when it runs on Linux when it runs on max It's different when it runs on Windows. It's different still and rather than making you deal with the complexity of knowing Oh shoot. I just built this on my windows or Mac. It's going to be running in a Linux container in the cloud How do I get the right versions? One of the features that we have now is that when I go ahead and click publish And when I say now I mean rolling out in the next week or two now for me because I'm running these bits now What it should do at first. Oh, actually, I need to make sure I've authenticated with my account I realize I haven't done this yet Entari's demo this one will work what it's going to do is it's going to Look at this function that I have realized that it's a Linux Python function It's going to archive the directory like I mentioned But the cool new feature I wanted to call out is that it's actually going to go pull down and do a remote build of Any requirements that I've defined in my requirements dot txt file So it's actually going to use the Linux environment in the cloud to pull in the text blob dependency Do all the building there? You can see it's doing the server side build right now It's uploading my files all this is done for me. So regardless if I'm developing on Windows Mac or Linux I'm confident knowing that my apps going to run successfully in the cloud using this new server side build tools as part of the Azure functions Experience now once that's done, and we don't even have to wait for it fully It's going to give me back a URL that then anybody could call. It's not a local host URL anymore It's going to be a dot azure websites net URL that anyone could then call Passing some text and it's going to give you back a score So it's that easy to kind of get up and running Include dependencies that you need include models that you need and then finally publishing it to the cloud In this case I use the command line because I wanted to show off that new functionality I could have also done the publish directly from right here in visual studio code So once this is there in the cloud I actually have one that I published ahead of time because I figured that it would take a little bit to do the Publishing and build on the internet connection here, but I do have one. It's a dot azure websites net URL and if I go ahead here now and just click the send request button It's going to send the same text off to in this case now this cloud hosted function And now running in the cloud that same Python code is now available to anyone. Okay now to kind of bring this home I want to show you, you know, hopefully you've seen this is a very productive development experience I can quickly get something like a Python script attached to an HTTP request and running One of the other benefits here is the scale the fact that now if everyone in this room tried to call the same API If everyone in this whole city tried to call the same API I want to know that it's going to scale and be available to everyone So to prove this and for the last five minutes, we're going to attach this to some data So I'm going to take that same function that I just wrote the analysis sentiment What I actually want to do is I want to populate this real-time dashboard. So this dashboard is empty right now It's very lonely. This is a product called Microsoft power bi and what I actually want to attach it to is I want this to tell me everyone in the world who's tweeting And I want to know the sentiment of those tweets and where they're tweeting from and the thing that's going to drive Understanding the sentiment is going to be calling that Azure function. We just published Now to attach it to some data I'm going to use another serverless piece of technology in Azure called Azure logic apps Now logic apps is a little bit different than Azure functions because in this case, I don't actually create code With logic apps, it's serverless in the same ways that it scales to zero or scales to n But here I actually create workflows and I can integrate with different services So I want to connect my Azure function to Twitter Just to show you some of how Azure logic apps works There's actually over 200 out of the box connectors here that you can use in your serverless applications in Azure To connect to services like Twitter. I'm scrolling down. You probably recognize these other ones Hey, when someone uploads something to Dropbox when someone adds something to github sales force SAP on-premises Dynamics 365 one drive Google Drive send grid you get the idea, right? There's a bunch of services here This is all function code that I don't have to write Because when I want to integrate with Twitter, I can just say hey Let me integrate with Twitter in this case. I want to trigger this whenever a new tweet is posted and I want to listen for a trending topic I look today Euro Python is trending locally But there are a bunch of tweets globally around spider-man because the new spider-man movies been coming out So I could now trigger whenever someone tweets about spider-man check Twitter every 30 seconds. That's fine And now start to call things like my Azure functions and say hey, here's that Azure functions I just wrote the Euro Python one and I want you to go ahead and analyze the sentiment of that tweet Okay, now for the sake of time, I'm not gonna go build this whole thing from scratch And wait for you to watch me fill out the designer Hopefully you get the idea of how a logic app works So actually I have a previous version from late last night where I actually built this entire workflow It's only four steps nothing too crazy Right, so I do the same trigger trigger on spider-man The first thing I'm gonna do is I'm gonna analyze the sentiment You'll see here I'm looking at the tweet text as the text that I'm passing into that Azure function. We just published I'm gonna go then categorize this I have another Azure function that pretty much just gives it a color if it's positive green if it's neutral yellow if it's negative red and Then the last one is I'm going to publish these all to that real-time dashboard that I showed you a second ago So now let's actually watch these functions scale as soon as I click save here And we'll actually click run so we can watch it debug This logic apps now going to start listening to Twitter and hopefully somebody in the world right now is tweeting about spider-man And if not someone in the audience could but I suspect they will I picked spider-man specifically because it's been noisy And you can see here's an example of one that just got executed But I guarantee that there's hundreds more that are firing right now while I'm talking You can see now that someone tweeted Far from home spoilers. Whoa. I'm not going to read the rest of that tweet Apparently there are spoilers in this tweet, but the sentiment of the tweet I can see it called my function It got back a score of point one and so forth So kind of the grand finale and crossing our fingers that this all works This is where the suspense comes in we should now see this power BI dashboard Hopefully I don't have to click refresh here. Oh man. This is the grand finale. This is the part that really has to work We should see this dashboard here. Okay, it's lit up. I just had to click refresh So now this is filling up with data And you can see here There's been a few tweets that have come in not very many not as many as when I ran this last night It's a little bit earlier in the US right now where a lot of those tweets were coming from But at least these five tweets have triggered. I can see the sentiment. They didn't provide a location They're all yellow with the green circle. That's super intuitive But if I leave these on or if I keep refreshing you would be able to see this dashboard just comes to life So if hundreds of people started tweeting, there's a few more. I see some from Europe. There might even be people in this room Thank you for your participation if you did Oh Not that location though. This isn't streamed, right? But that gives you the idea So so the thing here I was I was hoping this would have been a noisier Twitter topic But the idea here is that if thousands of people were tweeting that simple function that 20 line function that we wrote Just a few seconds ago can just automatically scale and be available to all of those requests as they come in That's really where Azure functions comes in. I didn't have to think about that. You didn't see me SSH into any servers You didn't have me configure any knobs of scale settings. I don't have to I just say here's my code Here's the event. I want you to trigger on and then let it go to work All right, so for next steps for the last five minutes. There's a few things here I'd encourage all of you to go give Azure functions a try The probably the best place to start is our quick start. This is entirely using the command line tools So it does work with VS code like I did But if you're using pie charm if you're using sublime if you're using whatever other editor the same quick start will work Just great for you and you can get up and running and just run this all locally even without an Azure account If you do want an Azure account, I didn't have a link here if you go to Azure comm slash free You can get a massive free credit. I think it's like 200 euros To get started with Azure though Azure functions is pretty much free for most everyone because of the million executions a month You get for free. We also have a video that walks through building an app similar to this one just a different scenario One of the things I wanted to mention is there's serverless library net This is a website that has a bunch of samples of different functions that people have written So if I come here and I say hey, I want to look at Python samples these come from customers These come from developers on our team. You can see here. They're stuff with like a Python one that does some serverless IOT I know there's some here about data cleaning someone one of our customers built a data cleaning pipeline using ML and Python I could click in here edit it directly in Visual Studio code or browse to the code on GitHub to give me some samples As I get started and learning about what I can do with functions if you're interested in the code I used with text blob I posted that on my own GitHub account and then finally if you haven't stopped by the Microsoft booth already Please stop by we've got awesome socks. We have many members from both the Azure functions team the visual studio code team Jupiter notebooks were more than happy to help you come talk to us get some swag get some of those socks and stickers And if you're interested specifically on Azure functions and serverless We have a Twitter handle on the Azure functions account as well as my own personal one So hopefully you've understood and this gives you an idea of what Azure functions are how easy they are for you to get Started with and how you could start to take advantage of not having to worry about all those complex pieces of hosting an application And just get started with the code that you want all using a fully open tool set in Azure functions So thank you all very much. It's been awesome being with you all here today Thank you Jeff And great talk so any questions we have some time please come to the microphones Thanks Jeff quick question if I wanted to docker eyes a number of small flask apps and bang them up on Functions, so I don't have to worry about them. Can I do that now? Is it viable for production? Yes, so I actually was debating whether I was going to show this or not as I looked in that If I heard you right you want to docker eyes the functions correctly, so one of the benefits about Azure functions being open source and our kind of Engagement with the open source community is have actually just come back into this existing project I'm not going to change anything. This is the one we wrote from scratch But I'm just going to write this command to initialize a docker file now automatically without me even having to do the work This tool looked at the project and it's actually generated for me here a valid docker file That will run Python functions in any environment that I want to run them in now I could even publish these containers to Azure and have them run because sometimes I might want to say like hey I actually want to customize the environment. I want to install Whatever some package that might not be included in our image you can do that here and publish it But the other one that we're seeing increasing interest in is that I could docker eyes this and run it maybe on premises In fact recently we've announced a project in partnership with red hat called Kata Which will give you serverless scaling serverless event-driven scaling for containers running in kubernetes And Kata works natively with Azure functions and containers just like this one So if I wanted to run functions in a container Maybe as part of a kubernetes microservices in the cloud or on premises maybe an open shift Using a combination of this docker file and things like Kata I can get the same serverless scale experience in a production ready way right now So definitely something that that we've provided actually first-class tooling support for those docker scenarios and in something with we hope many of you Take advantage of so great question All right, I think we have time for one more. Yeah, yeah Thanks for the demo. I was wondering why is my uber only allowed to rise for 10 minutes Yes, you get kicked out of your uber after 10 minutes in the function world Yes, so Azure functions. We have a few pricing models. The first one is the consumption one That's what is published you by default. It scales to zero. It can scale up to whatever and there is a 10-minute execution limit That's there mostly because of how the consumption plan works for recycling machines very often That's as much as we can kind of guarantee without us worrying that we're gonna reboot it that said though We actually do have an option which is getting Python support actually next week called the premium plan And the premium plan has the same serverless scale It's a little bit more expensive as the name would make you believe it's premium But one of the features you get from it is you can actually have unbound Unbounded I was making my hands very big unbounded Executions so you could have executions that last for six hours eight hours in the premium plan is the only place where we're not going to Guarantee we're gonna recycle these VMs super often So that's the model today though. It's a common request So feel free to keep giving us feedback as well, but it is an option. You just have to choose a different hosting plan Great Okay, so I think that's all the time I want to make sure that there's time for the next speaker to come up because there's an awesome keynote I believe about public speaking so a very good topic as well. So with that, thank you all again very much. It's been awesome


Welcome to the show. It's time for another episode of JP's product pick of the week. I'm John Park here for Adafruit Industries and I'm excited about today's pick and I hope you will be too. So the first thing I want to do is actually send you to the website where you will find our product pick and if you head over there not only will you find the product of the week but you'll also find this here very video displayed down at the bottom of it. The reason I'm sending you there to that QR code or to that URL is so that you can take advantage of a big snorting 50% off discount on this week's product pick. So head on over there if you like but before I say anymore what I want to do is ask our own Lady Aida to tell us about this week's product pick so take it away Lady Aida. The KB2040. Yay it's a new RP2040 based board. It looks a lot like the itsy bitsy but it has a totally different pinout. This pinout is Pro Micro compatible and this is specifically because ever since we made the keyboard library support in Circuit Python and HID support for the RP2040 folks have been like I really want to use this for a keyboard build and like pretty much every keyboard kit we know of uses the Pro Micro as like the standard footprint and you would solder in a Pro Micro board but in this case you can solder in this board instead of a Pro Micro and you get a much much more powerful chip compared to like the at mega 32U4 which has 32K of flash and I think 2K of RAM, 2.5K of RAM. This has 256K of RAM so like 128 times as much and it has massive 8 megabytes of flash. You can use it as a file system or for storing code. It's still got a ton of pins available. It's got four analog pins and it's three volt logic as so it's compatible with you know almost every keyboard. There's also an onboard Neopixel. There's two buttons one for boot and reset because you'll use that to load code onto it. It's got a 500 milliamp 3.3 volt regulator. It's got the raw output and on the bottom of the board there's a jumper so if you want to drive a lot of Neopixels and there's an onboard fuse just like the Pro Micro for 500 milliamps or so. If you need a lot more current just shorten the jumper on the bottom of the board and that will connect the USB 5 volt directly to raw so you can get up to two amps from your USB power supply or USB port although one amp is kind of as much as I recommend. You can get two but you know one is usually recommended. There's a Type-C USB connection and then for the two little spots at the top of the board that are not used on the Pro Micro I brought out the D plus and D minus pins. This is a little non-standard but I figured there's people who want to maybe use a different USB cable or connector and it's usually hard to get to the data pins for USB so this is like an easy way to to get to them if you want to add a different you know panel mount USB connection and then let's see there's a little Neopixel on board. USB-C Stevin connector. Oh so the Stevin connector is interesting so you know if you go back there's a standard pin out which has you know starting with TX and RX which are digital IO so there's you know 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 so it's 10 on one side 11, 12, 13, 14, 15, 16, 17, 18 so there's 18 GPIO pins. The analog pins can be GPIO that your RX and TX pins are GPIO the SPI pins are GPIO but for some 65% keyboard kits or you know if you just need those sometimes are 5 by 15 layouts and then you know maybe you need more than 18 pins maybe you want 100 keyboard kit and so you need two more GPIOs so that Stemacutee port actually gives you two more GPIO pins without changing the footprint of the board so you get 20 total so if you need 5 by 15 you can get it and you don't have to desolder or rework anything just grab a Stemacutee cable plug it in and then use the yellow and blue wires as two more GPIO pins. As of this video there is not QMK support however there is a poor quest where people are working on QMK support and I'm almost positive that it'll it'll eventually get ported over until then you can use KMK or you can use circuit python we have really good key matrix scanning support like natively built in it does all your key scanning for you in the background and just give you key events presses and releases so you can just like skip all that part of your code and just go straight to the keyboard design that you want to do. Alright well I'm sold let's check it out I'm gonna pop this camera down here to my little mystery box where we will open up the product pick of the week and there it is ladies and gentlemen the KB2040 also known affectionately as the keyboard uh it comes with a couple of header pins there put the box away and let's talk about this yeah that's right that's the product pick of the week it's the KB2040 keyboard so this is like Lady Ada said a pro micro compatible board so here's a typical uh sort of clone pro micro that I have here so you'll see the same size same basic pin out like Lady Ada said we do have a couple of extra pins here for the data USB so that you can hook up a little wired panel mount for your USB depending on the keyboard build sometimes that's really helpful but otherwise this is the board you've been looking for if you've been wanting to do custom keyboard kits and for example here's one that I haven't built yet that I just got from key hive this is a key sort of a numpad or macro pad kit has this great dog stencil art there and there's the slot for what's usually slot for the pro micro but the KB2040 fits right on there and uh this is a typical sort of diode matrix based board a lot of these kits are so you solder in a bunch of diodes for the columns and rows and then you solder in the the keys of your choice this one you snap apart and use some some hardware in order to make a little sort of sandwiched case so uh let's we'll get to that I'll get to some demos in a second but first let's uh let's take a look at um well we've got our lovely keyboard's animation there with that cute little key cap nose clicking up and down which I love and if we head over to the webpage here you can see it's 50 off so today it's four dollars 48 cents which is terrific terrific price and if you scroll down in here you'll see that there's some info about the board there are some links here which will take you to here it says same sizes form factor as the pro micro which if you take a look at that that's this spark fun board right here pro micro which uses the atmel 32 u4 and that was really the chip that broke usb stuff wide open on on a small form factor microcontroller that ran arduino uh so this is sort of a next generation of that idea uh and if you click through to the main guide and some projects here you'll see here's the main guide including pinout information downloads if we take a look in uh the learn guides for projects this is one that avid did on again another kit this one's called the navi 10 which is like your little friend from zelda navi navi 10 macro pad and it's using the kb 2040 and k m k so k m k is a keyboard uh i don't know what to call it framework that sits on top of circuit python and it's quite straightforward to deal with the uh k m k side of things for stuff like mapping your keys as well as using some added functions like layers so as you build smaller and smaller keyboards you need more keys to do more things so this this notion of keys having multiple layers of meaning uh shows up and i'll i'll dive into an example of that in a second uh and here is some info on k m k on the github for k m k is the k m k firmware that i'm using and that ava put into that guide so from here you can find out what are your key uh key shortcuts or key key names that you can use uh as well as some of the little shortcuts for things like layers and mod tap and stuff like that so uh let's let's dive into some demos let me go to the overhead how about we'll use this one so i will pull into view here this is one kit that i've built oh we don't need that background there here we go uh so this is the navi 10 you can see here it's got the little diametrics uh on the back here i've got my kb 20 40 a lot of the time you will mount things in this orientation with with the guts uh pointed up towards the board that just happens to be how a lot of them are designed so the trickiest thing about this is having access still to your reset and boot buttons some some boards will bring that out i have one example i'll show you others you just need to use a set of tweezers or something to click those uh so this one here if you take a look at uh first of all let's take a look at functionality i've got it changing my key layers or my rather my cameras between a few presets in my broadcast software so that's dancing around uh and then these are acting as navigation so up down left right if you take a look in my uh code view here this is uh this is a simple example but the way this one works let me make sure you can see that there yeah there you go is this is the code.py file and uh this is the the main thing you'll care about here is this key mapping and that k and k link i showed will tell you what the keys are named for example to use numbers it's kc dot and then n and the number so i have four five six and one two and three here the uh missing because this is sort of a matrix with a missing piece is this xxx so nothing happens there uh there's no key there and then i have up down left and right listed on there uh if we take a look at a more interesting example i think this is one that i am excited about this is the gherkin uh so this is just the smallest of the smallest uh usable keyboards some people actually like to torture themselves and use tiny tiny tiny keyboards um if you take a look at that layout it's basically only alphabet keys and then in the center here we have a backspace and enter or rather a backspace a space enter and escape and the way that these layers work is we can actually i'm going to show you an example of this um hold down a key these four keys here i think i have set up so that when they're held they actually act as a layer function and now all of these other keys have new meaning it's kind of bonkers uh but the practical demo that i that i realized last night and then lady ate a texted me the the exact same idea which is this is now the world's ultimate wordle uh keyboard if you know the game wordle uh all we need is alphabetical so i won't type any answers in here because i don't want to ruin this is today's game uh but i'll show you that this is just uh working keyboard i can even try to press enter and it'll say that's not in the word list because that's not a not a word and i'll delete here and i won't spoil it by showing much else um if i take a look at the code for this one let me plug this one into my uh hub here and i'll unplug that other one real quick because the code dot pi is sitting on here close this and reopen uh so for this keyboard we have some sort of special functions in there you can name on whatever you want this one is called function one space function two backspace function three c function four v so in this layered uh extension kc l t means that keys can have two meanings or more i think in this case uh it's a letter one if it's being modified or it's the space if it's unmodified and so that's how i'm able to then access all these different layers so this is the sort of normal alphanumeric but if i'm holding down the layer one which is this space one i'm holding that down then we're going to access the second layer so just as an example you can see it in here on a type uh so i'm typing in regular qwerty stuff uh now if i hold that shift these become numbers which is wild and my brain doesn't work that way so not too practical for me but uh i thought it was fascinating to dive into how the layers work it's actually a couple instances where i found it to be kind of neat uh i think this this uh c layer and a is your tab so you you get keys very very close without looking down uh it brings everything really really close 30 percent or 30 keys a little tiny for me but there you have it um and if we want to take a look again at how this is wired up uh this is this gherkin keyboard i'll show you where that comes from if you're interested this was a i believe an open source project and let me just pull this little bottom plate this one's made all of pcb if our four materials so we have a key plate on top to hold the keys steady you have the pcb itself other side of the pcb which you can't see now has all of the diodes on it as well as the keys are then soldered through uh and then we have our i'm hitting buttons here then we have our kb2040 and there are actually ways on this one to mount it in either direction i believe um and then this is where i added a little surface mount reset button right there to this board because it had it had it in the design so just to give give a little look into where these things come from i'm gonna move this out of the way a little bit there we go let me jump over to this is the 40 club 40 percent dot club is where this gherkin design first showed up in 2016 30 key keyboards so you can go there and have a look and there are versions that have leds and led support and so on uh the shop where i got these pcb's is not sponsored or anything but they did a great job getting them to me quickly so thank you very much as key hive key hive dot xyz and from there i got that navi kit or navi 10 kit the gherkin kit there so not bad $25 and then the cost of your kb2040 to drive it and some keys key switches keycaps and this is the the one with the dogs on it that i haven't built yet the maypad and i'm a big fan of real number pads so i may build that i've got one one that i've built before and so really nice that we can use either the circuit python on its own with our keypad library you can use kmk which gives you a lot of this added functionality of things like layers and you can run arduino on it right now there's not as far as i know still qmk support but that that when it gets finished for the rp2040 chip which surely it will because it's one of the only readily available and very powerful modern chips then you should be able to use qmk on the kb2040 as well so let's see i think maybe that covers it let me have a look in the chat see if there's any questions hey anthony becaro trying to decide if she'd get it and davo desis brings up its half price during the stream so a good time to good time to do it for sure and let's see good everything hey this is our discord by the way if you didn't if you didn't know who i'm often talking to it's the discord over here gary z mike p c grover hello paul cutler uh you have enough projects going on but i love my macro pattern would love to build a keyboard someday yeah for sure uh 65 percent or 60 percent is is sort of something i'm i'm looking forward to so if anyone has good recommendations for a project a keyboard project that uses a pro micro sized board that i could use the kb2040 on and gets the 65 percent i'd love to know that would be really cool so i think that's going to do it once again i'll remind you head on over to our page for the rp2040 to get it for half off you can get up to 10 of them that's the limit and i think they're still in stock so head on over there pick up one or a few and get to building and like i said you don't have to do any particular kmk type of stuff with this you can use this also as just a pro micro sized rp2040 board and particularly with circuit python on and it's a it's a pretty sweet board with with a lot of gpio on 20 gpio if you include that stem of qt port and also by the way i believe with some keyboard builds with support for oleds you may be able to do uh support over i squared c using that stem of qt port so having a little screen or other uh gizmo on your keyboard build uh that's that's a way you could add sliders rotary encoders things like that very easily to it without doing any soldering all right i think that's going to do it then for us today uh so that's the product pick of the week this week there it is it's the kb2040 keyboard board let's watch this cool animation again all right so i've got to put this thing up on the board and i had a little capacitor and some wire i was going to use as a hanger i'm improvising hangers these days there we go capacitor not necessary thanks everyone so much for stopping by i'm john park for adafruit industries this has been jp's product pick of the week and i will see you soon bye bye