Author Topic: Hardwiring a keyboard  (Read 5161 times)

0 Members and 1 Guest are viewing this topic.

Offline HotKillerZzz

  • Thread Starter
  • Posts: 120
  • Location: Singapore
  • Ammesia
Hardwiring a keyboard
« on: Sat, 05 July 2014, 07:38:45 »
Hi, I would like to know how to hardwire a keyboard. I would just like to make some with like 5-10 cherry keys. A very mini project like the business card from techkeys.
How do I go about? How do I wire the switches together?

Thanks for helping!
« Last Edit: Sat, 05 July 2014, 07:55:59 by HotKillerZzz »

Offline Findecanor

  • Posts: 5038
  • Location: Koriko
Re: Hardwiring a keyboard
« Reply #1 on: Sat, 05 July 2014, 09:36:30 »
It has been done before. Do check around in the forum.

I would recommend a Teensy 2.0 chip as controller because there are lots of firmwares for it that you could adapt to support your layout, plus it is very small.
With such a small keyboard you could easily connect each switch to its own pin on the controller board, doing in effect a 1×5 matrix.
🍉

Offline HotKillerZzz

  • Thread Starter
  • Posts: 120
  • Location: Singapore
  • Ammesia
Re: Hardwiring a keyboard
« Reply #2 on: Sat, 05 July 2014, 22:00:44 »
Yes I have found some posts that can help me, but I do not know what are the materials I need.

Currently what I know I need:
All the soldering equipment
Teensy

Hope you will be patient with me as I am still very new to this hardwiring concept.
Tell me what you need from me to help me, I am planning to give this mini keyboard to my brother

Offline jacobolus

  • Posts: 3661
  • Location: San Francisco, CA
Re: Hardwiring a keyboard
« Reply #3 on: Sat, 05 July 2014, 22:31:18 »
You need:
- keyswitches, keycaps, maybe stabilizers
- something to use as a plate (could be cut out of acrylic, metal, wood, ...)
- wire
- USB cable
- through-hole 1N4148 diodes
- resistors
- a microcontroller board (I recommend Teensy 2.0)
- soldering iron
- solder (get the leaded kind, either 63/37 or 60/40)
- flux
- ventilation (e.g. one of those solder fume extractor thingies, or a nearby window)
- some needle-nose pliers, some tweezers, and some tiny flush cutters (nail clippers work in a pinch)

Also helpful:
- multimeter
- panavise
- wire stripper
- nice desk lamp
- desoldering wick/braid
- solder sucker (e.g. Soldapullt)
- some dental picks
- heat-shrink tubing (and maybe a heat gun)
- hot glue gun
- jeweler’s loupe

Check out http://geekhack.org/index.php?topic=42824.0
« Last Edit: Sat, 05 July 2014, 22:38:02 by jacobolus »

Offline swill

  • * Elevated Elder
  • Posts: 3365
  • Location: Canada eh
  • builder & enabler
    • swillkb.com
Re: Hardwiring a keyboard
« Reply #4 on: Sat, 05 July 2014, 23:04:48 »
You need:
- keyswitches, keycaps, maybe stabilizers
- something to use as a plate (could be cut out of acrylic, metal, wood, ...)
- wire
- USB cable
- through-hole 1N4148 diodes
- resistors
- a microcontroller board (I recommend Teensy 2.0)
- soldering iron
- solder (get the leaded kind, either 63/37 or 60/40)
- flux
- ventilation (e.g. one of those solder fume extractor thingies, or a nearby window)
- some needle-nose pliers, some tweezers, and some tiny flush cutters (nail clippers work in a pinch)

Also helpful:
- multimeter
- panavise
- wire stripper
- nice desk lamp
- desoldering wick/braid
- solder sucker (e.g. Soldapullt)
- some dental picks
- heat-shrink tubing (and maybe a heat gun)
- hot glue gun
- jeweler’s loupe

Check out http://geekhack.org/index.php?topic=42824.0

Nice list.  Thanks for taking the time to put the list together.  I will be hand wiring a keyboard with the Enabler PCBs, so this is a good checklist for me.  :)

Offline HotKillerZzz

  • Thread Starter
  • Posts: 120
  • Location: Singapore
  • Ammesia
Re: Hardwiring a keyboard
« Reply #5 on: Sat, 05 July 2014, 23:39:48 »
Ok so I have everything in that list, except for the diodes and resistors. Do you have a link to where I can get them? I searched but there were so many different types.

I have basic experience in soldering so it should not be a problem, now I just need to know which part to solder to. Do anyone have a diagram that you can provide? I saw some online but I don't understand, would be great if you could label them.

I will post a layout of the keyboard soon. Thanks!!! :blank:

Offline Zekromtor

  • Posts: 241
    • My Setup
Re: Hardwiring a keyboard
« Reply #6 on: Sun, 06 July 2014, 00:17:15 »
What do you need the resistors for?

Offline jacobolus

  • Posts: 3661
  • Location: San Francisco, CA
Re: Hardwiring a keyboard
« Reply #7 on: Sun, 06 July 2014, 00:34:50 »
I guess you don’t need any resistors for just this project. (The internal pull-up resistors in the Teensy will suffice.) But they’re pretty generally useful if you want to build anything else (e.g. make protocol converters for old keyboards, or even just add a blinking LED). I dunno. I wouldn’t bother gathering together a few hundred dollars of electronics tools without also tossing in a few dollars of resistors, capacitors, diodes, LEDs, maybe some transistors, some random I/O devices, ...
« Last Edit: Sun, 06 July 2014, 06:26:01 by jacobolus »

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: Hardwiring a keyboard
« Reply #8 on: Sun, 06 July 2014, 01:44:39 »
Also, you only need diodes if you have multiple rows and columns in your matrix.  If you only have one row or one column, there is no need for diodes.
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline HotKillerZzz

  • Thread Starter
  • Posts: 120
  • Location: Singapore
  • Ammesia
Re: Hardwiring a keyboard
« Reply #9 on: Sun, 06 July 2014, 02:30:40 »
Ok, I'm not very clear on this yet.  :-\
So diodes and resistors are optional?

Under what kind of situation would you need the diodes or resistors and what are they for?

What kind of wire should I use too?

I went to here : http://wiki.geekhack.org/index.php?title=Hard-Wiring_How-To

I don't really understand.
If you don't use diodes then how do you connect?

Thanks!!

Offline vvp

  • Posts: 887
Re: Hardwiring a keyboard
« Reply #10 on: Sun, 06 July 2014, 02:49:00 »
You need diodes if you have matrix which has both number of rows and columns bigger than one and (at the same time) you want to detect 3 or more simultaneous key presses correctly (without ghosting). This seems to explain it in detail: http://www.dribin.org/dave/keyboard/one_html/

Offline HotKillerZzz

  • Thread Starter
  • Posts: 120
  • Location: Singapore
  • Ammesia
Re: Hardwiring a keyboard
« Reply #11 on: Sun, 06 July 2014, 04:15:09 »
You need diodes if you have matrix which has both number of rows and columns bigger than one and (at the same time) you want to detect 3 or more simultaneous key presses correctly (without ghosting). This seems to explain it in detail: http://www.dribin.org/dave/keyboard/one_html/

Oh Thanks!!
now i understand, how about resistors?

Offline vvp

  • Posts: 887
Re: Hardwiring a keyboard
« Reply #12 on: Sun, 06 July 2014, 04:34:23 »
You need resistors only as pull-ups so that signal level is defined when input is disconnected (i.e. when no keyboard switch is pressed). We connect each input using a resistor to Vcc. You typically do not need separate resistors since the micro controller (e.g. ATmega32u4) typically has internal pull-ups. So you configure your micro controller input ports with internal pull-ups enabled and you do not need discrete resistor components.

In other words you always need pull up (xor pull down) resistors when scanning a keyboard matrix but your micro controller may have  them built in and, in such case, they do not need to be bought separately.

BTW, if you would decide that you do not mind ghost key presses and go without diodes then you need a micro controller which provides open collector output. AFAIK, ATmega32u4 does not have open collector output option built in so you would need to convert TTL to open collector. Maybe there are chips just for this but if not then a simple cmos transistor array will do.

Offline swill

  • * Elevated Elder
  • Posts: 3365
  • Location: Canada eh
  • builder & enabler
    • swillkb.com
Re: Hardwiring a keyboard
« Reply #13 on: Sun, 06 July 2014, 06:45:37 »
What do you need the resistors for?

You need resistors if you are going to put LEDS on the board. Even ones like caps lock, num lock, etc.

Offline HotKillerZzz

  • Thread Starter
  • Posts: 120
  • Location: Singapore
  • Ammesia
Re: Hardwiring a keyboard
« Reply #14 on: Sun, 06 July 2014, 07:56:36 »
Oh ok, I get it.
So i am going to make a 5 by 5 keyboard. How should I wire them up?
It would be best If you can provide a diagram as I have 0 experience in this.
Thanks.

Offline jacobolus

  • Posts: 3661
  • Location: San Francisco, CA

Offline HotKillerZzz

  • Thread Starter
  • Posts: 120
  • Location: Singapore
  • Ammesia
Re: Hardwiring a keyboard
« Reply #16 on: Sun, 06 July 2014, 09:30:33 »
Ok I get it, then how do I connect to the pins on the teensy?

Offline HotKillerZzz

  • Thread Starter
  • Posts: 120
  • Location: Singapore
  • Ammesia
Re: Hardwiring a keyboard
« Reply #17 on: Mon, 07 July 2014, 02:49:04 »
ok i figured how to solder the teensy and the wires but how do you program it. is there like a templatee for a 5x5 matrix?

Offline Zekromtor

  • Posts: 241
    • My Setup
Re: Hardwiring a keyboard
« Reply #18 on: Mon, 07 July 2014, 04:58:53 »

Offline Melvang

  • Exquisite Lord of Bumfluff
  • * Maker
  • Posts: 4398
  • Location: Waterloo, IA
  • Melvang's Desktop Customs
Re: Hardwiring a keyboard
« Reply #19 on: Mon, 07 July 2014, 05:36:53 »
http://geekhack.org/index.php?topic=51252.0
Can use that.

Won't work for this project as nothing in the list for supported boards is a simple 5x5 layout and the software doesn't support custom layouts.  Custom written firmware is going to be the way to go.

Search on how to write and compile a firmware using tmk.
OG Kishsaver, Razer Orbweaver clears and reds with blue LEDs, and Razer Naga Epic.   "Great minds crawl in the same sewer"  Uncle Rich

Offline HotKillerZzz

  • Thread Starter
  • Posts: 120
  • Location: Singapore
  • Ammesia
Re: Hardwiring a keyboard
« Reply #20 on: Mon, 07 July 2014, 05:44:49 »
http://geekhack.org/index.php?topic=51252.0
Can use that.

Won't work for this project as nothing in the list for supported boards is a simple 5x5 layout and the software doesn't support custom layouts.  Custom written firmware is going to be the way to go.

Search on how to write and compile a firmware using tmk.
it really wouldnt work?
Wont it like just read the first 5x5 box?

Offline jacobolus

  • Posts: 3661
  • Location: San Francisco, CA
Re: Hardwiring a keyboard
« Reply #21 on: Mon, 07 July 2014, 14:25:42 »
I think hasu’s tmk_keyboard firmware is your best bet:
https://github.com/tmk/tmk_keyboard
http://geekhack.org/index.php?topic=41989

Offline dorkvader

  • Posts: 6288
  • Location: Boston area
  • all about the "hack" in "geekhack"
Re: Hardwiring a keyboard
« Reply #22 on: Mon, 07 July 2014, 16:52:26 »
I much prefer soarer's keyboard controller firmware. It was very easy for me to set up, use, and test, and you dont have to compile code or whatever.
http://geekhack.org/index.php?topic=50437.0

After some frustration, I gave up on TMK_firmware. I have no further experience with it.

Offline HotKillerZzz

  • Thread Starter
  • Posts: 120
  • Location: Singapore
  • Ammesia
Re: Hardwiring a keyboard
« Reply #23 on: Tue, 08 July 2014, 03:12:32 »
I much prefer soarer's keyboard controller firmware. It was very easy for me to set up, use, and test, and you dont have to compile code or whatever.
http://geekhack.org/index.php?topic=50437.0

After some frustration, I gave up on TMK_firmware. I have no further experience with it.

so which file do i edit in the config?

Offline HotKillerZzz

  • Thread Starter
  • Posts: 120
  • Location: Singapore
  • Ammesia
Re: Hardwiring a keyboard
« Reply #24 on: Tue, 08 July 2014, 03:46:09 »
Thank you everyone for their help, I have built my own firmware using (http://deskthority.net/workshop-f7/how-to-build-your-very-own-keyboard-firmware-t7177.html).
When my teensy arrives in my mail box, I will be able to start building.
THANKS!

Offline HotKillerZzz

  • Thread Starter
  • Posts: 120
  • Location: Singapore
  • Ammesia
Re: Hardwiring a keyboard
« Reply #25 on: Sun, 20 July 2014, 08:39:34 »
Ok, so now i want to add leds, how do i go about doing it?

Offline HotKillerZzz

  • Thread Starter
  • Posts: 120
  • Location: Singapore
  • Ammesia
Re: Hardwiring a keyboard
« Reply #26 on: Tue, 22 July 2014, 07:07:03 »
Ok, so now i want to add leds, how do i go about doing it?
Help?