Let's Get Started with the PICO W

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Guten Morgen for today's video we're going to do a quick introduction to the Pico W and connecting it to Wi-Fi your internal Wi-Fi network now the Pico's been out Pico W's been out for I believe over a year now probably a little longer so most people have already done it and all that so I'm not going to go into a lot of detail on this the purpose of this particular video has to do with getting you familiar with it but then introducing you to a framework that I ran across that I want to utilize in probably a number of upcoming projects and it was an example program created by the good folks over at core Electronics so that is where the source code that I'm using here today came from I don't really want to and nor do I probably have the time to go into great detail or to learn all about Wi-Fi Communications even within the micro python environment here on the Pico w rather I want to spend more of my time and energy on developing applications utilizing that capability so I'm not going to go into all the detail of how this whole process works with wi-fi Communications furthermore it's truly above my uh my my knowledge capacity we'll call it networking has always been a mystery to me I can do the basics get my computers and so forth hooked up to the network in the internet like most people I can manage somewhat manage my network here but nonetheless it's it's something I really have no desire to get into in detail and I just want to utilize those tools with the least amount of time invested in them so we're going to start out by going to the Raspberry Pi website and we're going to get our uf2 file which recently just changed so let's take a quick look here we are in the Raspberry Pi website I'm going to go to hardware we're going to look at where did they go right here the Raspberry Pi section and I'm going to avoid all the propaganda down here um although there might be something okay you'll notice here that they're talking about uh uh Wi-Fi and Bluetooth that was just announced I believe within the last week or so uh we'll be exploring uh Bluetooth at a much later time but for right now we're focusing on uh just the Wi-Fi stuff but for me the the fast start is to go to the get started micro python and then as I recall it was right here this is where we want to download our uf2 files now we have Raspberry Pi Pico no Wi-fi Raspberry Pi with Wi-Fi Raspberry Pi Pico with Wi-Fi and Bluetooth LE support um now you might think well heck I'll just download Wi-Fi in the Bluetooth and that's perfectly fine and that would work for what we're doing uh in most cases but remember you're also loading in Bluetooth code and on microcontrollers we are limited on memory so we don't want to be wasting it unnecessarily which I often do in many of my examples but let's take a look or I'm going to take a look at downloading the Raspberry Pi Pico W uf2 file I'll download that and then I'm going to install that onto the Pico W that I've got set up here on the bench like all picots when we plug them in the first time we'll get a pop-up on our screen on our computer screen that's telling us uh pretty much that so far it's not ready to use and what we all we really need to do is copy one of our Wi-Fi file or I'm sorry one of our uf2 files onto this area here and then let it do its thing so I'm going to just select uh I've got mine uf2 files stored on my desktop here in a folder and I've got them sorted out to help me keep track of what's what uh pie meroni I use a lot of their products as you've seen in videos then the uf2 for Wi-Fi you have two for Wi-Fi Wi-Fi Bluetooth and then regular uh Picos so we'll use Wi-Fi and the lowest one here is uh apparently the newest one version 1.2 we've got a 1.19 1-6 1-7 of course they're marked unstable that always is a real sign of confidence everything is so is good with it um so I'm going to just take this drag it over to here let it do its copy thing and we'll be ready to roll in the normal uh Peak Raspberry Pi Pico environment through Thane in a second now we're into the Thani environment and I've had a lot of picots plugged into this and I'm up to com port 27 so if you use a variety like me it seems like every new Pico is going to get its own com port here I just select that first that'll load up the environment from the Pico what's currently in there is micro python version 1.20 it's for the Pico W uh with the RP 2040. you always kind of want to verify that if you're bouncing around between Pico W's and regular Raspberry Pi Picos I've got two programs that are on my hard drive on the physical computer over here and I I will be copying those in so I'll just highlight both of them and upload to and now they're inside the Pico very easy peasy I've got two programs here on the screen one has my password information visible so I created a copy called uh core button example video safe so I'm not showing you my my password and access to my servers and network here uh commentary at the top uh this is mostly right off of the file that I downloaded from coreelectronics.com.edu Guides Raspberry Pi Pico with create a simple hdp server uh and the point of this particular program that I like about it and I'll be showing you this in a minute over on a Raspberry Pi computer off to my right here it has graphic buttons and I really kind of wanted to utilize that as an interface for a number of projects coming up so I've sought this out I'm not real keen on HTML coding although I got a hunch if we play a lot with with these Wi-Fi Picos I'm going to have to learn or perhaps I should say maybe relearn a lot of the HTML codes uh so uh from there I think before we go into any understanding of any of this code down here I just want to take you over to uh the Raspberry Pi and show you how this website's going to look so that you have a reference as we're discussing it now anytime you initially start up a new Pico W and put it on your network it does take a few tries it seems like to get everybody uh communicating and so forth so over here on the on the Raspberry Pi that I'm viewing this with I usually open up the command window and put in a ping command and that just runs continuously and that helps me to figure out and monitor real quickly if I'm actually connected or not because even over here looking at the Pico it may think it's connected to something but in reality it may not be accessible on the network but looking at the Chromium browser here we can see that I've typed in the IP address for this particular Pico W and hit enter and it loaded up this web page and as you can see it's very clean kind of attractive looking uh I think it'll work great as a base or a framework for any of the upcoming videos that I have planned right now uh but it gives us a header up here a couple of buttons that we can communicate to uh the Pico when I click this you'll notice this line down here changes and it gives us feedback so when we make Command here that goes to the Pico the picot does something and can provide a response showing that updated action so as simple as this example is to me this is an outstanding framework for a lot of what I want to do without having to try and reinvent the wheel for HTML code to create that particular look and feel as well as giving me the ability to communicate with the Pico and have the Pico provide information back to me here on them on the Raspberry Pi it's very Pi Pico we'll take a look at the source code for this example most of it I really am not concerned about I'm going to treat it as a a magic box so to speak it does what I need and I don't need to know what it's doing as long as it works kind of like how we treat all the libraries that we import we import time I don't need to know how time works as long as it does what I want same thing with network socket and even the machine library then of course many of the other more complex ones or a higher complexity ones that we utilize as well over here in the code um obviously you'll see an LED that's just to let me know uh we're using that as a a flag here on the device to show connected or not connected uh at this point in the code it may not even be activated anymore I use using that for testing here is where you would actually uncomment it and put in your actual SSID for your network and your password for your network and that's what would go in between these two single quotes here how we're establishing a few objects to deal with uh the WLAN wireless LAN Etc passing it in our credentials this section of code here uh I'm going to go a little further here is actually what's showing the web page this code which is kind of one big long thing tied into just this HTML variable here all this defines the web page so it it's rather interesting how this works and it took me a while to wrap my head around it but once they started playing with it uh it turned out it's pretty cool definitely not what you see is what you get you actually gotta put the code in and treat it at the more fundamental level rather than uh as I recall back in my days of web development when I had uh what you see is what you get uh editor uh yeah you're gonna do a real coding here in in uh not just drawing the picture on the screen and it generates the code for you although I think there's utilities that can help with help us with that too but this is the thing that uh we'll be putting a lot more attention into with specific applications uh in future projects so that just gets defined there then their code is going to wait for a connector fail and uh it has uh I think 10 10 times through this Loop to see if it's going to connect uh Etc and then if you get an error uh it'll break out of there or just finish give you a a warning or an update that you're connected uh getting into the sockets which are all a component of um establishing I'm going to call it a a link to communicate or maybe a pathway is a better way to put it uh kind of a tough one for me to Define with the little that I know of of networking but this line right here is the one that we'll see down here that says uh let me go up a bit okay connected IP equals this is how we know which IP address to Ping for me on the pi over there and which IP address to put in uh to our web browser to see this content this right here you saw on the the URL line for the Chromium browser on the pi and then it says it's listening on this port number 80 for incoming information uh then uh this is saying who it connected from uh the client being the Raspberry Pi in this case uh here's our request stuff and then from there it published the web page and then continuously publishing and updating as we're interacting with it uh so that actually does a lot of work and gets all this data and the connection all prepared uh from here we go into an endless loop where we're going to continuously try to get data and accept it from a client and then it's going to say client connected from uh and then there's the request meaning it's requesting a web page be served and this right here has to do uh with setting our our states on and off for the LED boxes on the buttons over there on the Raspberry Pi Pico showing the web page that's being presented uh then these few lines of code here it's saying the information here post to the Shell below which shows up down here which is what we're seeing right here this is some logic relating to what we do with the information that came from the Raspberry Pi's web page this would be how we handle the logic of that so he's sending a command over here I'm getting the command here in code and this is where I would do something with it uh so for example if we were turning on the LED now I would turn on the LED just as I am right there uh this information here will post the information to the web page because we've made a change or a request that causes a change and then we're going to update the website in return for that action and that's what this information is here and if we look on the web page you'll see this same wording down below this create this little code segment here creates that response and sends it here we're doing additional formatting of it and then putting it into the format or adding in the whole web page and then the variable data here we're going to send it with this very interesting line send the response and then we'll close out the the communication and then finally down here at the end of this Loop is a series of lines that just simply close out uh for an exception of an OS error Etc um and then it tells us that it closed with connection closed so with with that I'm hoping you understand I'm not trying to explain all this to you but just show you that there's a pre-existing framework and probably many of them out there and rather than struggle through it uh which for me Isn't I don't want to spend time on that I want to spend time on my application so in my position and how I'll be communicating with you folks on these upcoming projects is this area of code right here which defines and creates the web page and then right down in here where we get data from that web page and do something with it so with that I'm going to wrap up this particular video and uh in the coming weeks and months we're going to be looking more and more at using Wi-Fi and uh hopefully everything is going to come together the way I want to with regard to a larger project I'm working on uh that'll start showing up here uh probably this fall right now my normal work schedule succeedingly uh busy uh so it might get pushed out a little further but once we get into that it's going to be a lot of fun and this will be a very key element of it where we're going to need to be able to communicate via Wi-Fi from the Pico into another computer so that'll do it uh if you've got time between now and and the next upcoming video where I'm going to be where I'm going to be um putting Wi-Fi activated on our temp and humidity Data Logger and showing you how to access the data there and then we're also going to use that to set the date and time on the temperature and humidity sensor so we can Power It Up and communicate into it the current date current time so that way your Data Logger is recording information with a date and time stamp with that data uh so that again that that'll wrap up this video I'm going to keep going on and I'm all excited about this and uh look forward to seeing you in the next videos coming up real soon thanks for watching
Info
Channel: Making Stuff with Chris DeHut
Views: 1,388
Rating: undefined out of 5
Keywords: Raspberry Pi Pico, RP Pico, Microcontroller, Electronics, Electronic components, Python, Micro Python, Interface, Real world computing, Maker, Making, Chris DeHut
Id: OoL4ESJeNew
Channel Id: undefined
Length: 19min 39sec (1179 seconds)
Published: Thu Jul 06 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.