Engineer uses microchip from e-cigarette for mini web server

E-cigarettes contain microchips that can do more than just control a vaporiser. One hobbyist built a mini web server out of one of them.

listen Print view
VapeServer Electronics

The electronics of an e-cigarette become a mini web server.

(Image: Bogdan Ionescu/Screenshot)

2 min. read

Romanian engineer and origami artist Bogdan Ionescu, who goes by the name BogdanTheGeek on YouTube, has converted the vaporizer electronics of an e-cigarette into a mini web server called VapeServer, as revealed in a blog post. At 20 KB, the web server only has a small amount of memory and quickly reaches its limits when it comes to web queries.

Ionescu collected old batteries from e-cigarettes for his craft projects. He noticed that the e-cigarettes contained increasingly specialized models with advanced microcontrollers.

One of the cigarettes contained the PUYA C642F15 chip. This is a 24 MHz ARM Cortex M0+ processor. The chip contains 24 KB of flash memory and 3 KB of RAM. Taken together, this basic configuration is not particularly powerful, but Ionescu wanted to find out whether it was possible to build a small web server from it.

As a basis, he built a 56K modem from the chip by implementing the Serial Line Internet Protocol (SLIP) in order to be able to establish a network connection. To enable TCP/IP communication and web services, the engineer added the uIP 0.9 TCP/IP Network Protocol Stack, which had originally been developed for small 8- and 16-bit microcontrollers.

At first, the result was disappointing. Pings lasting around 1.5 seconds with packet losses of 50 percent initially caused frustration for Ionescu. Loading a website was also slow and sometimes took more than 20 seconds. The hobbyist then improved performance by storing data in a ring buffer of a fixed size. This and code optimizations enabled him to reduce pings to 20 ms without any packet loss. A small website can thus be loaded in around 160 ms.

Videos by heise

To test the mini web server, Ionescu provided a copy of the blog post on the converted e-cigarette. The blog post was compressed so that it fits into the 20 KB memory. However, it usually takes a few seconds to retrieve the website. Sometimes the server also fails due to overload and only displays a "503" error page. This can be assumed as soon as this article goes online and the VapeServer is then tested en masse.

Ionescu provides the source code of his VapeServer on GitHub.

(olb)

Don't miss any news – follow us on Facebook, LinkedIn or Mastodon.

This article was originally published in German. It was translated with technical assistance and editorially reviewed before publication.