The PiKVM Project and Lessons Learned: Q&A with Maxim Devaev
PiKVM software is a Raspberry Pi 4-powered tool for remotely accessing a PC, server, or other machine over a network connection. PiKVM developer Maxim Devaev shares his thoughts about the project and more.
What Is PiKVM?
The PiKVM software makes it possible to turn a Raspberry Pi 4 into an inexpensive remote control for other computers. Locally, the Raspberry Pi is connected to the computer to be controlled. It grabs the monitor image and emulates a USB mouse, keyboard and flash drive. The signals are then made accessible via the Internet by the PiKVM software running on the Raspberry Pi — all that is needed on the side of the controlling computer is a web browser. The PiKVM project (UI shown in Figure 1) is open-source and the cost of the required hardware is less than €100 for the DIY version, a fraction of commercial products. This raises a few questions that we put to the developer of the PiKVM, Maxim Deveav.
The Idea
Claußen: Let’s begin with your background. Tell us about how you became interested in electronics. Did you study at university?
Devaev: Sure, but it would be wrong to call me an electronic specialist. I know how to hold a soldering iron, of course, and I can design a simple wiring diagram and assemble it without burning the whole thing. But I’m mainly a software engineer. Electronics is my secondary and far less developed skill.
I became interested in technics when I was a child and I have been reading a lot of different science and tech literature since. Getting my first PC affected the contents of my bookshelves a lot, of course, as they became much heavier with all the computer science books.
A couple years later, when it was time for me to choose university, I went for information security, but abandoned shortly after, as the curriculum disappointed me. Russian higher education is very formal: it’s often more important that you don’t fail the dozen accompanying humanitarian subjects.
So, I took the self-education route and got a job as a software developer. I worked, I worked, I worked, I improved, and some time later I landed in Yandex (Russian Google of sorts). There I settled down for nine whole years. I was developing distributed systems, solving big infrastructure monitoring and management problems and all that jazz. It might not be the most interesting thing, but it is what it is.
Claußen: How did you come up with the idea to start the PiKVM project?
Devaev: It’s a funny story, actually. One time I went to visit my parents 1400 kilometers from home. My home server, which I always keep on, died as I was eating my mom’s cake. I was annoyed and had to ask my friend to go to my place and reboot it, and decided to buy a KVM over IP after that. I went online, and saw … $500? Seriously? What’s in that thing to cost $500? And then I read some reviews and realized that those $500 get you an overpriced piece of hardware paired with awful buggy proprietary software with licensing restrictions. And there were no good devices on the market: they were all equally bad. I don’t know what got me, but I decided I was not going to pay that amount of money as a matter of principle. If you want something good, do it yourself. And the rest is history.
Claußen: Why did you use a Raspberry Pi for the project?
Devaev: Raspberry Pi just came in handy. It was fresh to the market and was a perfect fit for a small embedded system. Basically it could have been any other ARM computer, but the price, prevalence and great manufacturer support played a crucial role. I didn’t want to spend any time debugging noname devices, creating custom kernels, etc. — so, Raspberry Pi allowed me to focus on my task.
Besides Raspberry Pi, I needed a video capture device and a way to emulate a keyboard (no mouse in mind at that point). At that time, there was no cheap VGA capture devices on the market, so I went for a little hack: I used an RCA-USB dongle that was usually used to digitise old VHS tapes, and fed analog video from a cheap VGA-RCA converter (Editor’s note: see Figure 2). Video quality was horrible but good enough to set up BIOS and use a console. As for the keyboard, I bought a PS/2 to USB converter and emulated PS/2 signals using GPIO. It was cheap, primitive, but it worked. Eventually, I threw all this hardware away and went for a popular HDMI bridge for video and switched my PS/2 converter for an Arduino with custom software.
Claußen: How did the appearance of the Raspberry Pi 4 influence the project?
Devaev: Besides better performance and a way to improve video quality, Pi 4 had two USB controllers. I could use one to emulate a keyboard and a mouse on kernel level which allowed me to ditch the Arduino. I also managed to build a virtual CD drive so I could remotely reinstall an OS on the server. It was a moment when PiKVM came before most of the existing commercial devices in price and functionality.
Claußen: Did you start the PiKVM as a part-time project or hobby?
Devaev: It was a pet project of sorts. I enjoyed doing it, humouring my perfectionism. I never thought anyone besides me would need it until I stumbled upon a similar half-abandoned project on GitHub (DIY-IPMI). Its author had followed the same route, but they dropped it on the proof-of-concept stage. I became excited. I began advertising my project and committing like crazy, solving one issue after another, adding more and more features and spending thousands of hours on the project. It was great to see how many people began using my software. I had been developing only small utility scripts or heavy enterprise software before.
Lessons Learned
Claußen: Are there lessons learned from this project that you would like to share with other developers?
Devaev: Okay, here’s a story. Web interface is a main way to use PiKVM, but there’s a self-developed VNC server as an alternative. That’s cool, right — use a VNC client to set up BIOS! I used MJPEG to transfer video both for web and VNC. It’s a simple but very bandwidth-ineffective format. For the browser, I could use H.264 and WebRTC, but for VNC there was no way to use full-fledged differential encoding.
I manned up and wrote to the RFBProto (de facto VNC standard description) and TigerVNC repository maintainer with a proposal: let’s create new encoding, it would be great for users with low bandwidth. We discussed details for a long time and finally came up with a format that suited us all. Then I went to IANA and asked them to register this new VNC extension. I was worried they would say no, as they already had a registered format with no description, but they went for it and explained that it was legacy from a proprietary client. Lo and behold, we’re developing an official TigerVNC patch for a first ever open source H.264 over VNC extension. The beta version is running smoothly! It might be very new, but some VNC clients and servers are already interested in implementing it.
The moral of the story is: Don’t be afraid to communicate with other projects, even if they seem monumental. And one other thing: even one person can push forward development of the whole protocol; you just have to dream big.
Claußen: Did the appearance of the 10$-USB-HDMI dongle help to push the PiKVM project?
Devaev: It depends. Before the USB dongle I used an HDMI-CSI-bridge (Figure 3) that had many advantages.
Surely, the USB dongle (Figure 4) played a big role in popularising PiKVM as it was really cheap, but I always advised against using it due to hardware problems: it’s not very stable.
Many people reported buying it and regretting afterwards, as they often saw a blank screen and couldn’t do anything about it. A USB dongle is a black box: you have no idea how it works, and if something goes wrong, you can’t fix it. The bridge, on the other hand, is much more open and almost all video processing is done by the kernel and my software.
Claußen: The PiKVM is an open-source project that can (currently) be used free of charge. How is its development financed? You now seem to work full time on the project.
Devaev: I would lie if I said I had a long-term vision, a plan and understanding of the market. It all started last year, when I quit my job to take a break and to think about my career. I continued working on PiKVM as a hobby. The community was growing and I thought it would be great if PiKVM became my main job, and I’ve seen some open-source projects whose authors made a living at it. It was a win-win situation: I would be doing what was really interesting to me, and users would get high quality software for a small donation. As a test, I set up Patreon and announced I was accepting donations now, as I was now without a job and ready to improve PiKVM upon request (in case you needed a certain feature quickly). To my surprise, several months later, I began making some profit. It was way less than my previous salary, but considering I stopped spending money on trips to the office, started getting enough sleep, and even lost some weight, it was a fair trade. Users were also happy, as it could now be half an hour between finding a critical bug and a fix, and I was adding new features in a matter of days.
Claußen: How is the community supporting your project besides helping you to afford full-time development?
Devaev: I’m not very good at writing documentation, so many people help me with that. Some write recipes and scripts, come up with and describe new ways to use some of the PiKVM features. Some create bug reports and give me remote access to their hardware for me to debug problems. And the most important thing of all: when the number of users became really big, it became impossible to reply to every single person on Discord, so active users helped me onboard new users and now only reach out to me when they can’t solve a problem themselves. I’m very thankful for those people, as I can now dedicate all my time to writing software.
Sometimes there are people who bring in patches with new features or bug fixes, but there are not many of those people yet, and I’m virtually the only PiKVM developer at the moment. I’m planning to hire some people to help me with software full-time when we start selling devices. So if you buy our hardware, you will sponsor the development of open source software.
Claußen: If someone likes to support your work, what would be the best way in doing that?
Devaev: Besides donations, help is appreciated with things we can’t handle on our own yet. Some of those problems are outlined in our GitHub issues.
Claußen: Are there any plans to commercialize your work?
Devaev: Right now my main source of income are donations. I’m often told I could sell a commercial license to the PiKVM software with advanced features, but I don’t want to do that for two reasons. Firstly, PiKVM has direct access to the hardware and I wouldn’t trust such a thing if it wasn’t open source. Secondly, a paywall would inevitably lead to someone forking your open software and developing pro features for free, getting part of your community to themselves.
The other way to monetize, which will soon become primary, is selling my own hardware (PiKVM v3 HAT) (Figure 5]), you can use instead of that DIY version to get more stability and additional hardware features. But I don’t plan to abandon PiKVM DIY and force users to buy the v3. I don’t pursue wealth at any cost, just enough money to feed me and my cat.
Claußen: Can you tell us a bit about your hardware, the PiKVM v3 HAT?
Devaev: To DIY a PiKVM, you have to use your hands and optionally a soldering iron. I decided to make it a bit easier for the user, as well as to improve hardware stability of this version and add some features that are hard to DIY. Although I came up with the original concept of the device, I couldn’t develop a completely custom board (this is a separate magic that I don’t own), so I invited my friend with hardware skills to work with me on this project. Our PiKVM v3 HAT has a built-in server power controller, a video capture device, a USB switch (to emulate plugging a cable out, it’s sometimes useful), and a serial port (to connect to a server or console in a rack), clock for precise logging — all on one board. Basically, it’s a solution that’s better and cheaper than all the $500 ones you have on the market. You don’t have to take my word on it: you can look up v3 reviews on YouTube. And soon everyone will be able to buy it.
Claußen: Also, you have an enclosure for the Raspberry Pi 4 and your add-on — that is made from metal. Was there a reason not to use plastic? We read on Discord that it is easier to build in Russia something out of metal than rubber or plastic.
Devaev: That’s true. The metal enclosure came out more heavy, sturdy and much cheaper than a plastic one. Those who ordered v3 HAT on Kickstarter could get this case for free. Then it will be sold in online stores. And we also have a free drawing of the case for 3D printing, if you like to work with your hands.
Claußen: Will your kit be available for customers to be ordered from stores outside of Russia?
Devaev: The first batch should be available in the USA shortly. The second batch will be available worldwide in autumn 2021.
PiKVM and the Future
Claußen: What plans for the PiKVM do you have for the future?
Devaev: We will continue developing both software and hardware. We plan to implement 1080p 60Hz capture (you can’t do that now due to Pi 4 restrictions) and create a secure solution for cloud access for users without an open external IP address.
Claußen: Do you have any other projects in development? Can you share some details about what you are working on?
Devaev: uStreamer, I guess. It was created for PiKVM, but it’s a totally separate component many people use as a server for webcam video. (It’s used as a capture device in PiKVM.) I wrote it from scratch as an alternative to MJPG-Streamer to fix the performance problem. Now uStreamer is the fastest specialised MJPEG/H.264 video service, and I’m really proud of that.
Claußen: Maxim Deveav, thank you for the interview. Those who are now heading to the Kickstarter campaign, we have some good news. The campain was more than successful. This means you will be able to order the PiKVM v3 HAT in an online store soon. Also have a look at the Elektor Store as our purchase team is currently working to be able to offer you also some PiKVM v3 HATs in the near future.
Questions About PiKVM or this Interview?
Do you have technical questions or comments about this article? Email the author at mathias.claussen@elektor.com or contact Elektor at editor@elektor.com.