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.

Continue reading “Pi Microcontroller Still Runs A Webserver”

Picture of the PCIce card with a fan attached

Server Network Cards Made Extra Cool

Using cheap and powerful server expansion cards in your desktop builds is a tempting option for many hackers. Of course, they don’t always fit mechanically or work perfectly; for instance, some server-purpose cards are designed for intense amounts of cooling that servers come with, and will overheat inside a relatively calm desktop case. Having encountered such a network card, [Chris] has developed and brought us the PCIce – a PCIe card that’s a holder and a controller for a 80mm fan.

The card gets fan 12V from the PCIe slot, and there’s an ATTiny to control the fan’s speed, letting you cycle through speeds with a single button press and displaying the current speed through LEDs. There’s a great amount of polish put into this card – from making it mechanically feature-complete with all the fancy fasteners, to longevity-oriented firmware that even makes sure to notice if the EEPROM-stored settings ever get corrupted. At the moment, the schematics and the ATTiny firmware are open-source, [Chris] has promised to publish hardware files after polishing them, and has also manufactured a batch of PCIce cards for sale.

When it comes to making use of cheap server-purpose cards, a cooling solution is good to see – we’ve generally seen adapters from proprietary form-factors, like this FlexLOM adapter from [TobleMiner] to make use of cheap high-throughput network cards with slightly differing mechanical dimensions and pinouts. Every batch of decommissioned server cards has some potential with only a slight hitch or two, and it’s reassuring to see hackers make their eBay finds really work for them.

Minecraft Finally Gets Multi-Threaded Servers

Minecraft servers are famously single-threaded and those who host servers for large player bases often pay handsomely for a server that has gobs of memory and ripping fast single-core performance. Previous attempts to break Minecraft into separate threads haven’t ended successfully, but it seems like the folks over at [PaperMC] have finally cracked it with Folia.

Minecraft is one of (if not the most) hacked and modded games in history. Mods have been around since the early days, made possible by a dedicated group who painstakingly decompiled the Java bytecode and reverse-engineered it. Bukkit was a server mod back in the Alpha days that tried to support plugins and extend the default Minecraft. From Bukkit, Spitgot was forked. From Spitgot, Paper was forked, which focused on performance and gameplay mechanics. And now from Paper, Folia is a new fork focused on multi-threading.

A Minecraft world is split up into worlds (such as the nether or the overworld) and chunks. Chunks are 16x16xZ vertical columns of blocks. Folia breaks up sections of chunks into regions that can be ticked independently. Of course, moving to a multi-threaded model will cause existing plugins to fail. Very little was made thread-safe and the idea is that data cannot move easily across ticking regions. Regions tick in parallel, not synchronously.

Naturally, the people benefiting from Folia the most are those running servers that support hundreds of players. On a server with a vanilla-like configuration only around a hundred or so players can be online. Increasing single-core performance isn’t usually an option past this point. By moving to other cores, suddenly you can scale out significantly without restoring to complex proxying. Previous attempts have had multiple Minecraft servers and then synced players and entities between them. Of course, this can cause its own share of issues.

It’s simply incredible to us what the modding community continues to develop and create. It takes deep patience to reverse-engineer the system and rearchitect it from the outside. The Folia codebase is available on GitHub under a GNU GPL 3.0 license if you’d like to look through it.

ESP8266 Web Server Saves 60% Power With A 1 Ms Delay

Arduino has a library for quickly and easily setting up a simple web server on an ESP8622-based board, and [Tomaž] found that power consumption on an ESP-01 can be reduced a considerable amount by simply inserting a 1 ms delay in the right place. The reason this works isn’t because of some strange bug or oddball feature — it’s really just a side effect of how the hardware operates under the hood.

[Tomaž] uses the “hello world” example from ESP8266WebServer to explain. In it, the main loop essentially consists of calling server.handleClient() forever. That process checks for incoming HTTP connections, handles them, sends responses, exits — and then does it all over again. A simple web server like this one spends most of its time waiting.

A far more efficient way to handle things would be to launch server.handleClient() only when an incoming network connection calls for it, and put the hardware to sleep whenever that is not happening. However, that level of control just isn’t possible in the context of the Arduino’s ESP8266WebServer library.

So what’s to be done? The next best thing turns out to be a simple delay(1) statement right after each server.handleClient() call in the main loop.

Why does this work? Adding delay(1) actually causes the CPU to spend the vast majority of its time in that one millisecond loop. And counting microseconds turns out to be a far less demanding task, power-wise, than checking for incoming network requests about a hundred thousand times per second. In [Tomaž]’s tests, that one millisecond delay reduced idle power consumption at 3.3 V from roughly 230 mW to around 70 mW — about 60% — while only delaying the web server’s response times by 6-8 milliseconds.

For simple web server applications, this is is for sure a good trick to keep in mind. There are also much more advanced techniques for saving power on ESP8266-based boards; from boards that barely sip a single microamp while sleeping, to coin-cell powered boards that go so far as to modify the TCP/IP stack to help squeeze every bit of power savings possible.

Big 3D Printed BMO Is Also An OctoPrint Server

OctoPrint is a useful tool for 3D printers, providing remote access to essentially every 3D printer with a USB port. [Allie Katz] decided to build an OctoPrint server in the shape of a life-sized BMO from Adventure Time, and the results are cute as heck.

A Raspberry Pi 4 is the heart of the build, with [Allie] selecting a 8 GB model for the job. It’s paired with a Raspberry Pi touchscreen that serves as BMO’s face. The Pi is also given a stereo audio output board, and hooked up to a custom PCB that runs all of BMO’s buttons. Printing BMO itself was fairly straightforward, but requires some experience working with larger PETG parts. A useful note for those playing along at home is that Polymaker PolyLite PETG in teal is just about a perfect dupe for BMO’s authentic body color.

A bit of Python code animates BMO’s face and delivers funny quips at the press of a button. When it’s time to work, though, the touchscreen serves as a straightforward interface for OctoPrint. The resulting build is both fun and functional, and a great example of what 3D printing really can achieve. It’s a cute figurine and a functional print all in one, something we don’t see everyday!

Continue reading “Big 3D Printed BMO Is Also An OctoPrint Server”

“The Era Of Distributed, Independent Email Servers Is Over”

Imagine the Internet had begun its life as a proprietary network from a major software vendor rather than evolved as a distributed network shared by researchers. It’s a future that almost came to pass for consumers in the 1990s when walled gardens such as AOL or the original incarnation of MSN were all the rage, but thankfully the world took the Internet course.

Though there are many continuing threats to Internet freedom we can still mostly use the network our way, but with sadness we note that one piece of Internet freedom may have drawn to a close. [Carlos Fenollosa] has written a lament about how the outlook for anyone running their own mail server now looks bleak.

At its heart is spam, or indeed the heavy-handed measures taken by large email providers to combat it. Spotting and canning spam is computationally expensive, so the easiest way to stop a spammer is to recognize their activity and block it at the network level. Thus a large email provider will instantly block large IP ranges when it detects they hold a spammer, with the collateral damage of also blocking any legitimate email servers in the same range such that their mail just doesn’t get through. Since spam is such a widespread problem, as [Carlos] points out it’s less of a case of if your server has this problem, but when. This functions essentially as something of a racket, in which large email providers have the power to ensure that any email not generated from amongst themselves is unlikely to reach any of the millions of addresses under their care, and the only recourse an operator of a small email domain has is to use the services of one of them.

He has something of a manifesto as to how this problem can be addressed, and we think that it’s important enough that you should take a look. Maintaining email as something beyond the control of large providers is too important not to.

Thanks [Thomas Steen Rasmussen] for the tip.

Header image: RRZE, CC BY-SA 3.0.

Color Us Impressed: Redbean Runs A Web Server On Six Operating Systems

The holy grail of computing is to have some way to distribute a program to any computer. This is one of those totally unachievable goals, but many have tried with varying degrees of success.  People naturally think of Java, but even before that there was UCSD’s P-code and many other attempts to pull off the same trick. We were impressed, though, with Redbean 2.0 which uses a single executable file to run a webserver — or possibly other things — on six different operating systems. If the six operating systems were all flavors of Linux or Windows that wouldn’t be very interesting. But thanks to APE — the Actually Portable Executable — format, you can run under Windows, Linux, MacOS, OpenBSD, NetBSD, and FreeBSD.

This is quite a feat when you realize that most of these take wildly different file formats. There is one small problem: you can’t use much of anything on the host operating system. However, if you look at Redbean, you’ll see there is quite a lot you can do.

Continue reading “Color Us Impressed: Redbean Runs A Web Server On Six Operating Systems”