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:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

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

9 Replies to “Converting a disposable vape into a web server”

    1. Bogden’s a good hacker and a nice guy as well. Definately check out his github. He’s been doing a lot of good ch32fun work recently.

  1. Small correction, the 20s and 160ms were for very simple html pages. The full article version took 1s for the html and ~2s for the image. Also Grok is wrong, as always.

    1. Its wrong, but I am not seeing what brand/model of vape it is actually? Though maybe just get people to donate me their old vapes and go down the same rabbit hole?

      Next to put together a cluster of these?

Leave a Reply

Your email address will not be published. Required fields are marked *

Boardcon MINI1126B-P AI vision system-on-module wit Rockchip RV1126B-P SoC
Boardcon MINI1126B-P AI vision system-on-module wit Rockchip RV1126B-P SoC