Raspberry Pi Pico W LESSON 28: Connecting the Raspberry Pi Pico W to WiFi
Вставка
- Опубліковано 27 сер 2024
- This is the OLED display we will be using in future lessons. Please go ahead and order it so you will have it for next week's lesson:
amzn.to/3nq8l4Z
You guys can help me out over at Patreon, and that will help me keep my gear updated, and help me keep this quality content coming:
/ paulmcwhorter
In this class we will be using the Sunfounder Raspberry Pi Pico W Keppler Kit. It will make things a lot easier if we are working on identical hardware. the link below is to amazon, and is for the identical hardware I will be using in this entire class.
amzn.to/3ubMRs1
In this introductory video, I will show you how to set up a simple client server relationship over wifi for the Raspberry Pi Pico W. The Pico W acts as a server, and your pc will act at the client. We will communicate wirelessly over wifi between your pc and pico pi using a UDP socket. Enjoy!
[Disclosure of Material Connection: I am a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com. ]
#raspberrypipicoW
#oled
#wifi
Hey guys 👋
You maybe experiencing difficulty running two instances of Thonny.
Here's the solution:
Click Tools > Options > Uncheck "Allow only single Thonny instance"
Then close Thonny completely and re-open it again.
Now you can have two Thonny side by side 👍
Thanks, Mr Burger
@@charlotteswift You welcome 😊🙏
Thank you very much for this, great info
It does work, however, it only connects to Raspberry on one instance not both
Thanks I struggled trying to figure out how to get a split screen
I bet most of us would love you to walk us through creating our own "secret" library to import. Maybe think about this for upcoming videos? Everything you can teach us is worth the time!
I AM LEGEND! This is a most-excellent lesson Paul. Freedom from wires is great! A couple things I would like to see in this series is how to run an asynchronous web server on the Pico W and how to load new programs onto the Pico W without wires. It is such a cool, little and inexpensive machine (running Python) that I think it is in a totally higher class than the Arduinos.
I like how the lessons tie to gether... good homework assignment
Thanks Paul. Starting to understand the whole server and client thing.
Very good lesson. Using an IP address and server, everything is understandable. As an added bonus, it turned out that Python 3 and Micropython can run in separate Thonny windows.
Love your passion for Maths Paul. My kit turned up today so looking forward to getting started.
Welcome Aboard!
Wow, a very amazing set-by-step WIFI Server/Client example. Thank you.
Thank You Paul, it was a very helpful lesson. I run your code on esp32 (i don't have PICO W) and it run very well❤
Thank you Paul for this very important lesson, I needed it .I am planning to build an ornithopter for my project which powered by dc geared motor .I have already learned how to do pwm now this is the next thing i need to learn to make it rc .
That sounds well interesting 😮👍
Is udp the only option? Udp doesn’t guarantee order of packets/frames … TCP does keep order… this will be needed when you ship volume of data…
Thanks Captain 🤔👍
Most interesting.
well done, as usual. I will try this.
O my god😮 ... What a lesson I am learning from you.. Really enjoying sir❤.. Thanks from India.
Thanks Paul! Working on my lesson. I got it go wireless but need to integrate the oled screen...and the RGB lesson...
Excellent!
Hi Paul & Guys
Here is the link to a video that I made about six months ago when Paul first started his Pico W lessons. I know that some of you have already seen it as it's had over 100 views but it might (or might not) make more sense now. I will check whether the latest version of Thonny can cope with .mpy files and, if it can, then maybe I'll make another short video to show my last solution working using Thonny otherwise I'll try using VSCode but I'm not used to using VSCode. Anyway here's the link: ua-cam.com/video/VAypGS_jDZo/v-deo.html
Thanks Charlie 🙂👍
Very good lesson Paul. Simply amazing. Would love to see more math in future lessons if possible.
Also will we be having a live shop talk soon? Really miss them.
Thank You for repeatedly identifying what are the Methods, objects, libraries etc. Repetition helps it sink in. I learned coding over a decade ago ago using basic / C++ with variables, subroutines and data files instead.
Use numbers greater than 1024 and less than 65536 … to keep out if the WellKnown ports and less than the maximum allowed values
Great video!
It woul be great if you could combine all your tutorials like 3d printing,raspberry pi, ai to make a full project.e.g drone running on ai. every thing from scratch
Here's my solution: ua-cam.com/video/xUUd3Khn1ug/v-deo.html which includes a couple of things that people might find useful. Sorry that it's so long and for the coughing at the end.
LEGEND!
@@paulmcwhorter Thanks, Paul. I didn't mean to criticise the way that you did it.
You look healthier and healthier. And less coughing.
Great video as always. Thanks
Here is a video of an idea that I got from Lesson 27. I am rather pleased with it (the program, not the video😁) ua-cam.com/video/0GbsFADnEDk/v-deo.html
Is this the link charlotte
@@marioalbers887 No. This is the link for my non-homework for lesson 27. I've left another comment on this video to highlight some problems with using wifi on a Pico W.
When will you be visiting Texas again? Asking for a friend~
Paul, I am really enjoying your lessons. Many thanks. Please could you do a lesson that expands on the secrets.py facility in micro python? I think that I am missing something.
Here is my homework for Lesson 28 ua-cam.com/video/iyCCkqj8f74/v-deo.html
Link to my homework assignment. ua-cam.com/video/s4EjQiyJMjw/v-deo.html Server running two OLED(s). Left OLED is the response from the client, right OLED is the reply sent back to the client from the server. Sorry for the jittery video but it's hard holding phone in 1 hand and operating the client with the other....
LEGEND!
Hey Paul,
Thanks for another useful and thorough video.
Question - would it be possible on the pico to run a process that regularly polls terms/ humidity info from a DHT11/22 on one processor, and another process on the other core that responds to client requests for temp/ humidity?
The way I would do it is simply have the pico sit and wait for a command from a client. If a client asks for temp, then go out and measure temp, and return temp. If a client asks for humidity, go out and measure humidity and return it.
I did an extra credit homework video that does just that a few weeks back. ua-cam.com/video/BFGIoa_NDHY/v-deo.html
Look at the last 2 minutes to see issues I had with resetting the battery powered Pico.
How do I open pi and Pico W in two different Thonny. How can I open two different Thonny one for Python and Micopython
There is a preference setting that will allow you to have more than one thonny serrion. Tools>Options> Uncheck the box that says allow singe thonny instance.
Here is my solution to the homework. i used the Raspberry Pi Pico w as a server with the DHT 11 to provide temperature and humidity data for recording on the computer. Here is the link: ua-cam.com/video/NWY-PObUb0I/v-deo.html
LEGEND!
The kit I have did not come with the battery, holder and module. Anyone know how I can order it separate? I already have duplicates of many components (Raphael kit, Arduino kit etc.) so I don't want to order another whole kit.
OSError: [Errno 1] EPERM i getting this error what i need to do
Hi folks. Here's my homework solution to Paul's assignment from episode 28. ua-cam.com/video/AJ_-SrlwJN4/v-deo.html
LEGEND!
I should have waited a bit before posting. Just added 2 new things that make this a better program: 1.) On the server side I wrapped the .split() commands with "Try - Except" to take care of cases where the LED blink commands were not properly configured (errors in command format were taking down the server - uh oh); and 2.) On the client side, instead of reading my commands from a list, I converted it to read the commands from a text file. Much more satisfying!
can we make walkie talkie using raspberry pi pico w on both ends?
Not sure, but bet we could make a two way texter/pager
@@paulmcwhorter can you please make a tutorial on it.
hey friends, having a little trouble. The operating system got currupt, and I had to nuke it, and reload micropyhton. During the problem solving part, I reloaded thonny to the latest release. now when I try to run local, I get an error message "cannot find the library machine". So I re-watched class 1, and didn't see anything I was missing. Any pointers on how to resovle would be great. At this time I have the homework coded, but cannot test. I guess I could bring up another Pico W and test that way, but starlink does not allow me to declare a static IP. Anyway any pointer on how to resolve would be great.
@robakers6127
Hi Rob. I hope I can help. When you're running local, you're actually using Python 3 which doesn't have machine. I believe that you haven't done any of Paul's Python and Raspberry Pi classes yet which is why you're getting confused. I don't know what libraries you want to use but 'from RPi.GPIO import GPIO' is a good start. If you want to program on the Pico, you need to go down to the bottom right and change to micropython. If you watch my solution then you'll see that you don't need to use static IP addresses. I've also pinned a comment to the video.
Machine is not available on local python. No pins to interact with. Maybe I did not read your question right.
@@charlotteswift yeah I am taking the RPI classes, just not finished, but I didn't think Paul was changing his code while in local mode. That mader me think there was something wrong with my setup. I did consider looking for like libraries in Python 3 but didn't think I had to. Thanks for the reply. That is what I will to. I will finf like libraries in Python 3
do you think to retiring any time soon i hope not you are the best teacher out there without you i dont think there is any one that can teach me programing you made me love robatics and i am not saying this because to right a nice comment i am serious my teachers teach worst than you do you all the other people in youtube are like robats they are like dead insade so i hpe you dont retiring
Hello, I faced a problem....
When i first write the code and run that then at first no data / command sent to server from client.
But when i restart the thonny then it beautifully got the command from client. But after 3 successful attempts it stopped getting command.
Can you(Paul/ anybody) help me to figure out the problem? Please 🙏
When trying to connect to my wifi, it seems to be stuck in an infinite loop of "Waiting for connection...". It has worked before on my schools wifi, but doesnt seem to work on my home network. Any help would be GREATLY appreciated.
Make sure your credentials are exactly right for logging onto your router. SSID name and password have to be exact.
@@paulmcwhorter I have made sure of that and it still doesnt seem to work. I think its something to do with my wifi really rather than my code. Thank you for your help and such a great series.
Hope people are still practising this... still not happy to run programs as main in the pico.... i do not manage to exit and start again to program from PC and need to restart form zero... any tip in this respect? not nbeen able to find any satisfactory solution in the forums online.
nice do bra, thanks for teaching !!!
Anybody else get this? ImportError: no module named 'socket' ?
@Fbarrett I assume that you're not using an ordinary Pico instead of a Pico W. That would definitely cause the problem.
@Fbarrett And of course you need to be running the right version of Micropython. First make sure that you've installed the latest version of Thonny and then you will be able to update the version of Micropython that you're using. There are different versions for a Pico and a Pico W.
@@charlotteswift Ok thanks.
@@charlotteswift Thanks. I was using pico download not Pico W. It is working now.
Homework Solution for Lesson #28 Link: ua-cam.com/video/1W57z2X8WSY/v-deo.html I had fun with the wireless ability that the pico W gives you. I just wish it has more memory space to host your own website including database.
LEGEND!
A bit late to the game - here is my homework: ua-cam.com/video/9mWVAfx19u0/v-deo.html. For those using a Mac, you can get a second instance of Thonny (once you change the option in the Tool ... Options). I found I had to run Thonny from the command line in the terminal window to get a second instance.
Another homework tangent ua-cam.com/video/OCiwRvME5qY/v-deo.html
I show how I use a mobile hotspot so I can demo my projects where you only have public internet access.
Thanks Paul for all you do.
ua-cam.com/video/PN0PBpDqCZA/v-deo.html
My home work for lesson 28. I had to review the lesson on batteries to realize I had to name the server file “main “ to get the Pico W to operate on battery.
LEGEND!
Here's my homework for Lesson 28. ua-cam.com/video/UFNHfv9k724/v-deo.html
A couple of odd things are happening that I hope someone can explain for me. Both are shown in the video. The first occurs when both programs are launched after having been previously run (previous run not shown, trust me I did it.) Once both programs are running the client fails to transmit it's data to the server. I finally figured out how to fix it by terminating the client, selecting the Pico for Thonny's interpreter (which of course generates an error), then switching back to the Local Python. Everything works perfectly after that. Nothing else seems to help including rebooting the whole shebang. Any insights would be greatly appreciated.
The second oddity occurs when I enter BYE to terminate both processes. Thonny the generates a warning in the client that "secrets.py" is a "Possible bad file name". Secrets.py is imported in the server (in the other incarnation of Thonny) but NOT in the client. Does anyone have any clue about what Thonny is trying to tell me? I'm soooo confused.
Thanks
I didn't understand a single word. I couldn't do this by myself after watching this video. Too much prior knowledge is assumed by the teacher.
Did you do the first 27 lessons in the class?
@@paulmcwhorter Thank you for your response. Yes, I have indeed watched all the previous 27 lessons in the class. However, upon reaching this particular lesson, I found myself struggling to fully grasp the intricacies of the code and concepts being presented. While I followed along with the instructions provided, I felt a gap in understanding the rationale behind certain actions and the underlying principles behind them.
Specifically, when attempting to connect the Raspberry Pi Pico to WiFi as demonstrated in Lesson 28, I encountered difficulties due to the assumption of prior knowledge. While the preceding lessons provided a foundation, I realized that they might not have covered all the necessary information for me to confidently proceed with the tasks presented in this lesson.
In essence, while I did watch the preceding videos, I believe there may be additional foundational knowledge or explanations that would have better prepared me for the content of Lesson 28. It seems that a deeper understanding of networking concepts or the specific workings of the Raspberry Pi Pico's WiFi capabilities might be necessary to fully benefit from this lesson.
I appreciate your dedication to providing educational resources, and I'm eager to continue learning. If there are supplemental materials or resources you could recommend to bridge this knowledge gap, I would be grateful for your guidance.
Thank you for your understanding and assistance.
My homework, posted just under the wire, after most have gone to bed. ua-cam.com/video/OUc5a2aW96E/v-deo.html
You make it all possible, thank you.
I've had a hard time posting my homework link ua-cam.com/video/tx7KOyE-1gI/v-deo.html
Don't know if it was Firefox or if UA-cam is glitching
Use google chrome, make sure you dont have an adblocker running.
Putting the Pico on WiFi is very exciting. Thanks for another great lesson Paul. I imagine this will open the door to all kinds of topics.
You can find my homework at ua-cam.com/video/9pvD1_lWjSw/v-deo.html
LEGEND!
This my homework. ua-cam.com/video/t6uIVB1Ebk4/v-deo.htmlfeature=shared Paul I really hope you show a solution to the problem of displayed text as it gave me a headache lol
Thank you for the lesson! This was a huge step, so here is my homework assignment: ua-cam.com/video/3rr8JFe8Wr4/v-deo.html
LEGEND!
Can you explain this line of code more. The message, address separated by a comma on the left of the equals sign confused me. message, address=UDPServer.recvfrom(…….
Hello Paul,
how is it done with the WLAN connect.
import secrets
wifi.connect(secrets.SSID,secrets.PASSWORD)
What a file "secrets"
Peter
just create a program called secrets.py
save it in the same folder as your main program, or in the lib folder
note that while the file is called secrets.py, you simply import is with"
import secrets
Now the secrets file is very simple, something like"
SSID='My Wifi'
PASSWORD='buffyBoo12'
Now, in the main program you access those value with something like
mySSID=secretes.SSID
Thanks Paul,
worked wonderfully!
Peter@@paulmcwhorter