Discarded vapes are becoming the new cigarette butts in pollution terms, but a hacker has found a novel way to repurpose the chips they contain to build a web server.
BogdanTheGeek, the handle for researcher Bogdan Ionescu, took apart a discarded vape pen, which he describes as "fancier pacifiers for adults," and decided to repurpose it. The base-level kit was "so bad, it's basically disposable" he said, consisting of a 24MHz Cortex M0+ chip, 24KB of flash storage and just 3KB of static RAM, but it was still workable.
"You may look at those specs and think that it’s not much to work with," he reported.
"I don’t blame you, a 10y old phone can barely load Google, and this is about 100x slower. I, on the other hand, see a blazingly fast web server."
Well, maybe not so blazingly fast - at least at first. For a start, the main chip was labeled as a PUYA C642F15 processor, but Ionescu figured it was actually a PY32F002B chip. It's capable of handling the old Serial Line Internet Protocol (SLIP), so he turned it into a very basic 56K modem equivalent.
He then added uIP 0.9 code to allow the chip to serve as a web server, making a number of tweaks along the way like changing the file structure.
Initially the results weren't good. "Pings took ~1.5s with 50 percent packet loss and 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," Ionescu wrote. Adding a ring buffer helped a lot, however, in increasing speeds - although testing showed it can't handle a large volume of requests. Now, pings take 20ms with no packet loss and a full page loads in about 160ms.
Ionescu published the source code for anyone who wants to try it at home. The website hosted on the controller explaining the hack is live, albeit still very slow, but it works if not too many people try to log on. You can see a copy on a more reliable server here.
The case highlights what can be done with so-called disposable kit. A 2023 UK study by the University of Oxford and the Faraday Foundation found that 1.3 million of the devices were thrown away each week, and reusing them in any format can't be a bad idea, not least since the batteries are perfectly capable of handling processing long after the addictive drug has been smoked.
- After deleting a web server, I started checking what I typed before hitting 'Enter'
- After 30 years PHP still evolving: Team adds pipe operator, considers generics
- Pitch of the week: Helping to stamp out e-cigarettes while removing hurdles to digital learning
"The popularity in single-use vapes has exploded in recent years. Despite being sold as disposable, our research has shown that the lithium-ion batteries stored within them are capable of being charged and discharged over 450 times," said Hamish Reid, first author of the study.
While no one's going to run a web server like this on a battery, the reprogramming shows just what can be done with processors we're throwing away - hardware that would have been very valuable 30 or so years ago. All credit to Ionescu for showing how it's done. ®
