keybrd library is an open source library for creating custom-keyboard firmware.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

tutorial_1_breadboard_keyboard.md 6.3KB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
7 years ago
8 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. Tutorial 1 - breadboard keyboard
  2. ================================
  3. In this tutorial, you will build a breadboard keyboard with 4 keys.
  4. The keyboad will be used in tutorials 2 through 7.
  5. When you finish this tutorial you will have a working keyboard and understand how a key matrix works.
  6. Why a solderless breadboard keyboard is useful
  7. ----------------------------------------------
  8. Breadboard keyboards have key matrices and diodes just like the big keyboards.
  9. A breadboard is the easiest way to learn keyboard electronics.
  10. Learning is fun when mistakes are easily corrected.
  11. Compared to PCBs, breadboard keyboards make learning faster because:
  12. * Mistakes are easily corrected; no soldering and desoldering
  13. * Parts can be reused in many different configurations
  14. * A small keyboard is easier to trouble shoot
  15. Breadboard keyboards are useful for:
  16. * learning keyboard electronics - micro controller, key matrix, diode, shift registers, I/O expander
  17. * learning the firmware development workflow
  18. * prototyping circuits before making a PCB
  19. Arduino simulation software is an alternative to breadboards; I haven't tried that.
  20. Breadboard keyboard starter kit
  21. -------------------------------
  22. The parts needed to build the tutorial Breadboard Keyboards are listed in [breadboard_keyboard_supplies.ods](breadboard_keyboard_supplies.ods).
  23. The tutorials use a Teensy LC controller, but any Arduino-compatible controller with SRAM should work.
  24. You will need two tools:
  25. * Wire cutters
  26. * A multi-meter for trouble shooting
  27. Wire striper and lead forming tool are optional.
  28. How a breadboard works
  29. ----------------------
  30. To understand the breadboard keyboard you will need to know the internal parts of a breadboard:
  31. * bus strip
  32. * terminal strip
  33. These are explained in [How to Use a Breadboard](https://learn.sparkfun.com/tutorials/how-to-use-a-breadboard)
  34. Building a basic breadboard keyboard
  35. ------------------------------------
  36. The basic breadboard keyboard has 4 switches.
  37. ![basic breadboard keyboard](keybrd_1_breadboard/breadboard_keyboard_2x2.JPG "basic breadboard keyboard")
  38. A Teensy LC microcontroller in on the left.
  39. A key matrix with 4 switches is to the right.
  40. The key matrix has two two columns.
  41. Short wires connect terminal strips into matrix columns.
  42. Jumper wires connect the columns to the microcontroller.
  43. Two bus strips are used as matrix rows.
  44. A jumper connects the top row to the microcontroller.
  45. A short wire connects the bottom row to the microcontroller.
  46. Switch-diode pairs, in series, connect rows to columns.
  47. Tutorials 2 and 3 use the basic breadboard keyboard pictured above.
  48. Tutorials 4, 5, and 6 will add more components to the basic breadboard keyboard.
  49. Positioning components as shown in the picture will provide space for those components.
  50. Breadboard keyboard assembly instructions:
  51. 1. Bend and cut leads to fit breadboard.
  52. * tactile-switch-lead
  53. * diodes (save the cut offs for steps 2, 3, and tutorial 4)
  54. ![bend diodes](keybrd_1_breadboard/diodes_bend_en_masse.JPG "bend diodes")
  55. ![cut diodes](keybrd_1_breadboard/diodes_cut.JPG "cut diodes")
  56. 2. Insert parts into the breadboard as shown in the picture.
  57. * The breadboard is oriented with the red bus strips on top and blue bus strips on the bottom
  58. (this is important because tutorials will refer to the "red bus" and the "blue bus")
  59. * Teensy LC is on the left
  60. * switch leads are oriented to connect diodes to columns (pictured below)
  61. * diode cut offs connect terminal strips into columns
  62. * diodes connect switches to blue buses, orient with cathode (banded end) towards the row (bus strip)
  63. ![switch orientation](keybrd_1_breadboard/switch_orientation.JPG "switch orientation")
  64. ![basic breadboard keyboard overhead](keybrd_1_breadboard/breadboard_keyboard_2x2_overhead.JPG "basic breadboard keyboard overhead")
  65. 3. Insert jumper wires to connect Arduino pins to the matrix rows and columns.
  66. * [Teensy LC pinout diagram](https://www.pjrc.com/teensy/card6a_rev2.png).
  67. * row_0 is the top row, and col_0 is the left column
  68. | Pin number | Connects to |
  69. |------------|-------------|
  70. | 0 | row_0 |
  71. | 1 | row_1 |
  72. | 14 | col_0 |
  73. | 15 | col_1 |
  74. Compiling and loading the keyboard firmware
  75. -------------------------------------------
  76. Follow the [keybrd Library User's Guide](../doc/keybrd_library_user_guide.md) to set up the Arduino environment.
  77. Compile and load the [keybrd_1_breadboard.ino](/tutorials/keybrd_1_breadboard/keybrd_1_breadboard.ino) sketch into the keyboard's controller.
  78. The operating system will take 1 to 6 seconds to recognize the USB keyboard.
  79. Then pressing the keys should type the characters 1, a, b, c.
  80. How a key matrix works
  81. ----------------------
  82. Congratulations, you have a working breadboard keyboard.
  83. Now we fill in some details of how it all works.
  84. This excellent article explains how key matrix, diodes, and ghosting work:
  85. [How a Key Matrix Work](http://pcbheaven.com/wikipages/How_Key_Matrices_Works/)
  86. In the article:
  87. output pins power columns and input pins detect the power on rows.
  88. The breadboard keyboards in this series of tutorials do it the other way:
  89. output pins power rows and input pins detect the power on columns.
  90. The keybrd library uses the word "strobe".
  91. Strobe pins are output pins connected to rows.
  92. One row at a time is strobed for the purpose of reading input pins.
  93. Exercises
  94. ---------
  95. 1) replace the diodes with wires (cutoffs) and intentionally cause ghosting.
  96. <br>
  97. <a rel="license" href="https://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by/4.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">keybrd tutorial</span> by <a xmlns:cc="https://creativecommons.org/ns" href="https://github.com/wolfv6/keybrd" property="cc:attributionName" rel="cc:attributionURL">Wolfram Volpi</a> is licensed under a <a rel="license" href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.<br />Permissions beyond the scope of this license may be available at <a xmlns:cc="https://creativecommons.org/ns" href="https://github.com/wolfv6/keybrd/issues/new" rel="cc:morePermissions">https://github.com/wolfv6/keybrd/issues/new</a>.