Skip to content

Latest commit

 

History

History
452 lines (375 loc) · 25.7 KB

README.md

File metadata and controls

452 lines (375 loc) · 25.7 KB

Open and cheap DIY IP-KVM based on Raspberry Pi

Discord Reddit

A very simple and fully functional Raspberry Pi-based KVM over IP that you can make with your own hands. This device helps to manage servers or workstations remotely, regardless of the health of the operating system or whether one is installed. You can fix any problem, configure the BIOS, and even reinstall the OS using the virtual CD-ROM or Flash Drive.

The website: pikvm.org. Also join to the Discord Community Chat for news, questions and support!

Features

  • Supported Raspberry Pi 2, 3, 4 and ZeroW;
  • FullHD video using advanced HDMI-to-CSI bridge or USB dongle;
  • Extra low 100ms video latency (for CSI bridge);
  • Bootable Virtual CD-ROM and Flash Drive;
  • USB Keyboard and mouse (with leds and the wheel), PS/2 keyboard;
  • Control the server power using ATX functions;
  • Access via Web UI or VNC;
  • Ability to use IPMI BMC, Redfish and Wake-on-LAN to control the server;
  • The ready-made OS with read-only filesystem;
  • Extensible authorization and SSL encryption;
  • Health monitoring of the Pi;
  • Control GPIO ports and USB relays;
  • It only costs between $30 and $100 for parts!
  • 100% Open Source!
Detailed about the Pi-KVM features

Fully-featured and modern IP-KVM

  • Cheaper, but better than commercial solutions
    Costs between $30 and $100 depending on the features desired. Even the most expensive configuration will be cheaper than a $500 commercial IP-KVM.
  • Easy to build
    A ready-to-use OS that can be created just by running make build and installed to an SD-card using make install. The hardware can be made in half an hour and without soldering.
  • The widest hardware support
    There are many ways to build a Pi-KVM. Video capture devices can be attached using the CSI-2 or USB interfaces. Raspberry Pi models 2, 3, 4, or ZeroW may be used. Any combination of hardware is supported, and Pi-KVM implements the maximum possible set of features.
  • Very low latency
    ~100 milliseconds of video latency. This is the smallest delay of all existing solutions.
  • Extra lightweight and fancy Web UI
    No weird proprietary clients. No ugly Java applets. Just use your favorite browser to connect to the Pi-KVM. No flash plugins either!
  • Keyboard and mouse
    Mouse usage works directly in the browser. The keyboard emulator supports displaying the state of the keyboard LEDs.
  • Mass Storage Drive
    On the Raspberry Pi 4 and ZeroW, Pi-KVM can emulate a virtual CD-ROM or Flash Drive. A live image can be uploaded to boot the attached server.
  • ATX power management
    With a very simple circuit that can be assembled on a breadboard, the power button of the attached server can be controlled using the ATX button headers on the motherboard.
  • Security
    Pi-KVM can be opened to the Internet and no one will get access without the password. SSL encryption is used to protect traffic from being intercepted by third parties.
  • Local monitoring
    Pi-KVM monitors the health of the Raspberry Pi board and will warn you if it's too hot or is not receiving enough power.
  • GPIO management You can control GPIO and USB relays via the web interface. The extensible interface allows you to make anything out of it.

Production-ready

  • Linux-based embedded OS
    The Pi-KVM OS is based on Arch Linux ARM and can be customized for any needs. Thousands of pre-built binary packages are at your service and can be updated with a single command!
  • Read-only filesystem
    By default the OS runs in read-only mode, as an embedded system should. This prevents damage to the memory card due to a sudden power outage.
  • VNC server
    The managed server and its BIOS can be accessed using a regular VNC client which supports JPEG compression.
  • IPMI BMC and Redfish
    Use ipmitool, ipmiutil or any existing network infrastructure that supports IPMI to monitor and manage the server's power. Redfish and redfishtool supported too.
  • Wake-on-LAN
    Pi-KVM can be configured to power up a managed server using WoL. This will be available in the Web menu.
  • Extensible authorization methods
    Multiple Pi-KVMs can be configured to use a common authorization service. PAM and its rich authorization mechanisms can also be used to integrate Pi-KVM into your existing authentication infrastructure.
  • Macro scripts
    If repetitive actions must be perfromed on the attached server (or on several different servers), a macro can be recorded with keyboard & mouse actions and can be played back mutiple times.

Open Source

  • Community & support
    Pi-KVM has a large community. Join the discord chat if you have any questions.
  • Extensible
    Pi-KVM was designed as a set of microservices with a plug-in architecture. It's very easy to modify and maintain.
  • Comprehensive API
    Everything that can be done via the user interface can also be done via a powerful HTTP API.
  • Know-how
    We created our very own MJPG video server written in C with multi-threading support and GPU video encoding - the fastest streaming solution available to provide the best video quality for Pi-KVM. We also tested a lot of hardware configurations so that you can be sure devices you assemble will work reliably.
DIY Device Web UI
drawing drawing

DIY Getting Started

Required hardware

Pi-KVM supports several different hardware configurations, referred to as platforms. Now available: v2 and v0.

  • Recommended: v2 is the most modern implementation for Raspberry Pi 4 and ZeroW supporting all of the features of Pi-KVM including the Mass Storage Drive. It's also the easiest to make
  • v0 was designed to work with Raspberry Pi 2 and 3 that do not have OTG and requires a few more components for a basic implementation. It also does not support the Mass Storage Drive feature.

Hardware for v2

  • Raspberry Pi board:
    • Recommended: Raspberry Pi 4 (2 GB model is enough) for the best pefrormance.
    • ... or Raspberry Pi ZeroW (slower alternative, no ethernet).
  • MicroSD card (min 16 GB recommended).
  • USB-A 3A charger (female socket) or power supply.
  • Video capture device:
  • Only for Raspberry Pi 4: parts for Y-splitter cable (one variant at your choice):
    • Variant #1: DIY for soldering or twist.
      • 1x USB-A to USB-C cable (male-male).
      • 1x another cable USB-A to any (male-any).
    • Variant #2: Ready-made using USB-micro splitter.
    • Variant #3: Ready-made using USB-C splitter.
      • 1x USB-C/Power Splitter Module.
      • 3x USB-A to USB-C cable (male-male).
      • For this option you can buy the official Raspberry Pi Power Supply with USB-C and get rid of one USB-C cable and the USB-A charger.
  • Only for Raspberry Pi ZeroW:
    • 2x USB A-to-micro cables (male-male, for power and keyboard & mouse emulator).
    • 1x Raspberry Pi Zero Camera Cable (if using HDMI to CSI-2 Bridge, but not compatible with Auvidea B101, check pinout).
  • For ATX control (optional):

A few words about HDMI-USB dongle

It's completely supported and Pi-KVM works great with it. But it has some disadvantages compared with recommended HDMI-CSI bridge: USB gives a lot of latency (200ms vs 100ms) and it doesn't support stream compression control (you won't be able to use Pi-KVM in a place with a poor internet connection). It also cannot automatically detect screen resolution. All this is caused by the hardware limitations of the dongle itself. In addition, some users report hardware problems: the dongle may not work in the BIOS or simply stop working after a while. It's a black box, and no one knows what's inside it. If you have problems with it, it will not be possible to fix them.

Hardware for v0

  • Raspberry Pi 2 or 3.
  • MicroSD card (8 GB is enough).
  • USB-A 3A charger (female socket) or power supply.
  • For keyboard & mouse emulator (HID):
    • Arduino Pro Micro (based on an ATMega32u4).
    • Logic level shifter.
    • 1x NPN transistor (almost any NPN transistor: 2n2222 or similar).
    • 1x 390 Ohm resistor.
    • A breadboard and wires.
  • 2x USB A-to-micro cables (male-male, for power and HID).
  • HDMI capture device: see v2 description.
  • ATX control (optional): see v2 description.

Addition

  • If you want to capture VGA from your server instead of HDMI, buy the VGA-to-HDMI converter.
  • Pi-KVM can be powered using PoE, but it is not recommend to use the official PoE HAT: it is unreliable and not compatible with the HDMI bridge. Use any other PoE hat without an I2C fan controller.
  • Don't use random relay modules or random optocouplers! Some relays or optocouplers may not be sensitive enough for the Raspberry Pi, some others may be low-level controlled. Either use relays that are activated by a high logic level, or follow the design provided and buy an OMRON. See details here.
    drawing

The future v3 platform (work in progress)

drawing

We are also currently developing our own HAT for the Raspberry Pi 4. It will have all the features of the v2 platform, including:

  • HDMI capture based on the TC358743 (extra low latency and many features like compression control).
  • OTG Keyboard & mouse; Mass Storage Drive emulation.
  • Ability to simulate "removal and insertion" for USB.
  • Onboard ATX power control.
  • A real-time clock.
  • CISCO-style and USB serial console port (to manage Pi-KVM OS or to connect with the server).
  • Optional AVR-based HID (for some rare and strange motherboards whose BIOS doesn't understand the OTG emulated keyboard).
  • Optional OLED screen to display network status or other desired information.
  • No need for soldering or other assembly. It's a ready-made, reliable board which you can use yourself or provide to your clients.
  • Continued use of Pi-KVM OS - all the software will be fully open.
  • It will cost about $100 - or less, we are working to make it as cheap as possible.

Sounds interesting? Subscribe in this form or join to https://discord.gg/bpmXfz5 and we will let you know when you can purchase the board. Prototypes will be ready in Q4 2020, and pre-orders will be available sooner. If you are considering ordering a wholesale lot, please email to [email protected].


Setting up the hardware

Connecting the video capture

For the HDMI-CSI bridge

Click to show the instructions Insert the flexible flat cable of the HDMI bridge into the narrow white connector on the Raspberry Pi (the closest one to big USB sockets). It is labeled CAMERA. To insert you need to open the connector first. On the Raspberry Pi side you can gently lift the black part up and a little bit sideways:
Opening the MIPI CSI-2 slot on the Raspberry Pi
detailed picture of the MIPI-CSI2 slot

For the HDMI-CSI bridge it depends on the version you bought. Either pull it gently up as on the Raspberry or push it sideways. Make sure that the cable is inserted on the correct side and until it stops, and then push the black latch back. Never connect or disconnect the flat cable from a powered device. This is not Plug-and-Play, and you can damage it. Also use only the cable that was included with the device package, or make sure that the third-party cable has the correct pinout.

HDMI-CSI-2 bridge connected to Raspberry Pi 4
HDMI-CSI-2 bridge connected to Raspberry Pi 4

For the HDMI-USB dongle

Click to show the instructions Connect USB dongle to exactly this port. It is bound in the software so the OS does not confuse the video device with something else.
Raspberry Pi 2 and 3 Raspberry Pi 4
drawing drawing

There are many revisions of the Raspberry Pi boards and you may come across one that we haven't tested. If the binding fails, the device will be available for all ports. Everything will work, but if you use a webcam and Linux mistakes it for a dongle, write to us and we will fix it.

Setting up the v2

Click to show the instructions Here is a diagram shows that how to connect all of the pieces (click to full size).
ATX control board USB splitter cable (only for Raspberry Pi 4)
drawing drawing

Raspberry Pi 4 note: since one USB-C female connector is used to receive power and perform keyboard/mouse/drive emulation a special Y-cable must be made that splits the DATA and POWER lines of USB-C (see reasons). It can be made from two suitable connecting cables, or soldered together from scratch. Be sure to check the circuit diagram below, otherwise you may damage your devices. The appropriate USB pinout(s) can easily be found on Google. Please note that if you make a Y-cable from two no-name cables, the colors of the wires may not match those shown. Use a multimeter to make sure the connections are correct.

See video howtos:

Also check out this small PCB for ATX (if you know how to make PCBs).

Setting up the v0

Click to show the instructions
ATX control board and Arduino HID (keyboard & mouse)
drawing

Installing the OS

Here the final steps. There are two ways to get the Pi-KVM OS:

  • We provide the ready-made images for Raspberry Pi 4 for platforms v2-hdmi (the CSI-2 bridge) and v2-hdmiusb (the USB dongle). Follow these instructions to install the OS quickly.
  • For the other boards and platforms, you need to build the operating system manually. Don't worry, it's very simple! Just follow these instructions. You can also build the OS for RPi4 manually if you really want to :)

You're amazing!

Congratulations! Your Pi-KVM will be available via SSH (ssh root@<addr> with password root by default) and HTTPS (try to open in a browser the URL https://<addr>, the login admin and password admin by default). For HTTPS a self-signed certificate is used by default.

To change the root password use command passwd via SSH or webterm. To change Pi-KVM web password use kvmd-htpasswd set admin. As indicated on the login screen use rw to make the root filesystem writable, before issuing these commands. After making changes, make sure to run the command ro.

Access to Pi-KVM from the Internet

You can use port forwarding for port 443 on your router if it has an external IP address. In all other cases, you can use the excellent free VPN service Tailscale, which is configured on Pi-KVM with a few simple commands.

If you have any problems or questions, contact us using Discord: https://discord.gg/bpmXfz5

Subscribe to our Subreddit to follow news and releases: https://www.reddit.com/r/pikvm

Happy using of Pi-KVM :)


Limitations

  • In very rare cases, some motherboards contain a buggy BIOS that does not understand the keyboard of the v2 platform (bellow). The reason for this is that the BIOS doesn't fully implement the USB HID stack for composite devices correctly. Meanwhile, Mass Storage Drive can be detected. For this case, we suggest using the Arduino HID from the v0 platform with v2. Thus the Pi-KVM will be connected by two USB cables to the motherboard: one of them will be responsible for the keyboard and mouse, the other for everything else. See here.
  • A similar problem can be observed on devices with UEFI: the keyboard works fine, but the mouse does not work. This problem is much less significant, since all UEFI can be configured using the keyboard and hotkeys, without the mouse. If you want to get a mouse, the solution can be the same: using an Arduino HID, as in the advice above.

Our future v3 platform will contain an optional HID module for such cases, so you won't have to build anything yourself.


Tips


Troubleshooting

If you encounter any problems, take a look at this page. We've probably already found a solution for it :)

For any help, you can contact our discord chat: https://discord.gg/bpmXfz5


FAQ

Q: Can I connect multiple servers to a single Pi-KVM?
A: Yes, but it will require additional work to set up. Pi-KVM can be connected to a multi-port HDMI/USB switch and the switch's buttons can be connected via optocouplers to the Pi's GPIO to switch channels. If your KVM switches channels using keyboard shortcuts, there is a chance that it will not be able to work with OTG (v2 platform, see bellow), since it does not fully implement the USB stack. In this case, you will have to use an Arduino board to emulate the keyboard & mouse (Pi-KVM supports this configuration)

Q: Can I use Pi-KVM with non-Raspberry Pi boards?
A: Yes, but you will have to prepare the operating system yourself. As for the Pi-KVM software, you will need to replace some config files (such as UDEV rules). If you are a developer or an experienced system administrator, you will not have any problems with this. In addition, we are open to patches. If you need help with this, please contact us via Discord: https://discord.gg/bpmXfz5


Donate

This project is developed on a non-commercial basis by Open Source enthusiasts. If you find Pi-KVM useful or it has saved you a long trip to check on an unresponsive server, you can support the lead developer by donating a few dollars via Patreon or PayPal. With this money, he will be able to buy new hardware (Raspberry Pi boards and other components) to test and maintain various configurations of Pi-KVM, and generally devote significantly more time to the project. At the bottom of this page are the names of all the people who have helped this project develop with their donations. Our gratitude knows no bounds!

If you wish to use Pi-KVM in production, we accept orders to modify it for your needs or implement custom features you require. Contact us via live chat or email the lead developer at: [email protected]


Special thanks

These kind people donated money to the Pi-KVM project and supported work on it. We are very grateful for their help, and commemorating their names is the least we can do in return.

  • Aleksei Brusianskii
  • Alucard
  • Andrzej V
  • Anton Kovalenko
  • Aron Perelman
  • Arthur Woimbée
  • Augusto Becciu
  • baddog
  • Bao Tin Hoang
  • Ben Gordon
  • Branden Shaulis
  • Brian White
  • Bruno Gomes
  • Bryan Adams
  • Carl Mercier
  • Christian Schlögl
  • Christof Maluck
  • Christoffer Lund
  • Corey Lista
  • Clifford Coleman
  • Clinton Lee Taylor
  • David Howell
  • Denis Andreev
  • Denis Yatsenko
  • Dmitry Shilov
  • Eric Phenix
  • Fergus McKay
  • Foamy
  • Fredrik Idréus
  • Ge Men
  • Grey Cynic
  • Guido Bernacchi
  • Heikki Tiittanen
  • HimKo
  • Ivan Shapovalov
  • Jacob Morgan
  • Jan Niehusmann
  • Jari Hiltunen
  • Jason Toland
  • Jeff Bowman
  • Jennifer Rowlett
  • Joachim Bruening
  • John Kelley
  • John McGovern
  • Jonathan Vaughn
  • Josh Ricker
  • Jordi Pakey-Rodriguez
  • Jozef Riha
  • Justin Waters
  • Krzysztof Żelaśkiewicz
  • Lukas Söder
  • Malcolm Cameron
  • Mark Gilbert
  • Mark Robinson
  • Markus Sobczack
  • Martin Gasser
  • Mauricio Allende
  • Mehmet Aydoğdu
  • Michael Kovacs
  • Michael Lynch
  • Morgan Helton
  • Nicholas Jeppson
  • Nils Orbat
  • Nithin Philips
  • Nod Swal
  • nybble
  • pozitron03
  • Ranc1d
  • Robin Gfatter
  • Samed Ozoglu
  • Scott
  • Scott Spicola
  • Sergey Lukjanov
  • Stefan Müller
  • Stefan Stemmer
  • Steve Ovens
  • Steven Richter
  • Tejun Heo
  • Truman Kilen
  • Walter_Ego
  • YURI LEE
  • zgen
  • Zsombor Vari