Converting a disposable vape into a web server

People have been recycling batteries in disposable vapes for a while, but BogdanTheGeek has gone a lot of further, converting a specific model of disposable vape into a web server.

How is that possible? Vapes have apparently become a bit more sophisticated in recent times, and some integrate an Arm Cortex microcontroller with a USB-C port that can be used to bring a network interface and run a web server.

Disposable vape web server

The specific disposable vape (exact model not provided, but Grok thinks it may be from Bang King. Update: Wrong!) used by BogdanTheGeek features one of the ultra-cheap Puya PY32 microcontrollers, namely a 24 MHz PY32F002B Cortex-M0+ MCU with 3 kB SRAM and 24 kB flash.

The web server hack here involves using the SLIP (Serial Line Internet Protocol) through a /dev/tty device to bring up a network interface, along with uIP lightweight TCP/IP stack. The first implementation was really slow with 1.5s pings, plenty of packet losses, and a web page loading in about 20 seconds. That’s because uIP is designed for resource-constrained microcontrollers and sends data byte-by-byte by default. Since the PY32F0002B MCU has 3KB SRAM, there was some room to implement a ring buffer, which dramatically improved performance. That means 20ms pings, no packet loss, and a 160ms full page load of a minimal web page.

web hosting PY32 vape
Screenshot of webpage hosted on a disposable vape

You’ll find the source code of the semihost-ip implementation on GitHub, and the actual server can be found on ewaste.fka.wtf, which is currently inaccessible due to many people accessing it, but a copy can be found on the Wayback Machine. Vaporware has gotten real!

Via Hackaday

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress. We also use affiliate links in articles to earn commissions if you make a purchase after clicking on those links.

Radxa Orion O6 Armv9 mini-ITX motherboard
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
9 Comments
oldest
newest
Boardcon MINI1126B-P AI vision system-on-module wit Rockchip RV1126B-P SoC