On the other end of the wire, there's a linux box which bridges the serial link to the internet. It doesn't do any processing or run custom software: the microcontroller has its own TCP/IP stack and HTTP server.
Two 1500 byte buffers are used for sending and recieving packets. The output buffer is needed because both TCP and IPv4 include checksums which must be computed before sending the packet. This could be trimmed down to a single buffer at the cost of code complexity — but I have a spacious 8 kB of RAM, so it's not a huge deal. (at least one buffer is required to avoid dropping closely spaced packets like the ACK and ACK+PSH at the start of a connection)
Each TCP connection's state weighs 23 bytes, which (leaving some space for the stack) allows storing ~200 simultaneous connections, although the link will max out long before that.
The link is run over 115200 baud UART, which leaves ~83 kbits/seconds (10 kB/s) after framing. However, every connection is throttled by fixing TCP's "cwind" to 1, and limiting the payload size to 500 bytes. At a typical RTT of 300ms, this results in a ~2 kB/s, enough to load this page in a 2-3 seconds.
It's not winning any bandwidth records... but because there's no operating system and the processor runs code directly out of flash memory, it doesn't have to boot: The server is ready to handle traffic a few microseconds after receiving power.
Because publically routable IPv4 addresses are expensive, if you are acccessing this from the public internet, you are connecting to my VPS. That server runs nginx to proxies the request down a wireguard tunnel. At the other end of the tunnel, there's a linux "router" box, which forwards packets to the microcontroller over serial.
The VPS handles IPv6 and TLS, but there is no caching or buffering: all requests are served by the MCU's TCP/IP stack.
(This means that when I access the site from my phone, the data has traveled 32,000 km. It's crazy that we can do stuff like this)
UPDATE: If you have CGHMN access, you can connect to the MCU's TCP/IP stack directy at 100.68.128.2 or "mcu.retro".
An art project from maurycyz.com
Send complaints by email.