A simple switch of computer consoles on a transistor and a relay (KVM Switch). Full control - KVM over IP switches

Nokia 31.07.2021
Nokia

And so let's get started, for the firmware you will need a utility from the manufacturer called Flip. Download, install, run and here we have the program window:

At first, the buttons (daws) are not active, this is normal, we connect the arduino to the computer and close it - we open the two extreme contacts from the USB port side, RESET and GND.

A new device should appear in the system called, oddly enough, ATmega16u2 install the driver (in the folder with the program), select the “Settings” > “Communication” > “USB” > “open” tab in the flip program, the buttons should become active. Just in case, you can make a backup of the firmware so that you can return everything to its place. In the “File” menu, click “Load HEX File”, the program is demanding on paths, it is best to put the firmware file in the root of the C: drive, select the desired hex file with the firmware, check whether the “Erase”, “Program”, “Verify” checkboxes are and click "Run". We disconnect - we connect arduino and voila ... Now we will no longer be able to upload firmware to arduino via the built-in USB, but we got an excellent keyboard without buttons.

Don't worry about the arduino firmware, it will be possible to download the firmware from the Arduino IDE via a separate USB To TTL adapter, although I must say this will be less convenient now.

We connect the USB To TTL adapter, for example this one:

We will need White, green and black contacts, these are RX, TX and GND, respectively, we connect them to pins with the same designations on the arduino, only vice versa RX to TX, and TX to RX. The red contact must not be used!

We connect USB To TTL to the computer, install the drivers, a new COM Port should appear in the device manager. Open the arduino IDE and set: Board - Arduino / Genuino Uno, Port - our newly minted serial port.

Getting Started with Arduino Firmware

Let's add the required library to the arduino IDE: Follow the link github.com/SFE-Chris/UNO-HIDKeyboard-Library and click "Clone or download" > "Download ZIP". then in the arduino IDE, select the "Sketch" tab > "Include Library" > "Add .ZIP Library" and select the zip archive you just downloaded.

Preparation is over, go directly to the firmware. Copying my writing:

Arduino - Sketch

#include HID Keyboard; int collection; void setup() ( keyboard.begin(); ) void loop() ( while (Serial.available()) (//start loop when data is available sbor += Serial.read();//read data, add in decimal in the form if (sbor == 27)(//the appearance of the character of the control sequence for (int i=0; i<=4; i++){//сложение последовательности if (sbor == 165) {//для определения F1-F12 на разных терминалах могут быть разные значения sbor += sbor; } sbor += Serial.read(); delay(1); } } } if (sbor >0) ( //jump on the decimal sum of the sequence switch (sbor)( case 505: keyboard.pressSpecialKey(F1); break; case 506: keyboard.pressSpecialKey(F2); break; case 507: keyboard.pressSpecialKey(F3); break ;case 508: keyboard.pressSpecialKey(F4);break;case 509: keyboard.pressSpecialKey(F5);break;case 511: keyboard.pressSpecialKey(F6);break;case 512: keyboard.pressSpecialKey(F7);break;case 513: keyboard.pressSpecialKey(F8); break; case 340: keyboard.pressSpecialKey(F9); break; case 341: keyboard.pressSpecialKey(F10); break; case 343: keyboard.pressSpecialKey(F11); break; case 344: keyboard.pressSpecialKey(F12); break; case 13: keyboard.pressSpecialKey(ENTER); break; case 22: keyboard.pressSpecialKey(ESCAPE); break; case 127: keyboard.pressSpecialKey(BACKSPACE); break; case 9: keyboard. pressSpecialKey(TAB); break; case 32: keyboard.pressSpecialKey(SPACEBAR); break; case 26: keyboard.pressSpecialKey(PAUSE); break; case 292: keyboard.pressSpecialKey(INSERT); break; case 456: keyboard.pressSpecialKey(HOME); break; case 295: keyboard.pressSpecialKey(PAGEUP); break; case 294: keyboard.pressSpecialKey(END); break; case 296: keyboard.pressSpecialKey(PAGEDOWN); break; case 182: keyboard.pressSpecialKey(RIGHTARROW); break; case 183: keyboard.pressSpecialKey(LEFTARROW); break; case 181: keyboard.pressSpecialKey(DOWNARROW); break; case 180: keyboard.pressSpecialKey(UPARROW); break; case 293: keyboard.pressSpecialKey(DELETE); break; case 320: keyboard.pressSpecialKey((CTRL | ALT), DELETE); break; //press alt + del to call ctl+alt+del case 346: keyboard.pressSpecialKey(ALT, F4); break; //to call alt+f4 press shift + F4 default: keyboard.pressKey(sbor); break; ) //Serial.println(sbor);//only for debugging without connecting to usb keyboard.releaseKey(); collection = NULL; ) )


paste it into arduino IDE and press the check button. Now the most crucial stage will begin, the most important thing here is to catch the moment, few people succeed the first time. We press the download button in the arduino IDE, first the white lines with the compilation log will run, followed by the orange ones, this is already establishing a connection to the serial port, this is the very moment you need to catch and have time to press the RESET button on the arduino board. The firmware should be loaded, if everything is successful you will see an inscription like this

Avrdude: reading on-chip flash data: Reading | ################################################### | 100% 0.34s avrdude: verifying ... avrdude: 2934 bytes of flash verified avrdude done. thank you.
If, after several attempts, the firmware still does not load, try swapping the RX and TX pins, and also check if the GND pin is connected securely.

finish line

Open the console on raspberry and write:

sudo raspi-config
The Raspberry setup menu will open, choose Advanced Options > Serial and choose No.

Perhaps these manipulations will not be needed, so reinsurance. This parameter determines whether the raspberry OS will interact with the serial port, this interaction is needed mainly for debugging, so feel free to turn it off, it will only interfere with us, because. we will communicate with the arduino through this port, and the system will clog the air.

Install the minicom program.

Minicom is a simple program for working with a serial port.

sudo apt-get install minicom -y
We set the rights to access the device, / dev / ttyAMA0 - this is the same serial port.

sudo chown pi /dev/ttyAMA0 sudo chmod 744 /dev/ttyAMA0
Start minicom:

Sudo minicom -s
The program menu will open, select the “Serial port setup” item, another menu will open, select “Serial Device” by pressing the A key, write / dev / ttyAMA0, press Enter, then select the Bps / Par / Bits item under the letter E, another one appears menu press C and Q line Current: should look like this "9600 8N1" press Enter. Make sure that in the lines F - Hardware Flow Control: and G - Software Flow Control: is No, in general, everything should be like in the screenshot below, press Enter.

Save these settings as default "Save setup as dfl" and close "Exit from Minicom".

Connection

We go further, now we have almost everything ready, it remains only to connect the arduino to the serial port of the raspberry, something like this:

There is one point here, arduino and raspberry have different voltage levels and, in theory, they need to be coordinated, I advise you to read the article.

Although everything worked for me directly without coordination, you should not imitate a bad example and purchase a logic level converter, the simplest one looks like this:

Or at least assemble a voltage divider on resistors.

launch

Everything is ready, you can start.

We check all connections, turn on the raspberry pi, go to the raspberry console, start minicom. I’ll make a reservation right away, I connected to the raspberry via ssh, I used KiTTY (a modified version of PuTTY) as a client, this is important. with other terminals, the values ​​of the transmitted keys may be different and, accordingly, it will be necessary to make an allowance for the wind - change the number of the switch case transition.

In general, I hand over to you as they say "as is". Well, I’ll probably finish with this, the homemade IP KVM is ready.

P.S.

Finally, I will describe what happened in the dry residue.

Pros:

- Price
- The device turned out to be relatively inexpensive
- Raspberry Pi: about 2700 rubles.
- Arduino UNO: about 400 rubles.
- VGA to AV converter: about 700 rubles.
- Video capture card: 500 rub.
- Total: 4300 rub.

- Fine tuning
You can intercept almost any combinations and assign almost any keys to them, up to KEYBOARDPOWER and VOLUMEUP, by the way, you can see the possible values ​​in the HIDKeyboard.h header file, or you can add your own.

Minuses:

- Braking of both video and transmission of clicks
- The second and largest is image quality, a sad emoticon is simply needed here, it is terrible, even if you reduce the resolution on the target computer to a minimum, the maximum that can be done is to configure BIOS and select an item in the bootloader. But isn't KVM actually needed for this?.. And for everything else, there is a radmin and the like.

If you have been using a personal computer for a long time, then you have to periodically update not only the software, but also the hardware, that is, the computer itself. And what to do with the old one? Especially if only the system unit remains from it (the monitor "moved" to the new one). Purchased ten years ago, "486DX33", which was then the latest achievement in technology, is now impossible to sell.

Yes, and it's a pity - after all, during his long (by computer standards) life, he managed to acquire microcontroller and PROM programmers, various amateur radio and radio engineering programs are installed (and work well) on it. That's just, it is not suitable for working on the Internet (that's why a new one was purchased).

Installing all this "architecture" on a new one is problematic - there are not enough COM and LPT ports (the old one had three COM and two LPT), and nothing from the old peripherals can work with the new USB ports. So it was decided to keep two system units and two mice.

And switch between them monitor and keyboard. Moreover, for these purposes there are (disgusting, as it turned out) job switches on sale.

The acquired mechanical switch of workplaces "Maxtro" worked no more than a month. Then "frills" began - either the keyboard does not work correctly, or not all colors are on the monitor. You have to push the handle all the time, push it, to catch the moment when everything will work fine.

After a long torment with him, it was decided to make a home-made workplace switch, but not on the Taiwanese "galletnik", the contacts of which simply peeled off, but on the Soviet RES-22 relays, controlled by two buttons.

Surprisingly, "Maxtro" switched all the contacts of the keyboard and monitor connectors, which is why there were so many contacts in it. In fact, seven contact groups are enough for such switching, because all "GND" can be connected together, and the keyboard power can be switched by two diodes. Each RES-22 has four contact groups, therefore, even one of them remains, which can be used to control the relays themselves (trigger effect of the relay).

circuit diagram

The circuit is made in such a way that it recognizes the turned on computer 2 by the +5 V supply voltage from it to the keyboard. If you turn on computer 2, then the + 5V voltage will go through the capacitor C2 to the base of the transistor VT1, which will open and turn on the relay.

It is self-blocking by a free contact group K1.4 and after charging C2 will remain on. In this state, the keyboard and monitor will be switched to computer 2. In the de-energized state, the keyboard and monitor will be switched to the old computer 1.

Rice. 1. Schematic diagram of the console switch.

All parts are assembled in an iron case from the "Maxtro" switch. "Mice" are used separately for each of the computers. The switch is powered by the AC adapter from the failed printer.

The problem of switching the printer between two computers is solved differently. The printer (Samsung 1210) has two ports - LPT and USB. The LPT port is connected to the old system unit, and the USB is connected to the new one.

With the advent of broadband Internet in offices, full-fledged remote administration became possible. Thanks to this technology, service organizations have been able to significantly reduce the response time to a customer request, and system administrators have been able to provide support even while away from the office. But remote administration tools work only after the OS boots up, if for some reason this is not possible, the physical presence of a specialist is required. KVM over IP switches can solve this problem.

Probably all administrators know what KVM switches are, this device allows you to use one console (monitor, keyboard and mouse) to control several PCs. KVM switches can be either simple, designed for personal use:

So for rack mounting, supporting cascading and allowing you to manage a large number of servers at once (up to several hundred) from one place:

KVM over IP switches stand apart in this company, allowing you to access the PC console from anywhere using the TCP / IP protocol. For a long time, these devices were considered "luxury items", but recently offers have appeared on the market at a very humane price, making them quite affordable for small organizations.

Consider the possibilities of a KVM over IP switch using an example ATEN ALTUSEN KH1508i worth 727 USD. In addition to the attractive price, this device allows you to control up to 256 PCs (when cascading switches), supports PC, Mac, Sun platforms, PC connections via PS / 2 and USB.

The switch is made in 1U format and can be mounted in a rack. The front panel contains output switching buttons, an active port indicator, a firmware update connector, a power indicator, and a Reset button.

Another feature of the switch is the use of UTP 5e twisted pair to connect managed PCs, which allows them to be placed at a distance of up to 40 m. Now there is no problem connecting servers located in an adjacent rack (or one floor below) and laying expensive specialized cables. Connectors for controlled PC, network, slave switches and console are located on the rear side of the switch:

To connect managed PCs, client modules are used that emulate the necessary peripherals. Emulation is performed directly by the module, regardless of the presence of a control device. This means that if you forget to turn on the switch, the managed PCs will still detect the keyboard, mouse, and monitor when they boot up, and you won't have to reboot them to gain access.

The manufacturer offers a wide range of client modules for managing computers of different platforms; two types of client modules are available for PCs: KA9520 (PS / 2) and KA9570 (USB) costing 71 USD. Each module is a controller with an RJ-45 interface and a half-meter cable with VGA and PS / 2 (USB) connectors, has its own firmware, regularly updated by the manufacturer, there is a switch on the module case that switches it to the firmware update mode. The KA9520 module is shown below:

For mounting on a vertical surface, a special basket is supplied with the module.

Switch settings are made via the OSD menu or the web interface (to a limited extent). If you do not have a Mac or Sun in your household, then all settings will be available via the web (by default, all switch ports are configured for the PC platform).

The connection to the device is made using the secure HTTPS protocol, despite the fact that the switch accepts connections on port 80, it still redirects to a secure connection (port 443). Port 9000 is used to transfer data between the switch and the client program, this should be taken into account when forwarding ports (i.e., in addition to 80 and / or 443, 9000 must also be forwarded).

Let's move on to the network functions of the switch, by default it is configured to receive settings via DHCP, which, in our opinion, is much better than the pre-set IP, just look at the address assigned to the device in the DHCP server settings and reserve it for the corresponding MAC address (indicated on the case devices).

For access, you can use any browser (ideally IE), the web interface is not rich in settings, you can run Windows (only through IE) or Java client, or download them if you can’t run them through the browser in any way.

The parameter deserves special attention. Network Transfer Rate, for comfortable work with the device, you should specify the minimum guaranteed speed of the channel through which the switch is accessed.

You must run the client to access managed PCs. We were unable to run the Windows Client on Windows 7 64-bit, in this case the Java client running on any Java-enabled platform comes to the rescue. Already in the client, we can fine-tune the device:

To switch to managed devices, use the tab Main, which displays all client modules connected to the switch (or chain of switches):

With the correct setting of the data transfer rate, working through a remote client is quite comfortable, the only drawback is some (sometimes significant) lag of the mouse cursor on the remote system from the cursor on the control PC.

However, it should be remembered that working through KVM Over IP is required for the most part in emergency situations when control is required at the PC load level, in other cases it will be much more comfortable to work through RDP. If you are using the USB module (KA9570) make sure that USB keyboard and mouse support is enabled in the BIOS to avoid any unpleasant surprises.

We also recommend that you configure the server BIOS to turn on by a signal from the keyboard or over the network. This will allow you to remotely turn on the server if you suddenly turn it off or turn it off by one of the overzealous employees.

KVM over IP switches allow the administrator to gain almost complete control over the managed PC from anywhere in the world, there would be Internet access. And the relatively high price of the device that seems at first glance is more than offset by the opportunities provided. In any case, it is worth estimating what will cost less, a KVM IP switch or the downtime of the enterprise required for the arrival of a technician.

  • Tags:

Please enable JavaScript to view the

This article was written under the impression of another - many thanks to the author! This article almost managed to make my own IP KVM Switch, and it's awesome! But I will explain why almost. Yes, everything works there as the author wrote ... Until the reboot into the BIOS, all the magic dissipates there and no matter how hard you try, nothing happens.

It was decided to correct this unfortunate misunderstanding and as cheaply and compactly as possible. Let's start with the Raspberry Pi and Arduino stereotypes, and the next article will continue on another hardware.

So what we need:

1. A video capture card must support a UVC driver, like this one. Options
full on aliexpress and other Chinese stores.

UVC is a standardized open source driver that is included by default with most Linux distributions, other drivers may be problematic.

2. VGA to AV Converter:



Note! You need exactly VGA to AV, and not vice versa.

3. Arduino UNO, namely UNO, since it has an Atmega16u2 chip, it interests us first of all. Here it is next to the USB port, there are also arduins with an Atmega8u2 chip that will work with both.

4. And of course, the Raspberry Pi, I had version 2 b, so everything written in this article is relevant for him, but in general, I think there should be no particular difficulties with other raspberry models.

Uploading the distribution

Well, the input data is given, let's get started. I used the 2015-05-05-raspbian-wheezy distribution, this is probably not important, further manipulations should be suitable for any Debian-based distribution.

We connect the video capture board to the raspberry, it is better to connect it directly to USB without using USB extension cables, especially the one that comes with the board, otherwise video braking, raspberry freezes, etc. may occur.

Go to the console, update the packages:

sudo apt-get update && sudo apt-get upgrade -y

Video transmission

Check if the board has been determined:

Ls /dev/video*
It should output something like: /dev/video0.

Install Motion, we will broadcast the captured image through it:

sudo apt-get install motion -y
Editing the autorun config:

Sudo nano /etc/default/motion
Set start_motion_daemon to 'yes'. Save changes Ctrl + x, y, Enter.

Editing the config of motion(a) itself:

sudo nano /etc/motion/motion.conf
Change the parameter values ​​as follows:

The parameter defines the launch of the application as a service:

Daemon on
These parameters determine the resolution of the transmitted image, it makes no sense to set a higher resolution, because. video capture is limited to PAL or SECAM standards, the resolution of which is 720x576. By the way, this is an unfortunate shortcoming, but more on that later.

Width 800 height 600
Frame rate:

frame rate 25
Disable saving screenshots:

output_normal off
Image transmission quality:

webcam quality 100
Frame rate:

webcam_maxrate 25
Cancellation of restrictions on connection from other ip

Webcam_localhost off
Save changes Ctrl + x, y, Enter.

Reload the raspberry:

sudo reboot
We are waiting for a couple of minutes if everything is done correctly, the LED on the video capture board should light up.

We connect the browser to the raspberry port 8081 and see a gray or blue rectangle with the time running from below.

The process has begun, we are looking for a victim to capture a signal from the VGA port, we connect it to the “VGA IN” port of the converter, and the video capture card to the “VIDEO OUT”. You should get something like this picture, don’t be scared, I have a bad cable, so the image “doubles”, I tried it with another image, it was better, but the resolution cannot be changed. 720x576 is a limitation of the converter and the video capture card, which, with all the desire, cannot be overcome.

Well, they learned to transfer the image, the only thing left is to transfer control.

Transfer of control

For this, as you may have guessed, we will use arduino. The choice fell on the Arduino UNO for a reason, there is a chip called Atmega16u2 that is very necessary for our purposes, only thanks to it I managed to force the BIOS of the computer to detect arduino as a USB keyboard. By default, as part of the Arduino board, this chip acts as a USB to Serial converter for uploading firmware to the Atmega328p microcontroller, a large rectangular chip on the Arduino board. In fact, Atmega16u2 is the same microcontroller, but with an important difference, it is able to work directly with the USB bus. Atmega16u2, with the right firmware, can emulate almost any USB device. Do you understand what I'm getting at? We will sew this miracle of engineering and make it work for the benefit of society.

Firmware Atmega16u2

A firmware was found on the Internet that turns the Atmega16u2 into a USB keyboard that accepts commands of a certain type via the Serial Port.

The instructions in this article are written for windows, while Linux users can use this one.

And so let's get started, for the firmware you will need a utility from the manufacturer called Flip. Download, install, run and here we have the program window:

At first, the buttons (daws) are not active, this is normal, we connect the arduino to the computer and close it - we open the two extreme contacts from the USB port side, RESET and GND.

A new device should appear in the system called, oddly enough, ATmega16u2 install the driver (in the folder with the program), select the “Settings” → “Communication” → “USB” → “open” tab in the flip program, the buttons should become active. Just in case, you can make a backup of the firmware so that you can return everything to its place. In the “File” menu, click “Load HEX File”, the program is demanding on paths, it is best to put the firmware file in the root of the C: drive, select the desired hex file with the firmware, check whether the “Erase”, “Program”, “Verify” checkboxes are and click "Run". We disconnect - we connect arduino and voila ... Now we will no longer be able to upload firmware to arduino via the built-in USB, but we got an excellent keyboard without buttons.

Don't worry about the arduino firmware, it will be possible to download the firmware from the Arduino IDE via a separate USB To TTL adapter, although I must say this will be less convenient now.

We connect the USB To TTL adapter, for example this one:

We will need White, green and black contacts, these are RX, TX and GND, respectively, we connect them to pins with the same designations on the arduino, only vice versa RX to TX, and TX to RX. The red contact must not be used!

We connect USB To TTL to the computer, install the drivers, a new COM Port should appear in the device manager. Open the arduino IDE and set: Board - Arduino / Genuino Uno, Port - our newly minted serial port.

Getting Started with Arduino Firmware

Let's add the required library to the arduino IDE: Follow the link github.com/SFE-Chris/UNO-HIDKeyboard-Library and click "Clone or download" → "Download ZIP". then in the arduino IDE, select the tab "Sketch" → "Include library" → "Add .ZIP library" and select the zip archive you just downloaded.

Preparation is over, go directly to the firmware. Copying my writing:

Arduino - Sketch

#include HID Keyboard; int collection; void setup() ( keyboard.begin(); ) void loop() ( while (Serial.available()) (//start loop when data is available sbor += Serial.read();//read data, add in decimal in the form if (sbor == 27)(//the appearance of the character of the control sequence for (int i=0; i<=4; i++){//сложение последовательности if (sbor == 165) {//для определения F1-F12 на разных терминалах могут быть разные значения sbor += sbor; } sbor += Serial.read(); delay(1); } } } if (sbor >0) ( //jump on the decimal sum of the sequence switch (sbor)( case 505: keyboard.pressSpecialKey(F1); break; case 506: keyboard.pressSpecialKey(F2); break; case 507: keyboard.pressSpecialKey(F3); break ;case 508: keyboard.pressSpecialKey(F4);break;case 509: keyboard.pressSpecialKey(F5);break;case 511: keyboard.pressSpecialKey(F6);break;case 512: keyboard.pressSpecialKey(F7);break;case 513: keyboard.pressSpecialKey(F8); break; case 340: keyboard.pressSpecialKey(F9); break; case 341: keyboard.pressSpecialKey(F10); break; case 343: keyboard.pressSpecialKey(F11); break; case 344: keyboard.pressSpecialKey(F12); break; case 13: keyboard.pressSpecialKey(ENTER); break; case 22: keyboard.pressSpecialKey(ESCAPE); break; case 127: keyboard.pressSpecialKey(BACKSPACE); break; case 9: keyboard. pressSpecialKey(TAB); break; case 32: keyboard.pressSpecialKey(SPACEBAR); break; case 26: keyboard.pressSpecialKey(PAUSE); break; case 292: keyboard.pressSpecialKey(INSERT); break; case 456: keyboard.pressSpecialKey(HOME); break; case 295: keyboard.pressSpecialKey(PAGEUP); break; case 294: keyboard.pressSpecialKey(END); break; case 296: keyboard.pressSpecialKey(PAGEDOWN); break; case 182: keyboard.pressSpecialKey(RIGHTARROW); break; case 183: keyboard.pressSpecialKey(LEFTARROW); break; case 181: keyboard.pressSpecialKey(DOWNARROW); break; case 180: keyboard.pressSpecialKey(UPARROW); break; case 293: keyboard.pressSpecialKey(DELETE); break; case 320: keyboard.pressSpecialKey((CTRL | ALT), DELETE); break; //press alt + del to call ctl+alt+del case 346: keyboard.pressSpecialKey(ALT, F4); break; //to call alt+f4 press shift + F4 default: keyboard.pressKey(sbor); break; ) //Serial.println(sbor);//only for debugging without connecting to usb keyboard.releaseKey(); collection = NULL; ) )


paste it into arduino IDE and press the check button. Now the most crucial stage will begin, the most important thing here is to catch the moment, few people succeed the first time. We press the download button in the arduino IDE, first the white lines with the compilation log will run, followed by the orange ones, this is already establishing a connection to the serial port, this is the very moment you need to catch and have time to press the RESET button on the arduino board. The firmware should be loaded, if everything is successful you will see an inscription like this

Avrdude: reading on-chip flash data: Reading | ################################################### | 100% 0.34s avrdude: verifying ... avrdude: 2934 bytes of flash verified avrdude done. thank you.
If, after several attempts, the firmware still does not load, try swapping the RX and TX pins, and also check if the GND pin is connected securely.

finish line

Open the console on raspberry and write:

sudo raspi-config
The raspberry settings menu will open, select "Advanced Options" → "Serial" and select "No".

Perhaps these manipulations will not be needed, so reinsurance. This parameter determines whether the raspberry OS will interact with the serial port, this interaction is needed mainly for debugging, so feel free to turn it off, it will only interfere with us, because. we will communicate with the arduino through this port, and the system will clog the air.

Install the minicom program.

Minicom is a simple program for working with a serial port.

sudo apt-get install minicom -y
We set the rights to access the device, / dev / ttyAMA0 - this is the same serial port.

sudo chown pi /dev/ttyAMA0 sudo chmod 744 /dev/ttyAMA0
Start minicom:

Sudo minicom -s
The program menu will open, select the “Serial port setup” item, another menu will open, select “Serial Device” by pressing the A key, write / dev / ttyAMA0, press Enter, then select the Bps / Par / Bits item under the letter E, another one appears menu press C and Q line Current: should look like this "9600 8N1" press Enter. Make sure that in the lines F - Hardware Flow Control: and G - Software Flow Control: is No, in general, everything should be like in the screenshot below, press Enter.

Save these settings as default "Save setup as dfl" and close "Exit from Minicom".

Connection

We go further, now we have almost everything ready, it remains only to connect the arduino to the serial port of the raspberry, something like this:

There is one point here, arduino and raspberry have different voltage levels and, in theory, they need to be coordinated, I advise you to read the article.

Although everything worked for me directly without coordination, you should not imitate a bad example and purchase a logic level converter, the simplest one looks like this:

Or at least assemble a voltage divider on resistors.

launch

Everything is ready, you can start.

We check all connections, turn on the raspberry pi, go to the raspberry console, start minicom. I’ll make a reservation right away, I connected to the raspberry via ssh, I used KiTTY (a modified version of PuTTY) as a client, this is important. with other terminals, the values ​​of the transmitted keys may be different and, accordingly, it will be necessary to make an allowance for the wind - change the number of the switch case transition.

In general, I hand over to you as they say "as is". Well, I’ll probably finish with this, the homemade IP KVM is ready.

P.S.

Finally, I will describe what happened in the dry residue.

Pros:

- Price
- The device turned out to be relatively inexpensive
- Raspberry Pi: about 2700 rubles.
- Arduino UNO: about 400 rubles.
- VGA to AV converter: about 700 rubles.
- Video capture card: 500 rub.
- Total: 4300 rub.

- Fine tuning
You can intercept almost any combinations and assign almost any keys to them, up to KEYBOARDPOWER and VOLUMEUP, by the way, you can see the possible values ​​in the HIDKeyboard.h header file, or you can add your own.

Minuses:

- Braking of both video and transmission of clicks
- The second and largest is image quality, a sad emoticon is simply needed here, it is terrible, even if you reduce the resolution on the target computer to a minimum, the maximum that can be done is to configure BIOS and select an item in the bootloader. But isn't KVM actually needed for this?.. And for everything else, there is a radmin and the like.

Tags: Add tags

Immediately after more than one computer appeared at home, I had a desire to save myself from constantly switching keyboards and mice to different system units. Therefore, I decided to purchase a wonderful device, which I wrote about in the last article - KVM-switch or KVM switch.

For a modest fee of 477 rubles, Chinese friends sent this wonderful thing by mail. I took some photos to show you and sent the switch to its rightful place where it will stay for a long time until it gets covered in a thick layer of dust or breaks sooner.

All contents of the package are a 2-port KVM and 2 special wires for connecting to computers. The Chinese did not spare the packaging film, so everything arrived safely.

The photo below shows that the switch has 3 VGA connectors (one for the monitor and 2 for system units), as well as 3 USB ports. Thanks to them, in addition to the keyboard and mouse, we can also connect, for example, a printer, which will also switch from computer to computer along with the rest of the peripherals.

On the top cover of the device there is a large switch button, which is easy to find in the dark. But many computer scientists like to work at night and, by the way, very in vain (who cares why - read my article). There are also 2 LED indicators on the case that tell you which port is currently in use. On the reverse side of the KVM-switch there was a sticker saying that the device can work with resolutions up to 1920x1440.

The device is connected according to the following scheme:

I placed the KVM right on the table so that I could easily reach it with my hand. As a result, the workspace around the switch looks like this:

After the first launch, I got a small surprise in the form of a blurry and dim image. You can use a monitor with such a picture only if you want to plant your eyesight in a matter of days.

First of all, I thought about the Switch itself, but after searching the Internet for information, I realized that the culprits were the low-quality cables that came with the kit. But that was the decisive factor in choosing this order! Again, the Chinese fell in love!

For myself, I found the following solution: I connected the cables from the system units directly to the monitor, since I have 2 inputs on the monitor (dvi and vga), and switching between them is done by pressing a button on the monitor itself. Thus, in order to switch to controlling another computer, instead of one button on kvm, I also have to press a button on the monitor to switch the “picture”.

For those who don't have the right monitor outputs, there is another simple solution. Instead of the wires that came with the kit, it is enough to use ordinary vga cables and wires along with them usb A to usb B(this is how most modern printers are connected). I think I will use this method as soon as I get 2 necessary USB cables. With this method, we fully preserve the functionality of the device.

In general, I had positive impressions from using kvm, because the thing is really useful, although there was a residue from the uselessness of the complete wires. If you decide to order the same one for yourself, I advise you to take only one kvm switch so as not to take risks and not overpay for wires.

If you have any questions, ask them in the comments, I will be happy to answer them.



We recommend reading

Top