Urgent.News

What's breaking now, across hundreds of outlets.

Tech

How to build a printer

Article URL: https://nishantjosh.dev/blogs/how-to-build-a-fking-printer/ Comments URL: https://news.ycombinator.com/item?id=49617255 Points: 307 # Comments: 59

In a quest to create an e-ink display, the author stumbled upon the Xteink X3, which could be programmed. The device's flat appearance and solid feel in hand intrigued the author. They began modifying the CrossPoint firmware, adding features such as a different boot animation, a dice-rolling function, and a LinkedIn QR code for networking events.

However, uploading files to the device was inconvenient, requiring the use of its hotspot and an upload website in a browser. The author then thought, "If it looks like paper, it should act like paper." They aimed to open files on their MacBook, press Print, and have the Xteink print them. To achieve this, they delved into the Internet Printing Protocol (IPP), which enables computers to interact with printers.

The IPP messages travel over HTTP, and the author advertised monochrome output, 300 dpi, one copy, and one-sided printing. They accepted Apple raster and PWG raster document formats, allowing the Mac to convert documents into pixels before sending them. The printer was named "penguin" and advertised an output bin called face-up.

Using Bonjour, the author announced an _ipp._tcp service under this name, including the accepted formats and the address for print jobs. To enable driverless discovery on macOS, the author added the _universal subtype_ using the ESP-IDF's mDNS API. With the computer ready to send pages, the author had to ensure the Xteink could receive them.

A Letter page at 300 dpi is 2,550 × 3,300 pixels, about 8.4 MB uncompressed. The Xteink has 400 KB of RAM, with 16 KB reserved for cache. To handle the incoming pages, the author considered using Wi-Fi, a printer server, and memory-mapping the SD card as if it were RAM. By passing the incoming page through a transformation pipeline and writing the result directly to the display, the author could create the page as it arrived.

The display had RAM reserved for its screen image, allowing the author to build the page right there. The author saved the finished page as a BMP on the SD card, freeing up the network stack for socket buffers. The first printout, a manga image from Mushoku Tensei, appeared on the Xteink within a second. The printer server runs on the reader itself, allowing for Wi-Fi network joining or hotspot creation, and saved printouts can be browsed on the reader. The author's printer even has an output tray, functioning as an actual print tray.

Rewritten by urgent.news; may contain errors — check the original.

Source: nishantjosh.dev

This story

This is one outlet's version. Read the fullest account.

Every outlet that reported this, and when →

Read the original at nishantjosh.dev →

Report a problem with this story

More in Tech

More from Tuesday 8 September →