Тёмный

Add a web control panel to your project - the web server 

Bytes N Bits
Подписаться 30 тыс.
Просмотров 12 тыс.
50% 1

Adding a web based control panel to your Micropython project allows you much easier monitoring and control of your device. Just pull up a web browser and interact with your project on a fully graphical user interface.
This is part one of a three part series. We'll build the web server code so that you can connect to your device, get it to decode your request, action it and then send back any data or code files that you need.
The tutorial uses a Raspberry Pi Pico W but any Micropython, WiFi enabled device will work.
Check out the project page on my main website at
bytesnbits.co.uk/web-control-...
Download the code from my GitHub repository
github.com/getis/micropython-...
0:00 Introduction
2:24 How a web server handles requests
4:06 The HTTP request message
11:45 The RequestParser code
15:58 HTTP response message
19:40 The ResponseBuilder code
23:52 Decoding the request and actioning it
27:43 What's next

Опубликовано:

 

22 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 35   
@tiagdvideo
@tiagdvideo 10 месяцев назад
Very comprehensive. Came across these a couple of months ago - definitely the best tutorials on the topic out there. Only now getting the chance to try and put physically into practice. Thank you for all the effort you put into this
@BytesNBits
@BytesNBits 10 месяцев назад
Glad it was helpful!
@Redstoneghost133
@Redstoneghost133 8 месяцев назад
Just came across this one late night coding. It's a lot more in depth and packed full of content than I thought, which is a welcome surprise by all means. Will be watching all the videos in order to better understand your flow, and how to get it working :)
@BytesNBits
@BytesNBits 8 месяцев назад
Glad you enjoyed it!
@brianjros
@brianjros Год назад
this is such a good tutorial, it should really be way more popular, thank you
@BytesNBits
@BytesNBits 11 месяцев назад
Glad you think so!
@rd-tk6js
@rd-tk6js 4 месяца назад
Excellent set of tutorials on Pico Pi web apps, thanks !
@BytesNBits
@BytesNBits 4 месяца назад
Glad you like them!
@umutkayacan7659
@umutkayacan7659 Год назад
A new vid after all this time. Very nice
@BytesNBits
@BytesNBits Год назад
Hi. Too much work. Too little time!
@michelpoisson3500
@michelpoisson3500 Год назад
Micro python,wifi connection, pi pico W, socket, html, web page, request, Json..etc..Thank you for making me, learn about all those interesting topics through the building process of this Web Control Interface. I watched your 3 last video and appreciated your explanations on all of those. So far , I made everything running on PI Pico and as well on an ESP32 (with some modifications for the WIFI connection).Regards. Michel
@BytesNBits
@BytesNBits Год назад
Thanks for your comments. I hope you're finding the techniques useful.
@yahmk3978
@yahmk3978 Год назад
Thank you!
@SofianMW
@SofianMW 11 месяцев назад
Thanks for this tuto
@BytesNBits
@BytesNBits 11 месяцев назад
You're welcome
@johncutler5995
@johncutler5995 Год назад
Your tutorials are very helpful. Can you please tell me what Editor/IDE you are using for these projects? I prefer VSCode, but have problems running my PICO-W projects from within that IDE. I installed the "PICO-W-GO" vscode extension, and several other extensions for code completion and live server. I also have tried Thonny, but it isn't nearly as elegant. ANY suggestions would be much appreciated! Thank you
@BytesNBits
@BytesNBits Год назад
I use PyCharm. The community edition is free and gives you a very good IDE. There is a Micropython extension that gives you the REPL terminal etc. I did make a video on setting it up a while back. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-44dwZCz4_sc.html
@johncutler5995
@johncutler5995 Год назад
@@BytesNBits Thank you for responding! I did watch the set up video that you referenced and it was most helpful. I found the older version of Pycharm on the JetBrains website and installed it on my 2011 iMac. I got it working with a Pico-W, running micro python with the plug in that it installed. However, the RePL is sometimes intermittent, and I find the PyCharm interface somewhat obtuse. So, after still struggling with VSCode, and the Pico-W-Go extension, I have that working pretty well. Unfortunately, the extension author keeps updating it, and the newer versions are buggy. so, I'm back to Thonny 4.02 and after watching Chris DeHut's RU-vid tutorial series on Thonny, I've (for now) settled into using it. Thank you for your detailed tutorials and please keep them coming.
@BytesNBits
@BytesNBits Год назад
@@johncutler5995 No problem. VSCode is a great editor. I use the JetBrains apps for my main web development work so am used to it's interface - common across all it's apps. The REPL plugin needs the newest version of PyCharm to work reliably. It's actually a good implementation now. As always I guess these plugins etc will settle in after a while.
@Greeata
@Greeata 9 месяцев назад
thanks for this video - really appreciate it. I have some background programming - just not web stuff so I was looking for something I could use as an interface for a few projects that I'm building on pico-w for home automation. Would I be able to use this as something that picks up readings from sensors running in an infinite loop and storing data variables in a main loop and displaying the status on the webpage? The whole 2 threads only on the pico means being more careful in paying attention to what is going on than I normally would!
@BytesNBits
@BytesNBits 9 месяцев назад
Yes. That's an ideal project for this code. Make sure you have a look at the last 2 videos in this series. I show you how to make better use of the cores and transfer a lot of the processing and display work down to the browser leaving the Pico as a data gathering and control tool.
@Greeata
@Greeata 9 месяцев назад
@@BytesNBits - will do!
@dougblanding8791
@dougblanding8791 Год назад
This tutorial is super. Once I realized that I needed to download and install the postman desktop agent, I was able to get it working to send GET requests to the Pico as shown in the video. However, your video doesn't show the details of the POST request so I wasn't able to get that working. Can you show the URL of the POST request?
@BytesNBits
@BytesNBits Год назад
In postman you need to create a POST request and then fill in one of the parameter blocks. The Pico uses the same URL to receive each request. I go into it all in a lot more detail in the next video. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-PY732g2ZN4g.html
@MattDvc
@MattDvc 5 месяцев назад
Any idea why in ResponseBuilder *path, filename = req_filename.rsplit("/", 1)* returns *['index.html']* instead of *['', 'index.html']* ?
@BytesNBits
@BytesNBits 5 месяцев назад
if the filename doesn't contain a / you'll just get the full string returned as a single element array. It looks like that's what's happening. At the start of the function the code should add a / if it's missing. You'll need to add some checks to see why the / is not getting prepended to the string.
@MattDvc
@MattDvc 5 месяцев назад
Got it now. I was passing empty string '' to the method instead of 'index.html'. Silly mistake 😆
@ChylleSuu
@ChylleSuu 7 месяцев назад
Does this can be accessed remotely with other devices and wifi address?
@BytesNBits
@BytesNBits 7 месяцев назад
When connected to your home router is will be hidden behind your router firewall (as it should). If you want to get remote access you'll have to open up a port to your device in the router settings, or place it in the DMZ zone to fully expose it. You'll then need to make sure you have a reliable way of connecting to your router's public IP address. If you haven't got a fixed IP you'll need to use one of the dynamic DNS services. It probably sounds more complicated than it is - probably a good topic for a video :)
@danman32
@danman32 3 месяца назад
will somebody please make a video on how to do such things in c/c++ PLEASE?
@BytesNBits
@BytesNBits 3 месяца назад
More C++ tutorials are on my list. Just finding time to get the projects completed at the moment. Keep an eye out.
@markestrada4169
@markestrada4169 10 месяцев назад
Really cool tutorial. May I know what software you use to display those diagrams? The one in this section ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-h18LMskRNMA.html They are really helpful for visualizing the subject.
@dalesmith8666
@dalesmith8666 5 месяцев назад
Would have been nice if this was done with C/C++. I have absolutely no use or love for "Python"! To me Python is like a car that has an 8 cylinder engine, but only runs on three, stuck in second gear, with the rear tires being flat! Otherwise your tutorial would have been great. SORRY! At 11:12, I ended it and went elsewhere.
@BytesNBits
@BytesNBits 5 месяцев назад
No problem. I use Python to help novice coders.
Далее
Разбудили Любимой Песней 😂
00:14
The Raspberry Pi Pico WAS Overrated! But that changed!
10:18
Crowdstruck (Windows Outage) - Computerphile
14:42
Просмотров 7 тыс.