Quantcast

Maximum PC

It is currently Tue Sep 30, 2014 10:17 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 51 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Building a custom KVM switch
PostPosted: Sat Sep 20, 2008 5:31 pm 
Team Member Top 500
Team Member Top 500
User avatar

Joined: Mon Jan 08, 2007 1:41 pm
Posts: 2033
Ok, so recently I've embarked on a little electronics project, and just like the title implies, I plan to make a KVM switch from scratch. My circuit knowledge is sufficient, but not extraordinary . :D That's why I'm seeking some input.

For now, it's just for two computers. I envision the end product to be some sort of "control box" that I can set on my desk and switch usb, sound, dvi, and whatever else I can dream up between computers. I'll throw in some extras like switches to turn off/ reset my two computers or to control their internal lighting (and if I get that far, fan speeds).

Switching sound and usb ports is simple enough... for the sound I can easily and efficiently use relays and I could use DPDT switches for the USB ports if I really wanted to.

Anyway, the hard part is when it comes to switching the monitor signal. Both of my computers use single link, dvi-d connectors, so I hardly see the need to design for more than that (i.e. dual-link).

I haven't had the chance to gut one of my dvi cables yet (both are in use) but looking from the pinout it seems I have about 14 pins (I assume they all correspond to a wire) to switch. This number is excluding the two power pins, which I figure I'll just keep connected.

Now, are relays still the best way to switch the monitors? Even if I use DPDT relays, that's still seven of them (ouch).

Thanks for any input. This all may seem confusing without circuit diagrams, but I promise I'm working on those. Just as soon as I figure out what type of relays I'm using...


Top
  Profile  
 
 Post subject:
PostPosted: Sun Sep 21, 2008 3:39 pm 
Team Member Top 500
Team Member Top 500
User avatar

Joined: Mon Jan 08, 2007 1:41 pm
Posts: 2033
I've been doing a little research, and would a programmable microcontroller be able to automate all the functions of my KVM switch? Say, if I flip a switch, it sends a voltage signal to a pin on the microcontroller, then the microcontroller closes the circuit between two of its other pins. Could I do that?

Apparaently there's a lot to know about microcontrollers, and I'm highly willing to learn if someone confirms that this will do it. The only thing is, I rather buy just a microcontroller instead of an expensive kit. Is it possible to interface it on my own with one of my usb ports in order to program it?


Top
  Profile  
 
 Post subject:
PostPosted: Mon Sep 22, 2008 3:07 am 
Team Member [Top 500]*
Team Member [Top 500]*
User avatar

Joined: Thu Jun 24, 2004 2:22 pm
Posts: 8720
Location: Cleveland, Ohio
OK, having thought about this a little, here is the PM I replied to your PM with last night:

Quote:
Just got in and sort of tired but .... and this is pure guess I would say if you wanted to try a micro controller it could likely work combined with a MUX (Multiplexer).

Awhile back I bought a kit using a PICAXE 28 microcontroller. Unfortunately all the little parts are still in the box as seems time is elusive. I haven't had time to mess with learning the code either.

This place:

http://forum.servomagazine.com/

is a forum for Nuts & Volts and has some real sharp guys in it for microcontrollers. I am not as active there as I would like to be. Chris Adcock (Manta) turned me onto the magazine and I found the forum. They are real big on PICAXE which sounds like what you are looking for.

I will try to figure out more for you.

Ron



The more I think about this I am not really sure that a micro-controller is the way to go. PICAXE may not be the best solution.

Generally MUX circuits and switching circuits simply switch lines moving inputs and outputs around. A micro-controller is designed and programmed to perform certain functions on input & output lines. They react to an input stimulus.

Years ago, several electronic enthusiast magazines did some stories on KVM switching and offered some homebrew ideas on them. A popular choice for switching was a CMOS chip called the 4066 Quad BiLateral Switch.

What may work for you is building a matrix of BiLateral switches. Since a 4066 actually has 4 EA. SPST NO switches a pair of them could be configured to offer 4 EA. DPST (one NO and one NC) switches. You would use a simple hex buffer to drive the control lines of 1/2 the switches in the matrix.

This forum has a very good collection of Electronic Engineering students and hopefully a few will jump on this with some ideas and thoughts.

As much fun as micro-controllers can be I am just not sure that is the route you want for this project...

EDIT: Also remember some systems won't boot unless they see a keyboard and mouse, thus many electronic KVM switches emulate their presence. Were you looking at just switching monitors?

Ron


Top
  Profile  
 
 Post subject:
PostPosted: Mon Sep 22, 2008 3:44 am 
Million Club - 5 Plus
Million Club - 5 Plus
User avatar

Joined: Fri Apr 25, 2008 6:35 am
Posts: 1998
Im no expert at electronics, just hobbiest level, but Ill toss a couple thoughts out.

USB: if you look at how USB connectors work as you slide the connector in place, youll see that power and ground are connected 1st, then the data lines. that allows the electronics to get power and stabilize before the data lines are connected. you may have to take this delay into account when you design your USB switching circuit.

using mechanical relays and switches directly may not be the best way to go as you will get contact bounce. this may confuse whatever is being switched. components that are designed to be "hot plugged," like USB, may be OK with contact bounce but stuff like PS/2 and video ports that are designed to be plugged in with power off probably wont like being switched live with mechanical relays or switches as they dont have buffers to take that bounce into account. using switching and buffers ICs (like Reloadron suggests) may be better (and safer).

Quote:
I rather buy just a microcontroller instead of an expensive kit. Is it possible to interface it on my own with one of my usb ports in order to program it?


yes, they have stand alone USB interface chips and you can buy just the microcontroller. but its a "chicken and the egg" thing: you need to program the microcontroller to interface it with the USB controller. and you cant program it without the.. uh..

I do think (may be wrong) that some microcontrollers have a serial port built on the chip (just add a few discreet components) and can be programmed that way but you would have to root around and see which ones have that capability. been a while since Ive looked into them.

best bet if you go with the microcontroller bit is buy a kit with a decent sized breadboard area built onto the board. it will be programmable via USB or serial out of the box and you build the switching stuff on the breadboard area. once your design is finalized you can buy just what you need to make a stand alone version (basically just the microcontroller, program it in the kit and transplant it and the switchin stuff into your dedicated PCB) and reuse the kit for other experiments - they are very cool and Im sure once you get one you will find all sorts of other things to do with it.


Top
  Profile  
 
 Post subject:
PostPosted: Mon Sep 22, 2008 2:46 pm 
Team Member Top 500
Team Member Top 500
User avatar

Joined: Mon Jan 08, 2007 1:41 pm
Posts: 2033
Ok. This all sounds great so far. I'm not too worried about contact bounce at this point, because google told me that can be fixed pretty easily. Nevertheless, could I really hurt a component because of the switching method I use? The DVI cables do in fact have a pin called "hot-plug" and I assume that's meant to do something...

Anyway, I looked up the datasheet for that switch you told me about Ron, and it makes sense. All the inputs and outputs are normally grounded unless I apply a voltage to the control pins, then it connects the corresponding in and out. Sounds a lot like a relay to me.

But what exactly is a hex buffer, and how would it help me? (datasheet) Does it serve as some sort of current/voltage regulator?

The advice you guys have given me so far is great, keep it coming.. :D


Top
  Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2008 1:39 am 
Team Member [Top 500]*
Team Member [Top 500]*
User avatar

Joined: Thu Jun 24, 2004 2:22 pm
Posts: 8720
Location: Cleveland, Ohio
When I get home from work today I'll explain the buffer and the need for it.

Ron


Top
  Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2008 3:19 pm 
Team Member [Top 500]*
Team Member [Top 500]*
User avatar

Joined: Thu Jun 24, 2004 2:22 pm
Posts: 8720
Location: Cleveland, Ohio
OK, the reason I mention a buffer and what they are all about can be found here:

http://hyperphysics.phy-astr.gsu.edu/hb ... uffer.html

Basically, and keeping this simple a buffer can be thought of as an amplifier with a unity gain or a gain of 1. The term HEX Buffer just means on a single chip there are 6 devices. Additionally an Inverting buffer means the output is inverted from the input. I use the 7407 (Non-Inv) and the 7404 (Inv) as buffer examples in the below example:

Image

I don't show the entire chips of the buffers. However, if I place S1 in the Ground or common position the output of the 7407 will be common while the output of the 7404 will be 5 Volts (logic high). Those outputs are connected to the control lines af a quad switch (the 4066). One switch will be ON and one will be OFF. The Signal IN will be available at the switch that is On. Now if I switch SW1 to the +5 Volts the bufffers will toggle as will the outputs of the 4066 switch.

In real life SW1 would not be used but likely a Flip Flop chip. Pressing a button would toggle the flip flop output. The switch is there just to show what is going on and how we switch a signal.

That would be one way to switch an input to either of two output lines.

NOTE: I did not show the power pins of the chips either. They would all be powered off 5 Volts.

Ron


Top
  Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2008 3:38 pm 
Team Member Top 500
Team Member Top 500
User avatar

Joined: Mon Jan 08, 2007 1:41 pm
Posts: 2033
Ok... this is all starting to come together. I guess now I'll order some parts and play around with them a little. Thanks a lot!


Top
  Profile  
 
 Post subject:
PostPosted: Tue Sep 23, 2008 4:07 pm 
Team Member [Top 500]*
Team Member [Top 500]*
User avatar

Joined: Thu Jun 24, 2004 2:22 pm
Posts: 8720
Location: Cleveland, Ohio
Start small, and as was suggested a small breadbosrd makes for easy experimenting. When you have questions come and ask. Let us know how things work out.

Ron


Top
  Profile  
 
 Post subject:
PostPosted: Tue Sep 30, 2008 2:08 pm 
Team Member Top 500
Team Member Top 500
User avatar

Joined: Mon Jan 08, 2007 1:41 pm
Posts: 2033
Hey all... a little update.

Got my order from mouser today. Basically a crapload of 4066 switches and 2 each of the 4704 and 4707 buffers. (I know, not nearly enough, but they were expensive and I wasn't convinced I needed them).

All I had time for was a little testing, and everything is working satisfactorily. I hooked up a few led's to the first control circuit (control is pin 13 and uses pins 1 and 2).

You can see I circled two wires in white circles, those were just dangling there because I didn't have the right switch on hand. With the circled wires, I was able to just touch for an instant pin 13 (with +6v), and everything went on. Then i could touch pin 13 with the ground, and they go off. That's a 6v battery there.

Everything seems (so far) to be working alright without buffers. It also seems that momentary switches would work, but I assume it's bad design to use momentaries, as even the slightest interference could mess it up.

I'm thinking, in place of the buffers (with a spdt switch) I'll just use a DPDT toggle. One position will send +6v to switch set A and ground to switch set B and the other position will reverse it.

Anyway... how's it look?


Image


Image


Top
  Profile  
 
 Post subject:
PostPosted: Tue Sep 30, 2008 2:24 pm 
Team Member [Top 500]*
Team Member [Top 500]*
User avatar

Joined: Thu Jun 24, 2004 2:22 pm
Posts: 8720
Location: Cleveland, Ohio
Really nice to see you working this thing. Nice setup too. I am not sure about something though:

Quote:
I'm thinking, in place of the buffers (with a spdt switch) I'll just use a DPDT toggle. One position will send +6v to switch set A and ground to switch set B and the other position will reverse it.


Discounting switch bounce which may or may not be an issue, the problem is that when the switch is in one or the other position you will have a floating input to your quad 4066 switches? Not sure about how that will work out. However, if you have them floating now and it works, maybe it is fine.

Friggin hex buffers should have been cheap?

Ron


Top
  Profile  
 
 Post subject:
PostPosted: Tue Sep 30, 2008 3:23 pm 
Team Member Top 500
Team Member Top 500
User avatar

Joined: Mon Jan 08, 2007 1:41 pm
Posts: 2033
Reloadron wrote:
Really nice to see you working this thing. Nice setup too. I am not sure about something though:

Quote:
I'm thinking, in place of the buffers (with a spdt switch) I'll just use a DPDT toggle. One position will send +6v to switch set A and ground to switch set B and the other position will reverse it.


Discounting switch bounce which may or may not be an issue, the problem is that when the switch is in one or the other position you will have a floating input to your quad 4066 switches? Not sure about how that will work out. However, if you have them floating now and it works, maybe it is fine.

Friggin hex buffers should have been cheap?

Ron


Well, I plan to get a usb switch going with these later this week, and I''ll see how stuff works out with a dpdt switch.

The 4066 switches were 33 cents apiece, so I just went and ordered 10 bucks worth. Figured I'd break a few and keep what I don't use for other projects.

I was looking at the SN4704N and SN4707N hex buffers from TI, and both were about a buck each. Maybe there was something cheaper... I don't know. But I did at least buy a few so I could test and buy en masse (if needed) in my next order.

If everything pans out, all I really have to order yet is some toggle switches, i/o plugs, a bunch of leds (I'm going for form and function), and probably some other finishing touches. I do plan to solder the final product (obviously).

Thanks for all the great help so far


Top
  Profile  
 
 Post subject:
PostPosted: Tue Sep 30, 2008 6:43 pm 
Klamath
Klamath

Joined: Sun Apr 13, 2008 7:51 am
Posts: 212
just wondering what kind of case your using. Are you going to bend sheet metal or go for wood


Top
  Profile  
 
 Post subject:
PostPosted: Wed Oct 01, 2008 2:58 am 
Team Member Top 500
Team Member Top 500
User avatar

Joined: Mon Jan 08, 2007 1:41 pm
Posts: 2033
pellier wrote:
just wondering what kind of case your using. Are you going to bend sheet metal or go for wood


Wood, most likely. But I do have some plexi lying around and I'll use that as the top piece. All the switches will be mounted on the plexi. Also, since the top will be see-through, I'll throw some led's inside with the circuit boards.

As to the actual dimensions or exact form factor of the case, I'm not yet sure. That will all depend on what kind of space I need for the circuit boards and the number of switches I end up with...


Top
  Profile  
 
 Post subject:
PostPosted: Wed Oct 01, 2008 7:44 pm 
Team Member Top 500
Team Member Top 500
User avatar

Joined: Mon Jan 08, 2007 1:41 pm
Posts: 2033
Ron, you mentioned a "floating input" on some of my switches if I were to use a DPDT switch. Here's the configuration I envisioned:

Image

To clarify, where it's labeled "switch set A" and "switch set B" are referring to the control pins of the 4066's. While one group of 4066's (which we'll say give computer 1 the signal) is getting power, the other group (corresponding to computer 2's input) will be grounded, and thus only one computer will be getting the signal at a time.


Top
  Profile  
 
 Post subject:
PostPosted: Thu Oct 02, 2008 1:36 pm 
Team Member [Top 500]*
Team Member [Top 500]*
User avatar

Joined: Thu Jun 24, 2004 2:22 pm
Posts: 8720
Location: Cleveland, Ohio
Duh, what is it they say? Oh yeah, one picture is worth a thousand words, also I see said the blind man. That will work just fine and I don't see switch bounce as an issue. It will be there but shouldn't come in light of the circuits intended use.

Again, nice to see you go after this project.

Ron


Top
  Profile  
 
 Post subject:
PostPosted: Sat Oct 11, 2008 4:57 am 
Team Member Top 500
Team Member Top 500
User avatar

Joined: Mon Jan 08, 2007 1:41 pm
Posts: 2033
I know, it's been a while, but I haven't forgotten about this.

I've run into a little snag, but nothing that can't be remedied with a LOT of patience. In order to interface my circuitry with my computers and peripherals, I obviously need I/O connectors.

The DVI I/O's are giving me trouble. All that is sold are "solder connector" versions, meaning I have to solder leads to all 18 pins on each dvi connector.

Here's the spec sheet: http://www.molex.com/pdm_docs/sd/743205000_sd.pdf

Next to impossible, until I thought of removing the pins, soldering leads to them, then putting them back in the connector. That approach has worked so far, and I have two DVI I/O connectors completed.

Unfortunately, in the process of figuring out how to connect leads to those dvi i/o's, I ruined one of the three I need. So, I'll have an order into mouser before the weekend's end for more dvi connectors as well as the parts needed to complete this project.

Maybe some pics later today.


Top
  Profile  
 
 Post subject:
PostPosted: Sat Oct 11, 2008 6:19 am 
Team Member [Top 500]*
Team Member [Top 500]*
User avatar

Joined: Thu Jun 24, 2004 2:22 pm
Posts: 8720
Location: Cleveland, Ohio
How are you going to mount the chips? I have some chip sockets if you need them. Bummer on the connector but there is a learning curve.

Ron


Top
  Profile  
 
 Post subject:
PostPosted: Sat Oct 11, 2008 7:44 am 
Team Member Top 500
Team Member Top 500
User avatar

Joined: Mon Jan 08, 2007 1:41 pm
Posts: 2033
Reloadron wrote:
How are you going to mount the chips? I have some chip sockets if you need them. Bummer on the connector but there is a learning curve.

Ron


Don't tell anyone, but I soldered them right to the boards. I'm actually not a bad solder-er so it was quick and painless and I banged out 10 chips (140 pins?) in under 10 mins. I tested and they all work just fine. Thanks for the offer, though.

The thought occurred to me that this project could possibly be made a lot easier (and more compact) if I were just to etch my own circuit boards. I've never done it before, but if I did I'd go for the toner transfer method. Perhaps I'm getting ahead of myself, but that migtht be something to try for kvm switch version 2.


Top
  Profile  
 
 Post subject:
PostPosted: Sat Oct 18, 2008 6:49 am 
Team Member Top 500
Team Member Top 500
User avatar

Joined: Mon Jan 08, 2007 1:41 pm
Posts: 2033
Hello all... a little update...

It seems I've hit a little snag with the DVI switch. As I mentioned before, I was able to successfully connect leads to the dvi i/o receptacles I ordered.

Before I connected them to any kind of switching circuit, I wanted to make sure that my setup could carry a monitor signal. Well, it didn't go so well.

This was my basic setup. On the left is the dvi cable from the computer, and on the right is the dvi cable going to the monitor.

Image

Just let me say that I've spent at least an hour and a half double and triple checking for continuity and shorts. Everything looks perfect on the volt meter, but something isn't working with high amounts of dvi data.

I'll clarify a little. If I have my computer set to my usual 1920x1200 resolution, my little setup produces a "signal out of range" message on my monitor. So I decided to try a lower resolution, and hence, it works. Here's a little illustration of what happens as I try to increase the resolution:

1152x864:
Image

1280x1024:

Image

1600x900:

Image

1600x1200:

Image


With that last resolution (1600x1200), the monitor displayed that for about a second, then went to black.

My dillema is obvious. I don't intend to admit defeat, though. :D

Somehow my setup can't handle the data throughput of higher resolutions, which also makes me doubt the integrity of even a 1024x768 signal. My guess is that there's maybe some type of interference going on or degradation of the signal as it travels through my expert soldering joints.

One of the tests I did do was check to see that if I stuck 6.3v in one end, that I got exactly that voltage out the other end. That all went fine. Like I said, whatever this problem is, it isn't going to be found with a voltmeter.

Suggestions? :D

Now, on a brighter note, I haven't been as lazy as this thread would suggest. In the past two weeks I've completed the actual circuit for dvi switching, and all that remains is to tie it in with the i/o connectors. But, obviously, that's not going to happen until I can carry a clean signal.

What worries me more is that even if I get this little setup working, I still have to send those dvi signals through a maze of connections, including through all those 4066's.

qa9b


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 51 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

© 2014 Future US, Inc. All rights reserved.