Host a web page on a disposable e-cigarette



Engineer

Bogdan Ionescu has successfully created a web server on a disposable e-cigarette and hosted a web page on it.

Hosting a WebSite on a Disposable Vape :: BogdanTheGeek's Blog
https://bogdanthegeek.github.io/blog/projects/vapeserver/



Ionescu has been collecting disposable e-cigarettes from friends and family for the past few years. Initially, he collected them to collect batteries. However, Ionescu points out that disposable e-cigarettes have evolved rapidly in recent years, with devices now equipped with USB-C ports.

So, Ionescu disassembled the disposable e-cigarette and discovered that the integrated circuit was not an application-specific integrated circuit (ASIC), but a small integrated circuit stamped 'PUYA.' Ionescu wrote, 'Most people have probably never heard of this name.'

According to Ionescu, PUYA is 'a very high-performance, small-sized microcontroller, best known for its flash chips.' PUYA's official website states that the company is a Chinese supplier of low-power, non-volatile memory chips, founded in 2016.

Ionescu revealed that he first learned about PUYA from a blog run by Jay Carlson, a systems architect specializing in ultra-compact electronic devices.



According to Ionescu, over the past year he has collected a significant number of disposable e-cigarettes equipped with integrated circuits based on PUYA's PY32 microcomputer. They were all different models from the same manufacturer, but he declined to reveal the exact brand names, saying, 'It is not my role to promote cigarette manufacturers, so I will not disclose the brand names.'

This PY32-based microcomputer is apparently engraved with 'PUYA C642F15,' but searching for what appears to be this model number yielded little information about the microcomputer's specifications. However, a search using '

pyOCD ' revealed that the flash memory is '24KiB' and the memory (RAM) is '3KiB.' Ionescu points out that the '24KiB' flash memory makes it highly likely that the microcomputer is 'PY32F002B.'

The PY32F002B's CPU isa Cortex-M0+ with a clock speed of 24MHz, 24KiB of flash storage, and 3KiB of SRAM . Ionescu describes these specs as, 'A smartphone from 10 years ago could barely load Google, but this microcomputer is 100 times slower.'



Ionescu was exploring what he could do with such a microcomputer and came up with the idea of using it to host a web server.

Back in the days before Wi-Fi and Ethernet, you had to use a dial-up modem to connect to the internet. Almost all USB-to-serial devices actually emulate a dial-up modem, and data to and from the modem was transferred using a protocol called

SLIP .

Linux supports SLIP at the time of writing, so you can send and receive any IP packet using the slattach utility. All you need to do is send the data to the network in the right format and set up a virtual terminal. The microcomputer in the disposable e-cigarette can also forward all semihosting via the telnet port.

Semihosting allows the microcomputer in a disposable e-cigarette to be used as a 'modem.' However, this does not make it a web server. To communicate via TCP/IP , an IP stack is required. Therefore, Ionescu used ' uIP ' as the IP stack. Ionescu chose uIP because it has a small file size, does not require an RTOS , and is easily ported to other platforms. Ionescu wrote that by adapting the SLIP code to semihosting, 'the web server ran in half the time.'



Initially, the web server running on the microcomputer in the disposable e-cigarette experienced a ping time of about 1.5 seconds, packet loss of 50%, and simple page load times of over 20 seconds. However, by adapting the SLIP code to semihosting, the ping time dropped to 20 milliseconds, packet loss was eliminated, and the entire page loaded in about 160 milliseconds.

In addition, the web page actually hosted on the web server set up on the disposable e-cigarette can be viewed from the following. However, at the time of writing, a 504 error was displayed and it could not be displayed correctly.

504 Gateway Timeout
http://ewaste.fka.wtf/

On the social message board Hacker News , the name of a 'cheap, high-performance microcomputer' that looks like a disposable e-cigarette has been mentioned, and some people have suggested that the dongle ' UZ801 4G LTE ', which can be purchased for just $4 to $5 (about 590 to 740 yen), could be used to create a complete Linux machine with Wi-Fi and 4G.

in Hardware, Posted by logu_ii