In this project we will assemble an automatic keyboard and mouse switch that allows for easy sharing between two computers.
The idea for this project came from my need, at any given time, have two computers in my lab desk. Most of the times it's my Desktop PC and my Laptop PC. Also frequent is having the desktop PC and a Single Computer Board (e.g., Raspberry Pi type of boards). Previous to building this solution I had to frequently disconnect/connect the USB cables, by-hand, between the two computers. This was an annoyance that had to be addressed fast! And just like that a new challenge/project idea was born: I had to setup "something" that allowed me to switch both the keyboard and mouse between USB host just by pressing a button.
The solution is based in the Yepkit YKUP board Upstream Switch that switches a USB device between two USB hosts. By hooking-up together two YKUP boards I'm able to switch both the keyboard and mouse between my laptop and desktop PC just by pressing a push-button.
Let's see he several components and how to set-it-up.
Step 1: The Solution Diagram
Two YKUP boards will be stacked to form a USB upstream switch capable of switching two USB devices (a keyboard and mouse, in this case) between to computers.
The YKUP boards have each an in-board push-button and two pins to connect and external digital signal. Both can be used to switch the USB device from one upstream (PC) to the other. As I wanted to just press once to switch at the same time both devices, the in-board push-buttons will not be used and the digital trigger pins will be used instead.
To generate the digital pulse a 3V battery and a push-button will be used.
Let's look at the components and materials needed for assembly.
Step 2: The Parts List
The following components were used:
- 2 YKUP boards
- 1 push-button
- 1 meter of two wire cable (small gauge)
- 4 Mini USB 2.0 cables
- 1 Micro USB 2.0 cable
- 2 Board-To-Board Connector Receptacle 2WAY 2.54mm
- 2 Board-To-Board Connector 2WAY 2.54mm
- 1 CR2032 3V battery
- 1 plastic coated paper clip
- Some insulator tape
Let's start assembling.
Step 3: Hooking-up the Battery, Cable and Push-button
I started by cutting the copper wire cable to size considering the final location of both the YKUP boards and push-button. I choose to place the YKUP boards in a slot underneath my desk, so I will need approximately 1m of cable.The push-button, to trigger the switching, I want it in the monitor base so that when I push the monitor button to switch between PCs I will immediately after push the push-button to switch the USB devices.
To hook-up the battery to the cables I improvised with a plastic coated paper clip. The wire connected to the negative pole (-) of the battery must be connected to GND pin of the YKUP boards "EXT CTRL", and the wire coming from the push-button must connect to the SIG pin of the YKUP boards "EXT CTRL".
The positive pole of the battery (+) is connected by one of the conductors of the cable to one of the terminals of the push-button (please note the the push-button is of the normally open type). The other conductor of the cable is connected betweent the other push-button terminal and the SIG pin of the YKUP boards "EXT CTRL".
Next let's stack the YKUP boards and connect the trigger cable.
Step 4: Stacking the YKUP Boards
Because I want to switch both the keyboard and mouse (so both the YKUP boards) simultaneously with a single button push, the "EXT CTRL" pins of both YKUP boards should be tied together. This is made easy by stacking the YKUP boards. To do that male and female board-to-board connectors are soldered as shown in the picture.
The top board will have the male connectors soldered in the bottom face of the board, and t bottom board will have the female connectors soldered to the top face of the board.
note that two connectors are used per board, one for the EXT CTRL pins and the other for the power pins. This was when we stack the to boards together they will share both the Trigger signal and the power.
As the stacked YKUP boards will share the power, the power input just has to be connected to one of them.
Step 5: Connecting the USB Cables and Testing the Setup
In my setup the Upstream 1 port of each YKUP connects to the desktop PC and the Upstream 2 port of each YKUP connects to the laptop PC. Then the mouse is connected to the downstream of a YKUP and the keyboard is connected to the downstream of the other YKUP.
To power both boards I connected the external 5V power to one of the YKUP boards (I'm powering from one of the desktop USB ports using a Micro USB cable).
Know that everything is set-up just press that push-button and see the keyboard and mouse switch from one PC to the other.
For more detail on this project, questions or to checkout my other projects got to: solderingideas.blogspot.com