Below is an interview between Shawn (asking the questions) and Dr. James Adam (who patiently answered all the questions), the wizard behind our magical network printer.
How does this printer work? (Please, for the sake of my children, explain it to me like I'm a sixth grader...)
There are three parts that make this work: the printer, a small computer, and some software running “in the cloud” called “the printer server.”
The printer is the simplest part. It’s a thermal printer, like the ones that print your receipts in shops. It doesn't need any ink; by moving the thermal paper over a bank of wires as they heat and cool, we can “print” dots line-by-line, and these combine to make an image.
The “printer server” is what takes your drawing on the web and turns it into instructions for that printer. It does this by loading your drawing using a virtual web browser, and then taking a screenshot of that “webpage", and then turning that into a series of lines of on/off dots that the printer can understand. This means that anything we can make using HTML and CSS, we can pretty easily send to the printer. It’s quite an elegant approach.
The small computer acts as the glue between the physical printer and the printer server in the cloud. There’s a very simple program asking the server for any new print data, and if there is something new to print, the computer downloads that data and sends it over some wires (in technical lingo, a “serial” connection) to the printer itself.
And that’s all there is to it.
And how did you set up the live feed?
The live feed works by connecting a camera to the small computer, and using a few very amazing software tools (libcamera-vid and ffmpeg, specifically), which I only barely understand, to take video from that camera and stream it up to the internet.
It streams to YouTube in our case, and then YouTube takes care of making sure that when 100 people try to watch at the same time, that it doesn’t overwhelm our little computer.
In terms of the actual hardware, it’s using a Raspberry Pi Camera Module 3, because I couldn’t get any “normal” webcams to reliably focus on the paper. That’s being held in place by a little camera tripod, along side a little LED light source to keep the paper visible when it’s dark.
Where did you learn such awesomeness?
The printer server and everything associated with it, I learned how to build out of sheer stubbornness. In a previous job we’d used a much much simpler printer system to let people text a phone number and see it printed out, but it was a terrible hack and I really wanted to “finish” it by making something more robust and flexible. And then I spent many many weekends one summer bashing stuff together until I understood it. This guestbook is built on top of that “finished” project.
And finally, who do you identify with more: Dr. Strange or Ironman?
How about: Dr Strangelove?