
During what one might have called my degenerate heyday, I got to the point in my nicotine addiction where I was rinsing through enough disposable vapes to make even the most hardened environmentalist queasy. So colour me thoroughly disappointed that I could have been turning all those horrible little plumage devices into websites once they'd ran out of juice.
Don't believe me? Just check out ewaste.fka.wtf. That website is hosted on the microcontroller from a disposable vape, and it's surprisingly snappy. Some disposable vapes come with a surprising amount of tech packed into them, including screens and microcontrollers.
As BogdanTheGeek, the person who made the vape-powered site, says: "I wouldn’t want to be the lawyer who one day will have to argue how a device with USB-C and a rechargeable battery can be classified as 'disposable'."
The horsepower of these little devices might not be much, but it's enough to host a bona fide website. And sure, we're getting a lot of 503 errors at the moment, but that's because a ton of people must be visiting the site right now after learning about it.
The text contents of the website explain how it was achieved, but you can find another styled-up copy on BogdanTheGeek's blog. The long story is pretty complicated, but the short and simplified version is that the vape's Arm microcontroller powers the site and an old IP encapsulation protocol over USB delivers the code and uses a virtual terminal to interface with an external computer to get the web server up and running.
Apparently, "almost all USB serial devices actually emulate [dial-up] modems", and you can use the Serial Line Internet Protocol (SLIP) on Linux to send and receive IP packets. They got this SLIP code to use semihosting, which is "basically syscalls for embedded ARM microcontrollers" that is bi-directional.
Once all this was set up and BogdanTheGeek had done a bit of file system modification with Perl, the website was up and running.
Keep up to date with the most important stories and the best deals, as picked by the PC Gamer team.
Initially it was slow, "A simple page took over 20 seconds to load. That’s so bad, it’s actually funny, and I kind of wanted to leave it there."
We might think that slowness is just because of the hardware itself. After some detective work, BogdanTheGeek found that the PUYA ASIC had 24 KiB of flash and 3 KiB of RAM: "The extra flash meant that it was more likely a PY32F002B." The Arm Cortex M0+ in this microcontroller runs at just 24 MHz.
In fact, it turned out that the reason it was slow isn't because of this but because "the first implementation read and wrote a single character at a time … it was serialising the data byte by byte."
But "we have a whopping 3kiB of RAM to play with, so I added a ring buffer to cache reads from the host and feed them into the SLIP poll function. I also split writes in batches to allow for escaping."
The result: "Pings now take 20 ms, no packet loss and a full page loads in about 160 ms. This was using almost all of the RAM, but I could also dial down the sizes of the buffer to have more than enough headroom to run other tasks."
It's certainly a better use for the dead devices than clogging up landfill. So get thinking folks, what tiny sites do you want to host? Oh, and don't vape!

1. Best gaming chair: Secretlab Titan Evo
2. Best gaming desk: Secretlab Magnus Pro XL
3. Best gaming headset: HyperX Cloud Alpha
4. Best gaming keyboard: Asus ROG Strix Scope II 96 Wireless
5. Best gaming mouse: Razer DeathAdder V3 HyperSpeed
6. Best PC controller: Xbox Wireless Controller
7. Best steering wheel: Logitech G Pro Racing Wheel
8. Best microphone: Shure MV6 USB Gaming Microphone
9. Best webcam: Elgato Facecam MK.2

Jacob got his hands on a gaming PC for the first time when he was about 12 years old. He swiftly realised the local PC repair store had ripped him off with his build and vowed never to let another soul build his rig again. With this vow, Jacob the hardware junkie was born. Since then, Jacob's led a double-life as part-hardware geek, part-philosophy nerd, first working as a Hardware Writer for PCGamesN in 2020, then working towards a PhD in Philosophy for a few years while freelancing on the side for sites such as TechRadar, Pocket-lint, and yours truly, PC Gamer. Eventually, he gave up the ruthless mercenary life to join the world's #1 PC Gaming site full-time. It's definitely not an ego thing, he assures us.
You must confirm your public display name before commenting
Please logout and then login again, you will then be prompted to enter your display name.