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.
Microdot is also worth to check out
9 Different Kinds of Servers You Can Host on a Raspberry Pi.
https://www.makeuseof.com/9-different-kinds-of-servers-you-can-host-on-a-raspberry-pi/
That list is for a “regular ” Pi and there are a shit load more…it’s Linux after all.
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…
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.
fwiw: the Pico can also run a PDP-11 emulator (“kek” on github) :-)
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.
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.
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.
Try with circuitpython then
@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.
if You think micropython is good tell me how move reticulum network from python to microcontroler python
i need ssh and repeater wifi signal with mesh (BATMAN)
for making emergency wifi mesh network. meybe maskarade or git server
this is important
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.