How To Setup a HTTP Web Server With Raspberry Pi Pico W (using WiFi)

Поділитися
Вставка
  • Опубліковано 2 сер 2024
  • The full guide: core-electronics.com.au/guide...
    Now that we can connect our Raspberry Pi Pico to the internet, it's time to control something! This guide will cover setting up a server to host a simple page on your network. We'll use this page to control some hardware attached to our Pico W - drive an LED and read the status of a button. Once we master these inputs and outputs, the sky is the limit!
    For products featured in this guide:
    • Raspberry Pi Pico W: core-electronics.com.au/raspb...
    • Raspberry Pi Pico: core-electronics.com.au/raspb...
    If you have any questions about this content or want to share a project you're working on head over to our maker forum coreelec.io/forum
    Core Electronics is located in the heart of Newcastle, Australia. We're powered by makers, for makers. Drop by if you are looking for:
    • Raspberry Pi core-electronics.com.au/raspb...
    • Arduino core-electronics.com.au/ardui...
    • Sparkfun core-electronics.com.au/brand...
    • Adafruit core-electronics.com.au/brand...
    • Pololu core-electronics.com.au/brand...
    • DFRobot core-electronics.com.au/brand...
    The following trademarks are owned by Core Electronics Pty Ltd:
    "Core Electronics" and the Core Electronics logo
    "Makerverse" and the Makerverse logo
    "PiicoDev" and the PiicoDev logo
    "GlowBit" and the GlowBit logo

КОМЕНТАРІ • 98

  • @Alpha_fitz
    @Alpha_fitz Рік тому +7

    Thank you. Keep em coming. Love the pico w. There should be more of them in a few weeks.

  • @mattytrentini
    @mattytrentini Рік тому +13

    Great tutorial, thanks! Just a heads-up that there are a number of web serving libraries which could make the work easie...my favourite is microdot which is inspired by Flask and the decorators used to configure HTTP endpoints. Please keep the MicroPython videos coming! (I'll be mentioning this one at the Melbourne MicroPython Meetup tomorrow!)

  • @Gribouille28210
    @Gribouille28210 Рік тому +2

    N'étant pas un fervent de la langue de shakespeare, je m'en suis sorti très correctement et merci pour cette vidéo très explicite. Bravo et merci.

  • @davidwhite633
    @davidwhite633 Рік тому +4

    Great starter video. I really appreciate the basic web server. Just the basics. Nice not having to learn Flask (or whatever) first. Read a pin from the board. Read input from the web. Change an output on the board. Write something out to a web page. That gets me started. Exactly what I needed. Feel I can take this and run with it. Thanks

  • @gamerneversleep4200
    @gamerneversleep4200 Рік тому +37

    dang u censored Local address how am i supposed to hack u now. 😂😂😂

    • @wifinesesi
      @wifinesesi Рік тому

      He had to be %1000000 sure

  • @L2.Lagrange
    @L2.Lagrange 3 місяці тому

    This looks super useful. I will definitely mess around with this using my Pico. The clicking the buttons seems particularly useful

  • @SirSurreal
    @SirSurreal 9 місяців тому

    A good tutorial that gives a basic web interface for the Pico. Other videos I've watched cover Flask but in a full blown Python/Pi 3/4/zero context. It's good that you get to see results from code that you can follow along with. Will experiment with my Piicodev OLED, Atmospheric sensor, and Li-ion battery. Hopefully capture data to a CSV file and create a remote data logger.

  • @jeffschroeder4805
    @jeffschroeder4805 3 місяці тому

    Thank you, your guides are wonderfully clear and concise. I appreciate them so much.

  • @darekkrawczyk8745
    @darekkrawczyk8745 Рік тому +1

    Thank you for the great tutorial. If it were a little closer, I would thank you personally. Greetings from Poland

  • @DanielMurrayMakes
    @DanielMurrayMakes Рік тому

    Fantastic video & resources. Will be a huge benefit to my students. Much much appreciated!

  • @dabunnisher29
    @dabunnisher29 Рік тому

    I really dig your channel. Thanks for all the cool projects.

  • @mytechnotalent
    @mytechnotalent Рік тому +2

    Just brilliant! This helps makers use MicroPython in powerful new ways. Thank you for this so much!

  • @user-cj4jm1fx6b
    @user-cj4jm1fx6b Рік тому

    Great video! I got mine working.

  • @fredmunyao787
    @fredmunyao787 4 місяці тому

    This tutorial really helped me

  • @Taki7o7
    @Taki7o7 Рік тому +6

    Well well, now you just need to find a Pico W to buy. Chip Shortage sux :/ I mean, i was happy enough to get 2 Pico W's on release day, but i feel so bad for the people trying to get one atm ^^

  • @BambooInc
    @BambooInc Рік тому

    Thanks! This was a great tutorial for my first Pico W project. I took an additional step and set up port forwarding on my router to allow access from a public IP address using a specific port. That worked great, until I had different users try it from different locations and some had trouble connecting until I reboot the pico. Maybe it gets stuck on a connection session with the first person to connect? Could this be solved if we end the connection with the logged in user after X minutes of inactivity so that the server is waiting for a new connection without a reboot? I'm new to python - any suggestions are welcome.

  • @Wawan_Setiaw4n_Robotik
    @Wawan_Setiaw4n_Robotik Рік тому +1

    Good, tank's very much Master..

  • @donaldhoudek2889
    @donaldhoudek2889 3 місяці тому

    I did a quick search on your videos and I did not see a video for a Pico W setup as a stand alone AP/WebServer. This video looks as if the Pico W will log into the home network and then the user will access the the Pico w through the home network. A stand alone Pico W could be a GREAT future video. Maybe even utilizing the Push button/LED project for that video also. Just a thought. Outstanding Video!

    • @Core-Electronics
      @Core-Electronics  3 місяці тому

      What a timely comment, we may be working on that exact video right now...

    • @olofintiladavid3479
      @olofintiladavid3479 Місяць тому

      @@Core-Electronics
      Please, do you have a vide on this now?

  • @laynemccormic9102
    @laynemccormic9102 Рік тому

    appreciate the walkthrough. Felt like I was getting some questionable vibes at the beginning tho XD

    • @Core-Electronics
      @Core-Electronics  Рік тому +1

      Can't have you peeping our local IP address #haxxor 😎

  • @britishtechguru
    @britishtechguru Рік тому

    That works. Be better as a webhost though.

  • @lloydsshednanigans
    @lloydsshednanigans Рік тому

    This video brings another thought/question. I'm currently using a Rpi0W as a control server for my Rigol DM3058e, thanks to your video on making the Rigol stuff talk to each other. I have the PSU and the DSO on LAN but the DMM only has USB-B. The Rpi0w is really a waste of resources for running simple webserver for control/datalogging. I'm wondering if a Pico with a webserver would handle that small function. Only tricky part is the USB connection.... Can it be done?

  • @itwaslikethatwhenigothere
    @itwaslikethatwhenigothere Рік тому +3

    That was a really useful tutorial! Would you consider doing a tutorial on combining a Pico w web server with a BME280? I've been programming in C for years, and I am now starting to learn python, and I think a project like that would be good one to learn how to remotely read sensors.

    • @Core-Electronics
      @Core-Electronics  Рік тому +2

      Check out the HomeStation project by Liam on our forums! His example presents a live dashboard using a BME280.
      forum.core-electronics.com.au/t/homestation-a-pico-w-powered-webpage-dashboard/14900

    • @itwaslikethatwhenigothere
      @itwaslikethatwhenigothere Рік тому

      @@Core-Electronics Thanks for the link, that project is just what I am looking for.

  • @FranciscoJavier32423
    @FranciscoJavier32423 Рік тому +1

    Amazing, really good tutorial, I want to have that board do practice and play, unlikely are sold out for now.

    • @GermanBluntSmoker
      @GermanBluntSmoker Рік тому +1

      I don't know where you live, but if shipping isn't too expensive, just order some from Germany. All other Raspberry boards are completely sold out, but there seems to be more than enough of the Pico and Pico W left. I bought 4 Pico and 4 Pico W myself yesterday, so I can assure you that you will get some here.

    • @FranciscoJavier32423
      @FranciscoJavier32423 Рік тому

      @@GermanBluntSmoker Thanks for the advice, I live in Japan, few days ago I tried from UK but i was rejected because of the address, I bought from aliexpress I hope it arrives and works well.

  • @MohitKhare
    @MohitKhare 11 місяців тому

    Thanks that is a really cool started project. Can you also make a video on micropython vs circuitPython. I'm new to this and it's all very confusing. Appreciate the efforts.❤

  • @ferdifefe3160
    @ferdifefe3160 3 місяці тому

    Hi, great video. What do I have to change if I want the website to be addressable from different wifis?

  • @wasdaletimelapse7658
    @wasdaletimelapse7658 8 місяців тому

    Great video as always from Core Electronics. I am trying to implement a pico w with an LDR sensor that logs time and date to a CSV file when my central heating comes on and goes off. I have all that aspect of the project working just great but I want to be able to download the CSV file from the pico via a link on a web page. I am very close but I am unable to download the file, any file, and I cant find out why or how to do it. It seems like it should be such an easy thing to do. All the examples of webserver functionality seem to focus on LED manipulation. Who needs to turn on an LED over the internet? I would really appreciate any help or info on how I can achieve file downloads over my LAN. Thanks in advance.

  • @juniorngomajose9454
    @juniorngomajose9454 8 місяців тому

    Thank you for the video.
    What can I do to acces the html page anywhere? Instead of localhost

  • @eezees9306
    @eezees9306 Рік тому +1

    Thanks for this, I find your presentation well paced and easy to follow. I am trying to re-program a garden watering system to include a wifi connection. All the examples of Pico W web servers I've found involve an infinite loop for the server. What I need is code running the watering system to run with the server in the background. The server traffic will be minimal.. just me on the LAN occasionally. I'm not sure if I should try to use uasyncio or just run through the server code every few cycles to see if there is incoming requests. Any advice?

    • @Core-Electronics
      @Core-Electronics  Рік тому

      The best way to get technical help for any of our content is on the forums: forum.core-electronics.com.au/
      We're full-time makers and are on the forums every working day!

    • @MichaelKingsfordGray
      @MichaelKingsfordGray Рік тому

      The RP2040 has two independent cores.
      You can run the server on an infinite loop, and have the other core handling I/O, along with the help of the 4 independent PIO cores, if required.
      A very powerful little chip.

  • @geraldojosegardinalli1305
    @geraldojosegardinalli1305 Рік тому

    👏👏
    Great tutorial, Michael, thanks a lot for this!
    I need to open a file in OneDrive and save/read some log data (e.g. temperature) there with my Pico W.
    Any hints how can I do it???
    Greetings from Brazil!!!

    • @codyrap95
      @codyrap95 Рік тому +2

      I think this is way too much to handle for the Pico, you might need a Raspberry Pi 3 or 4 (or any SBC for that matter), not a microcontroller for this, as you need to handle authentication and file upload

  • @luke752010
    @luke752010 Рік тому

    Outstanding video, Thanks! Is It possible to read sensor within a wifi direct connection ? For example, reading over Wi-Fi Direct between a smartphone app and a Pico ?

  • @fatehmd8321
    @fatehmd8321 Рік тому

    Thank you. I am trying to run example code for Arduino nano rp2040 connect but I am seeing error 'OSError: [Errno 1] EPERM' for the line 'wlan.connect(ssid, password)'

  • @rupadarshisamanta3288
    @rupadarshisamanta3288 7 місяців тому +1

    I'm trying to connect the raspberry pi Pico W with wifi and successful, but when i copy paste the ip address to browse it's not opening. I tried many times but failed.
    Can you help me to figure out the fault ?
    I've also a stable internet connection.

  • @Michael-pw1gc
    @Michael-pw1gc Рік тому

    I have the problem that fail massage is always present and I can power the pico how often I like new but it never solve the Issue.

  • @Amihuman-ey7ne
    @Amihuman-ey7ne Місяць тому

    Very informative and amazing video. I tried the same using my Rpi zero W but ran into machine ModuleNotFound error. Could you suggest any corrections for this? Thank you

    • @Core-Electronics
      @Core-Electronics  Місяць тому

      This will only work for a Pico W Microcontroller, not Raspberry Pi's single board computers. We don't have a guide on it unfortunately (thats a good idea though), but you can find others along the lines of "Rpi Zero W host HTTP Server"

  • @thespacecowboy420
    @thespacecowboy420 7 місяців тому

    how do you upload a separate html file and reference it instead

  • @JoshF151Tech
    @JoshF151Tech Рік тому

    Would I be able to use a Raspberry Pi Pico W as a Backup DNS Server to keep my Internet Online if my Raspberry Pi 4 goes Offline? My problem is my Router makes me put in two DNS Addresses so I set them both as the PiHole DNS Addresses I've tried setting the Secondary DNS as Google's DNS but if I do that and turn off my Raspberry Pi 4 it doesn't allow me to connect to the Internet unless I turn the Raspberry Pi 4 back on and with the Prices of Raspberry Pi 4 and even the Raspberry Pi 3 right now I don't really want to spend that amount of money on another one right now if I don't have to?

    • @Core-Electronics
      @Core-Electronics  Рік тому

      This is a necessary constraint of PiHole - blocked queries *need* to fail. It's worth a shot! sounds like an interesting project. The trouble will be keeping the DNS tables synchronised between devices.

  • @tommypham916
    @tommypham916 Рік тому +1

    Is it possible to control a servo motor through a web server as well using the raspberry pi Pico w?

    • @Core-Electronics
      @Core-Electronics  Рік тому +1

      Yes! The best way to get technical help for any of our content is on the forums: forum.core-electronics.com.au/
      We're full-time makers and are on the forums every working day!

  • @엄브릿지
    @엄브릿지 6 місяців тому

    Does it work even if the pc is turned off?

  • @loganphan2043
    @loganphan2043 Рік тому

    Great. I have a question, How do you manage multiple pico w with the same feature on mobile phone/web-app?

    • @Jo-re2ye
      @Jo-re2ye 4 дні тому

      You would give each its own IP address

  • @jyvben1520
    @jyvben1520 Рік тому +2

    and add a sd-card reader for extra file storage ...

  • @sivaasapu4580
    @sivaasapu4580 Рік тому +1

    sir, On the Raspberry Pi 4 model, is it possible to run two programmes at the same time?

    • @Jo-re2ye
      @Jo-re2ye 4 дні тому

      Even 10, but this about the pi pico. Here to you can run multiple processed as it has 2 cores, or you can use uasync library for cooperative sharing of a single core. There are also 8 state machines, but those are a bit trickier to program. It's a really powerful little device

  • @guythegeek
    @guythegeek 9 місяців тому

    Hi when I try to import network in thonny I get an import error in circuit python please help

  • @TheCeredigion
    @TheCeredigion Місяць тому

    Interesting stuff, are there any projects about setting up a stand-alone webserver to serve webpages (without being connected to the Internet)

    • @Core-Electronics
      @Core-Electronics  Місяць тому +1

      I'm a little confused about what you are looking for, this method should work even if your local wireless network doesn't have internet. If you don't want to use an existing wireless network, we have a tutorial on how to make the pico serve a webpage over its own network that it hosts!
      core-electronics.com.au/courses/raspberry-pi-pico-workshop/#5.3-hosting-a-wi-fi-access-pint-and-web-page

    • @TheCeredigion
      @TheCeredigion Місяць тому

      @@Core-Electronics Thanks for the response, I'll have a read through. I think that's what I was looking for. Something really simple, (like a wifi hard-drive) but where you can just link to the wifi coming from the Pi and it takes you to a webpage and lets you access the content (as web pages). Be great for workshops in the middle of nowhere, or camp sites or could provide info in isolated places.

  • @viliamholub509
    @viliamholub509 Рік тому

    I’m nitpicking little bit here, but query in GET should not change state. It is supposed to be idempotent.
    To change state, use POST.
    Nice demo anyway

  • @mikehadzhiev4152
    @mikehadzhiev4152 Рік тому

    Question to the author can i run pi hole on the new raspebbry pico w

    • @Core-Electronics
      @Core-Electronics  Рік тому +1

      Hi Mike, Pi Hole is an application that is designed for Linux based systems, so it won't run on a Pico W as it is only a Microcontroller and not a complete computer. It may be possible to create an ad blocker that runs on a Pico W but we seriously doubt its efficacy when compared to a Raspberry Pi running Pi Hole. Thanks for the question 🙂

  • @user-lj3ky8xk1d
    @user-lj3ky8xk1d 6 місяців тому

    how to change ssid and password of pico w after enable wifi

  • @cheze_bun
    @cheze_bun Рік тому

    For some reason it said trace back modulenotfounderror: no modula name ‘network’
    Why is this happening

  • @gandalfsVater
    @gandalfsVater Рік тому

    How can i adjust the code, so i can simply only show a website without buttons, leds or anything else

    • @Jo-re2ye
      @Jo-re2ye 4 дні тому

      Change the HTML?

  • @yesultimate1225
    @yesultimate1225 7 місяців тому

    Why is from machine import ptin not working?

  • @edwinrivera5128
    @edwinrivera5128 Рік тому

    I'm having trouble connecting the Raspberry pi pico W to an open wi-fi from a hotel lobby, is this because of security measures or should I just try this at home instead?

    • @Core-Electronics
      @Core-Electronics  Рік тому +1

      I'd try again at home on your own network. Public networks don't allow connections between local users.

    • @edwinrivera5128
      @edwinrivera5128 Рік тому

      @@Core-Electronics Holy crap it worked! thank you for this tutorial!

    • @edwinrivera5128
      @edwinrivera5128 Рік тому

      @@Core-Electronics Question on the Hardware test, how is the pin 15 and pin 16 complete the circuit if none of them have an LED light on there or has nothing of ground in it at least that is what the paper the pico W basic set brought)
      led = Pin(15, Pin.OUT)
      button = Pin(16, Pin.IN, Pin.PULL_UP)
      I've been trying to figure that out for 1 hour or so, but I can't seem to find the logic in it
      (I've followed the video and it works I just want to understand it better)

    • @edwinrivera5128
      @edwinrivera5128 Рік тому

      I realized that if you put these pin numbers in here:
      led = Pin(16, Pin.OUT)
      button = Pin(15, Pin.IN, Pin.PULL_UP)
      the light gets dimmer, as if the voltage coming from over there is too low and that makes it reach less to the LED light. don't know if that's true but I'm still figuring things out. Thanks in Advanced

  • @PreshithaMediaLive
    @PreshithaMediaLive 10 місяців тому

    >>> %Run -c $EDITOR_CONTENT
    MPY: soft reboot
    waiting for connection...
    Traceback (most recent call last):
    File "", line 42, in
    RuntimeError: network connection failed
    >>>
    But my rpi is pico w

  • @joetimbersock7639
    @joetimbersock7639 Рік тому

    Is this server safe and secure?

  • @Bobo-ox7fj
    @Bobo-ox7fj Рік тому

    Man, you didn't even censor the fact that your local network uses IP! I might have assumed you were operating on AppleTalk.

  • @alex-ku9yt
    @alex-ku9yt 7 місяців тому

    No one can do this with arduino ide and c++ all write to slow python where word going

  • @alex-ku9yt
    @alex-ku9yt 7 місяців тому

    These

  • @acermf7983
    @acermf7983 Рік тому

    so you dont have to edit as much, you dont have to blur out your local ip. 192.168.x.x or 10.0.x.x

  • @mitcore
    @mitcore 9 місяців тому

    you forgot to blur your local ip address at 8:23

  • @splatink
    @splatink 4 місяці тому +1

    bro really censored a private ip

  • @Henrix1998
    @Henrix1998 Рік тому +2

    This man censoring his local ip

  • @sambeard4428
    @sambeard4428 7 місяців тому

    haha you're blurring your local ip address, let me guess, the address starts with 192.168.0. no need to hide that. nobody will be able to access that unless you specifically allow someone on your local network, afterwhich it is already to late I'm afraid

  • @truthhurts1459
    @truthhurts1459 Рік тому

    I set my ROUTER to always give each PICO a STATIC IP ADDRESS, and still got the 'address in use error". So I put
    wlan.disconnect() # release the current IP#
    time.sleep(3) # time for router to react
    right after the line "wlan.active(True)". I almost never get that error now.

  • @VoeViking
    @VoeViking Рік тому

    WHY would you hide a local address?

    • @Core-Electronics
      @Core-Electronics  Рік тому

      Can't be too careful! Even a local IP exposes *some* information about internal network structure. It seems to provoke lots of engagement too 😅

  • @edkhil
    @edkhil Рік тому

    Dude, I can't take someone who censors his LOCAL IP seriously.

    • @Core-Electronics
      @Core-Electronics  Рік тому +1

      Glad that's your only complaint for this tutorial - I guess the rest was pretty clear then 😀
      There's a lot more going on in an enterprise network than your average household network. We don't want to reveal any information about the network structure.

    • @edkhil
      @edkhil Рік тому

      @@Core-Electronics So why did you even leave the "192" in the first place? It would have made more sense if you censored your whole IP, right? Also, I don't think revealing a single *local* IP address could do any harm or give something away about your network, except the address range (which you already pretty much revealed).