Creating a Wireless Network with Raspberry Pi Pico W: AP Mode Walkthrough (Part 1)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] what's going on YouTube Welcome Back to the channel today is part one of a video series where I'm showing how to use the Raspberry Pi Pico W as a soft access point and this is also called AP mode now for those of you guys who are new using the raspberry pi pow this is maybe not something you've heard of but AP Mo AP mode is a configuration of a Raspberry Pi Pico W where you're essentially create its own Wi-Fi network similar to our routers that we have for the internet so this is something I found out recently I thought it was pretty cool because this can have really powerful implications in sharing information between devices without having access to the global internet so imagine you want to transfer information between devices or you want to host a web server without the the internet the actual internet that you use on your computer you can actually set up a Wi-Fi network on your Raspberry Pi Pico W very easily micro python to do this and you can have up to five devices connected to this wi-fi network and so we can create servers or web servers on the Raspberry Pi Pico W and connect to them so by the end of this video we will be able to connect with our phone or our laptop to a Wi-Fi server on our Raspberry Pi Pico W that's separate from the internet that you have from your house that you're using right now to watch this video and in part two what we'll eventually be doing is we'll be using this configuration to send information between different Raspberry Pi Pico W's across this wi-fi network without needing access to the global internet so it has pretty powerful implications and I thought it was pretty cool and I just learned about it I thought I'd walk you guys through it in this video so enough being said we're just going to jump into it straight into the micro python code to do this so the only thing you need is to plug your Raspberry Pi Pico W into your computer you don't even need a Wi-Fi fight through this so you just have to plug this into your computer and we will jump into the micro python environments okay so jumping into the micro python code I'm just using thoni to code a micropython but really you can use any environment you want whether that is pycharm vs code and so on so the first step we have here is we want to set up our Imports for Network time and sockets and we wanted to find the web page I just have this web page function that shows me the the web page HTML here so you can write whatever you want for the web page there's just a very simple web page where we would do the stereotypical hello world and we're just showing the user hello world and so we're going to return that in HTML so if this all works in the end we should be able to visit a web page on the the base URL of the of the server and we should be able to see Hello World okay now next thing we have here is we Define AP mode which is the the majority of the the code we want to focus on here and in this AP mode what we're passing into this function is a a name and a password so SSID would be the name of the internet you want to establish so this can be any name you want because you're creating this wi-fi network from scratch essentially so I'm just putting the name as name and password as password so I'm very creative as you could see and that'll be the name and password of our Wi-Fi network on our Raspberry Pi Pico W but you really you could do whatever you want and you can even add layers of security so that would be considered an insecure network but later on once you get into more advanced stuff you can add security to that work and so on if you really enjoy using AP mode so in order to activate AP mode it's very simple as well we'll just use the network library that we imported Dot wlm and we do network.apif and we set up the config based on the the password and the name of the the intranets or the Wi-Fi that we defined and then we activate it with uh that active true and then we have this little Loop here just in case there's a pause we study while AP active equals false we just wait so if you have some weird issue that might Loop forever so that you may notice that but I haven't noticed that yet and next thing we do is we print this and we print the IP address of our router there so we could see that that should be the first one based on what the pattern I've seen is AP dot ifconfig0 that'll give us the IP address so we can connect to that from our computer or phone and finally we just do a simple client socket set up here so I'm not going to get into that too much because there's a bunch of videos on YouTube of setting up client server sockets and micro python with Raspberry Pi Pico W but pretty much what this client server socket allows us to do is allows us to get information from the web server so it's gonna get a request and it's going to send a response as a web page and that web page is the HTML we defined and then also another thing here is we're only listening to five items because we're only allowed five Connections in AP mode that is that is the maximum for the Raspberry Pi PW so you're only allowed five devices to connect to the Raspberry Pi Pico W and AP mode and finally once we run this it's just going to start running the Wi-Fi and we're going to connect to that new Wi-Fi network so let's go ahead and run this hopefully no issues from the beginning let's give that a sec okay so it says my IP address is there so now what I'm going to do is I'm going to go up here and I'm going to look for the the Wi-Fi network so as you can see actually it can't find actually can it find it a name unless I'm blind here okay there it is name so I notice in some cases at least for the first time I was doing this it couldn't find my Wi-Fi network and I was wondering why maybe there's something wrong with my Raspberry Pi Pico W but I did a power cycle to my Raspberry Pi Pico W and for those of you guys who don't know what a power cycle is it's turning off and on your Raspberry Pi Pico W but when you do it you want to make sure you turn off for at least 10 seconds to allow all the electronics to reset and that's technically what a power cycle is so if you just plug in and out that's not really a power cycle so if you don't see the Wi-Fi network and your code is running you may want to power cycle your Raspberry Pi Pico W and that worked for me the first time so we found a name here and so I'm just going to type in the passwords it jump to my other screen so I'm just going to type password so you know just type in your password as you would any other internet maybe internet is the wrong term here because internet is the global internet we should say Wi-Fi and so give it a moment to connect there we can see we're connected to name now next thing I'm going to do is I'm just going to open a a browser here give me a sec working on multiple screens so I'm just going to open a browser right here and we're just going to connect to this and it should say hello world so it's not https protocol I believe it's just HTTP protocol and it is so I connected it before as you can see and so we should get hello world so that is the very basics of how we can use AP mode to access the taxes information on the Raspberry Pi Pico W without any internet connection from your Wi-Fi in your house so as I mentioned at the beginning this video that does have great implications to what you can do in terms of sending information without actual Wi-Fi and you can use other picows to send information between them which we'll get to in the part two of the next tutorial in this video series so I just want to say if you did enjoy the video be sure to like comment subscribe and I also have a donate link down below so if you really like the video you can donate to the channel That would be awesome let me let me know what you want to see in the comment section as always guys stay tuned and thanks for watching take it easy [Music] thank you
Info
Channel: Shilleh
Views: 15,379
Rating: undefined out of 5
Keywords: ap mode raspberry pi pico w, raspberry pi pico w ap mode, ap mode, wifi access point, soft access point, raspberry pi pico w micropython tutorial, raspberry pi pico w wifi access point, wifi access point raspberry pi pico w, micropython, thonny, wireless network raspberry pi pico w micropython
Id: cZNoXXIEPbg
Channel Id: undefined
Length: 7min 44sec (464 seconds)
Published: Fri Jul 14 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.