Jump to content

Asking for electronic advices


Anotherfox

Recommended Posts

Hi everyone, it's been a while since I posted last time.

I would like to know if it's possible to use a keyboard PCB as a base for creating a control panel, by soldering switches to the key contactors (like an on/off switch for the landing gear). As I am worthless at coding, I won't be able to create a totally custom control panel with a "blank" PCB. Thanks in advance for your answers.

Link to comment
Share on other sites

Yes, you can do it. With push buttons (momentary switches) that complete a connection, then break it. The button presses will allow very small amount of current to the keyboard controller. The keyboard controller is not designed for any other setup. If you want to add a blade switch, you would need a keyboard spoofer with something like an arduino and modify the code. In that case, all the existing custom controllers would be worth a second look. 

Link to comment
Share on other sites

Doable but not quite easy. It's not like one key = one contact or pair of contacts. The keyboard is a sort of a grid, with rows and columns and shorting pretty much any pair produces something. So you'll have to reverse-engineer and write down which key corresponds to which pair and create a matching wiring.

Link to comment
Share on other sites

Most keyboards for PCs don't have a pcb you can solder to,   you've got these tiny metal dome switches that are pressed by the key plunger and they are embedded in a flexible "PCB" which are like the wires of a heated rear window embeeded in a layer of plastic.    The whole lot is covered in a silicone rubber sheet to prevent dust/dirt/liquid ingress.     Furthermore,   it's not an easy 1 key = 1 pair of wires to the switch type of thing.    You've actually got a "matrix" of wires going to the switch ,   several keys sharing a single bus on the X axis and several on the Y axis.     Thus you only need 20 or 30 wires to address the whole keyboard instead of 2 for every key,   the downside is if more than 3 or 4 keys are pressed together the keyboard controller can get confused, but this is rare in normal use.    The controller chip takes the raw electrical input from the keyboard matrix and converts this into an 8 bit ASCII code of which keys are held down,  to be sent to the pc.   Thus, 104 keys are connected to the computer with only the 4 wires of a usb or ps/2 cable.

In other words,   I'd rather use an old game controller or joystick as the starting point.      You're more likely to find each switch on its own pair of wires, easier to relocate that switch to the control panel of your choice?

Link to comment
Share on other sites

29 minutes ago, Sharpy said:

The keyboard is a sort of a grid, with rows and columns and shorting pretty much any pair produces something

Its known as a MUX circuit. Everything you press varies a voltage and/or amperage on section. Each section contains multiple switches(keys). Each section then talks to the central process that then encodes the info into a bus style output(USB). If you know some basic electronics you could hijack a section or the keys in a/all section(s) but the output would correspond to a key on your keyboard. To get the computer to understand it as something other than your keyboard you would probably need a custom built driver. I've never tried, what happens when you plug 2 keyboards into a computer? But, the real question is, what happens in KSP when you have 2 keyboards plugged in?

As far as the switches themselves you can use anything that is a momentary switch but be careful to not use too much wiring as some MUX circuits can be extremely sensitive to resistance, which wiring adds. The work around would be to alter the resistance of the circuit to work with the additional resistance of the wires. That would be entirely dependent on the model and design of the board. A schematic of the board would help but most companies that "make" boards don't actually make them and don't have a schematic available. I know this from experience.

48 minutes ago, Sharpy said:

So you'll have to reverse-engineer

This is exactly what must be done. so, this answer is probably best.

 

On 9/11/2018 at 11:18 AM, steuben said:

Possible yes... worth the effort probably not.

 

Link to comment
Share on other sites

11 minutes ago, AngrybobH said:

I've never tried, what happens when you plug 2 keyboards into a computer? But, the real question is, what happens in KSP when you have 2 keyboards plugged in?

1.) It accepts input from either keyboard without issue (Windows 7/10 at least that I've tested).  Fun times:  Plug in a wireless keyboard receiver to your room-mates computer, wait til he starts typing a document or something on his normal keyboard, and then press some random keys on your (hidden away) wireless keyboard.  Watch complete confusion ensue.

2.) Would likely work 'just fine' in KSP.  I don't think Unity addresses keyboards individually -- it just grabs the key input state from the OS' IO layer.  So if you had 1 keyboard plugged in, or 10, it wouldn't matter which one you pushed 'a' on, Unity/KSP would just see that 'a' was pressed.

3.) Still probably a complete PITA to do because of how most keyboards are designed (as others have stated).  Perhaps a better starting point might be a slightly more expensive mechanical keyboard?  I haven't looked into the guts of these, but I would think that they use a more standard wiring scheme instead of the crazy wire-matrix that the rubber-dome boards use (especially the ones with N-Key roll-over... would think that those keys are wired individually, but could be wrong).

Edited by Shadowmage
Link to comment
Share on other sites

1 minute ago, Shadowmage said:

would think that those keys are wired individually

nope. They are MUX style like most everything these days. Saves on wiring and pc board runs. Expensive keyboards are just keyboards you spent more money on. Sometimes they have better driver software and better switches(which would be removed in this project)

4 minutes ago, Shadowmage said:

complete PITA

Exactly.

Link to comment
Share on other sites

 

4 hours ago, AngrybobH said:

. Everything you press varies a voltage and/or amperage on section.

Wait, you mean one can't just put a switch on two pieces of wire to simulate a specific single keypress, but has to manipulate with some resistors or such to add extra identification of the key?

I know media buttons on standard analog (phone) headsets do this, shorting the mic line to the ground through varied resistors that provide resistance way different than the microphone. But standard PC keyboard?

Link to comment
Share on other sites

5 hours ago, Sharpy said:

Wait, you mean one can't just put a switch on two pieces of wire to simulate a specific single keypress

depends on where you tie in. A simple MUX circuit will have a resistance value tied to a key, like 100 ohms and 200 ohms tied to another key. If the section sees 300 ohms it knows you are pushing both(how steering wheel controls on your car works, 3 wires for all those buttons!). In that way you can just tie into the section(bypass the switch mounts). If you tie in exactly where the switch is, you can just tie 2 wires together as long as you aren't adding(or subtracting) too much resistance from the circuit. And, yes, switches have resistance. If the design of the board uses 1 ohm differences, you could press the switch you have assigned to "A" and get a "D" if you're switch adds as little as 0.5 ohms. Then you add wiring and solder joint resistance(and possible inductive current) and you could have a mess. If the difference is more like the car steering wheel, 20 ohms added or subtracted doesn't bother it too badly.

Thinking about in terms of different type a MUX like a timing pulse MUX(Nissan/Renault steering columns, 5 wires in, 5 wires out), resistance would matter less and you could probably get away with 'just tying two wires together'. Knowing what you are modifying and how it was designed is extremely important.

Link to comment
Share on other sites

51 minutes ago, SpaceMouse said:

It would probably work, but i imagine [windows] would be displeased at having two keyboards connected.

Windows will tolerate two keyboards quite nicely, since the days of '95 iirc. I haven't pushed it beyond that, that would be silly. However, my guess is that it will probably accept many more.

Link to comment
Share on other sites

3 minutes ago, steuben said:

Windows will tolerate two keyboards quite nicely, since the days of '95 iirc. I haven't pushed it beyond that, that would be silly. However, my guess is that it will probably accept many more.

Never tested it. My point was wouldn't both keyboards be sending the same commands? Even if there wired differently, I'm not sure how KSP would know the difference.

Link to comment
Share on other sites

It wouldn't... but then it wouldn't really care. All the underlying operating system sees is a key-down notification, and a key-up notification. What it and the application does with the notification (though I think the current vernacular is "event") is their problem. Usually the OS just passes the notification up the chain to the various applications to do with it what they want.

All KSP would see would be <insert key + modifiers> being pressed. The information about which keyboard that it came from would not be passed to it. Unless it bypassed the OS and went closer to the metal than is usually worthwhile it wouldn't even be seen.

Link to comment
Share on other sites

On 9/18/2018 at 3:11 PM, AngrybobH said:

nope. They are MUX style like most everything these days. Saves on wiring and pc board runs. Expensive keyboards are just keyboards you spent more money on. Sometimes they have better driver software and better switches(which would be removed in this project)

Exactly.

Can confirm. I've opened many a keyboard, stupid coffee and clumsiness.:/

Link to comment
Share on other sites

On 9/20/2018 at 8:20 AM, SpaceMouse said:

It would probably work, but i imagine windoze would be displeased at having two keyboards connected.

I run a speedpad beside my keyboard.   It is literally an auxillary keyboard, and I've never had a problem with it.  I also run three mice at once, with no issues.  A gaming mouse that has some issues with double clicking, so I have a regular mouse plugged in also, and a 3d navigator for 3d modelling.   Yes, my USB hubs have USB hubs. 

 

But the really simple solution to this would be to just use an arduino, bite the bullet and learn to code, and use one of the great mods designed for this. 

Link to comment
Share on other sites

17 hours ago, Gargamel said:

I run a speedpad beside my keyboard. 

and a 3d navigator for 3d modelling.  

Yes, my USB hubs have USB hubs. 

 

But the really simple solution to this would be to just use an arduino, bite the bullet and learn to code, and use one of the great mods designed for this. 

I hadn't even thought of this. Pretty sure those auxiliary keypads are configured differently so you could probably hack one up.

I should really look into one of these.

:0.0:

This is probably he proper solution. I've wanted to build a proper multifunction 'pit for a while myself.

Link to comment
Share on other sites

8 hours ago, SpaceMouse said:

This is probably the proper solution

That is where I would start, if I was going to this project and I didn't want to just build it from scratch. That might be even better than scratch because it comes with its own programmable software that you didn't have to write. You should still reverse engineer how the switches are actuated to avoid issues and/or letting the smoke out of the board. Now I wonder how many of those you could hook up and have unique inputs from all the different buttons? I imagine the computer would just keep assigning space on the bus until you drew too many amps out of the USB power source. And now I wonder, how many amps can you draw from a USB port? How rediculous kerbalized could you get with something like this? If you used the USB power to trigger a transistor to turn on an auxiliary 5 volt supply you could have as many amps as you wanted....how far can you go? where is the limit? ugh, I should probably stop thinking about this before I start building things.

Link to comment
Share on other sites

13 hours ago, SpaceMouse said:

I hadn't even thought of this. Pretty sure those auxiliary keypads are configured differently so you could probably hack one up.

Ehhhhh.... I doubt it.  You'll probably run into the same Muxing issue as a full keyboard.

I think there's a bunch of custom made control panels using this mod in the thread.  

  https://forum.kerbalspaceprogram.com/index.php?/topic/60281-hardware-plugin-arduino-based-physical-display-serial-port-io-tutorial-10-06-17/

Yes, you'll need to learn a bit of C, but Arduino C is very simple (it can get very very complex), but for just turning button pushes into key strokes, it's fairly simple.   An Arduino Mega board, and you could build an entire cockpit mock up. 

zuxv4oA.jpg

 

 

Edited by Gargamel
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...