Pi Microcontroller Still Runs A Webserver

At first glance, the Raspberry Pi Pico might seem like a bit of a black sheep when compared to the other offerings from the Raspberry Pi Foundation. While most of the rest of their lineup can run Linux environments with full desktops, the Pico is largely limited to microcontroller duties in exchange for much smaller price tags and footprints. But that doesn’t mean it can’t be coerced into doing some of the things we might want a mainline Pi to do, like run a web server.

The project can run a static web page simply by providing the Pico with the project code available on the GitHub page and the HTML that you’d like the Pico to serve. It can be more than a static web page though, as it is also capable of running Python commands through the web interface as well. The server can pass commands from the web server and back as well, allowing for control of various projects though a browser interface. In theory this could be much simpler than building a physical user interface for a project instead by offloading all of this control onto the web server instead.

The project not only supports the RP2040-based Raspberry Pi Pico but can also be implemented on other WiFi-enabled microcontroller boards like the ESP8266 and ESP32. Having something like this on hand could greatly streamline smaller projects without having to reach for a more powerful (and more expensive) single-board computer like a Pi 3 or 4. We’ve seen some other builds on these boards capable of not only running HTML and CSS renderers, but supporting some image formats as well.

14 thoughts on “Pi Microcontroller Still Runs A Webserver

    1. Host a site on an esp8266… $1.98 last time I ordered some… a little more available than the pi… nothing can go wrong with opening a dmz and letting the internet access…

      1. Using web sockets on an ESP can give amazing results. I’ve seen an example of an oscilloscope or something like it sending screen updates at about 100-200fps from what I recall.

  1. Can this be done from C/C++ on the Pico? Micropython is such a horrible language for embedded use (seriously, an embdeeded language NEEDS to be a compiled one so the compiler can check for common errors and errors in rarely visited code branches before you flash to the device), so one really needs C/C++ on the pico for it to be useful as a microcontroller to interface with electronic components. If this website hosting can be compatible with C/C++ then it could be very useful as a way to make electronic projects internet controllable.

    1. I’ve been around long enough to remember when people would argue that C (as opposed to assembly language) was a horrible language for embedded use. I’m in the midst of an embedded project using MicroPython to control hardware at this moment. The key to doing so successfully is to implement a reasonably comprehensive test suite using pytest or a similar module. Of course, the same is true of C/C++. In my opinion, relying on compiler diagnostics to catch “common errors” is not sufficient for anything more than strictly amateur level work.

    2. It definitely is. The micropython layer sits on top of the C API. It’s a bit harder and lengthier to upload your sketch since you’re uploading it on bare metal vs the runtime, but it’s definitely feasible.

    3. @Iain said: “Micropython is such a horrible language for embedded use (seriously, an embdeeded (sic) language NEEDS to be a compiled one so the compiler can check for common errors and errors in rarely visited code branches before you flash to the device)…”

      Micropython sits on top of C/C++ already. But I agree with you, Python on a micro-controller is generally an abstraction to be avoided.

  2. They’re worth it, running web sites isn’t that cpu intensive. Also the reason why some Intel servers run from 10 core 20 thread atom cpus. Their 1.66Ghz speed is very low, but their core count can easily serve a page to a few 100 users at a time. This pico can serve a basic html page to a handful of people at a time.

Leave a Reply to FfrCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.