DIY KVM device for remote-controlling a computer. KVM
stands for Keyboard & Video & Mouse
.
A side system on a rackmount server,
IPMI
in Dell Server
for example.
Unlike the IP-KVM, this project respects VNC protocol.
Just like the MIT license says, no warranty or guarantee.
My dev walkthrough is in WALKTHROUGH.md.
And do NOT use for any illegal purposes.
- Remove OpenCV, see WALKTHROUGH.md for the reason of removal
- Installation script
- Register as a system service
- Start on boot
- VNC authentication
- DES encryption in Golang can NOT directly apply to
VNC Authentication
- Http Basic Auth in web page and API
- DES encryption in Golang can NOT directly apply to
- More effective to calculate the difference between frames
- Balance between the power of SBC and the network efficiency
- Or achieve more support for noVNC, beyond rfc6143
- OTG as keyboard and mouse, see Linux USB Gadget API
- Using a single command to get the frame for
Video
, likev4l2-ctl --device=/dev/video0 --stream-mmap --stream-count=1 --stream-to=- --set-fmt-video="width=640,height=480,pixelformat=MJPG"
NONE of them is sponsored, use them at your own risk!
Essential hardware are:
- A computer that can run Golang
- An old computer
- SBC
- RaspberryPi
- OrangePi
- BTT-Pi
- etc...
- Maybe an Android phone?
HDMI Recorder
, see WALKTHROUGH.md for more details.- Or a
webcam
with an always-on monitor.- I know...this is a stupid way -- pointing a camera to a screen.
- Or a
- Keyboard & Mouse Emulator
- ESP32-S3
- ESP32-S2
- Arduino?
- Some other device that supports USB HID output.
- HID over BLE is not recommended, because it may not work in BIOS.
- Relay and/or delayed relay
SBC
: OrangePi 3 LTS¥241 RMB
≈$34 USD
HDMI Recorder
: hagibis UHC07¥69 RMB
≈$10 USD
⚠️ This device ONLY supports 1920x1080 and 3840x2160.
Keyboard & Mouse
: ESP32-S3- I bought a third-party one of WeAct ESP32 S3 (A) DevKitC 1.
¥52 RMB
≈$7.5 USD
- 5V relay * 2, 5V delayed relay * 1
¥15 RMB
≈$2 USD
- Test Device:
- RaspberryPi 2B
- A Windows computer
- Ubuntu 24.04 x86_64
- Some SD cards.
- Some
USB Type-C2C/C2A
cables. - A
HDMI
cable. - Some power supplies.
It costs about ¥300 RMB
≈ 40 USD
.
Price is for reference only, the actual price may vary.
- Install GO dev kit
sudo apt-get update sudo apt-get install -y wget curl ffmpeg v4l-utils GO_ZIP="go1.23.3.linux-arm64.tar.gz" wget "https://go.dev/dl/$GO_ZIP" sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf "$GO_ZIP"
- Pull this repo
sudo apt-get update sudo apt-get install -y git git clone --depth 1 https://github.com/allape/openkvm.git
- Get noNVC
git clone --depth 1 https://github.com/novnc/noVNC.git # [Optional] You can run noVNC separately python3 -m http.server --directory noVNC/ 8081
- Flash ESP32-S3
- PIO: See WALKTHROUGH.md for the reason of removal
- Arduino
- Open
Perferences
->Additional Board Manager URLs
-> Addhttps://espressif.github.io/arduino-esp32/package_esp32_dev_index.json
- Click HERE for more details
- Open km/esp32s3-arduino/main/main.ino with Arduino IDE
- Select board
ESP32S3 Dev Module
and corresponding port - Click
Upload
- For deployed device, use Arduino CLI to compile and upload firmware
- Here is an example on
Debian
with anESP32-S3
connected to/dev/ttyACM0
cd ~ # command below will install `arduino-cli` at ~/bin curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh echo "export PATH=\$PATH:$HOME/bin" >> ./.bashrc source ./.bashrc arduino-cli config init arduino-cli config add board_manager.additional_urls https://espressif.github.io/arduino-esp32/package_esp32_dev_index.json arduino-cli config set network.proxy "http://localhost:1080" # optional, because arduino-cli may NOT respect http_proxy or https_proxy environment variables arduino-cli core update-index arduino-cli core install esp32:esp32 # this will takes a while... cd openkvm # change to the directory where the project located cd ./km/esp32s3-arduino/main/ arduino-cli compile -b esp32:esp32:esp32s3 . arduino-cli upload . --fqbn esp32:esp32:esp32s3 -p /dev/ttyACM0 # change to your port
- Open
- Run or build repo
cd openkvm go mod download cp kvm.new.toml kvm.toml # Find out serial port dmesg | grep tty # Edit this file to apply your settings vim kvm.toml # Should run with super user privilege sudo go run . #go build -o openkvm . #sudo ./openkvm
- Open browser and go to http://ip:8080/vnc.html, then click
Connect
- Hostname and port may vary depending on your settings
- Open http://ip:8080/ui/button.html to control the relay