keybrd library is an open source library for creating custom-keyboard firmware.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
Este repositório está arquivado. Você pode visualizar os arquivos e realizar clone, mas não poderá realizar push nem abrir issues e pull requests.

tutorial_1_breadboard_keyboard.md 7.2KB

8 anos atrás
8 anos atrás
8 anos atrás
8 anos atrás
8 anos atrás
8 anos atrás
7 anos atrás
8 anos atrás
8 anos atrás
8 anos atrás
8 anos atrás
8 anos atrás
7 anos atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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 an understanding of 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 - microcontroller, key matrix, diode, shift registers, I/O expander
  17. * learning the keyboard-development workflow
  18. * prototyping circuits before making a PCB
  19. Breadboard keyboard starter kit
  20. -------------------------------
  21. The parts needed to build the tutorial breadboard keyboards are listed in [breadboard_keyboard_supplies.ods](breadboard_keyboard_supplies.ods).
  22. The tutorials use a Teensy LC controller, but any Arduino-compatible controller with at least 2 KB SRAM should work.
  23. You will need two tools:
  24. * Wire cutters
  25. * A multi-meter for trouble shooting
  26. Wire striper, lead-forming tool, and Anti-static mat are optional.
  27. How a breadboard works
  28. ----------------------
  29. To understand the breadboard keyboard you will need to know the internal parts of a breadboard:
  30. * bus strip
  31. * terminal strip
  32. These are explained in [How to Use a Breadboard](https://learn.sparkfun.com/tutorials/how-to-use-a-breadboard)
  33. Electrostatic discharge (ESD) safety
  34. ------------------------------------
  35. Static electricity can damage a ICs in ways that are hard to trouble shoot.
  36. Here is a ESD precaution for handling ICs:
  37. 1. Touch the bare metal on the back of my desktop computer (its grounded).
  38. 2. Then touch the IC or circuit (if its a micro-controller, touch the metal USB connector case).
  39. I take these ESD precaution because I live in a dry environment on a carpeted floor.
  40. Not everyone needs to take ESD precautions:
  41. * http://forum.arduino.cc/index.php?topic=4643.0
  42. * https://forums.adafruit.com/viewtopic.php?f=8&t=12128
  43. Anti-static mat or anti-static wristband are also effective.
  44. But being tethered by an anti-static wristband can be inconvenient (wireless antistatic wrist straps are a scam).
  45. Building a basic breadboard keyboard
  46. ------------------------------------
  47. The basic breadboard keyboard has 4 switches.
  48. ![basic breadboard keyboard](keybrd_1_breadboard/basic_breadboard_keyboard_front.JPG "basic breadboard keyboard")
  49. A Teensy LC microcontroller is on the left.
  50. A key matrix with 4 switches is to the right.
  51. The key matrix has two two columns.
  52. Short wires connect terminal strips into matrix columns.
  53. Jumper wires connect the columns to the microcontroller.
  54. Two bus strips are used as matrix rows.
  55. A jumper connects the top row to the microcontroller.
  56. A short wire connects the bottom row to the microcontroller.
  57. A switches and diodes connect rows to columns.
  58. Tutorials 2 and 3 use the same basic breadboard keyboard pictured above.
  59. Tutorials 4, 5, and 6 add more components to the basic breadboard keyboard.
  60. Positioning components as shown in the picture will provide space for those components.
  61. Breadboard keyboard assembly instructions:
  62. 1. Shape leads to fit breadboard.
  63. * cut tactile-switch leads to length
  64. * bend and cut diode leads (save the cut offs for steps 2, 3, and tutorial 4)
  65. ![bend diodes](keybrd_1_breadboard/diodes_bend_en_masse.JPG "bend diodes")
  66. ![cut diodes](keybrd_1_breadboard/diodes_cut.JPG "cut diodes")
  67. 2. Insert parts into the breadboard as shown in the picture.
  68. * The breadboard is oriented with the red bus strips on top and blue bus strips on the bottom
  69. (this is important because tutorials will refer to the "red bus" and the "blue bus")
  70. * Teensy LC is on the left
  71. * switch leads are oriented to connect diodes to columns (pictured below)
  72. * diode cut offs connect terminal strips into columns
  73. * diodes connect switches to rows; orient diodes with cathode (banded end) towards the rows (blue bus)
  74. ![switch orientation](keybrd_1_breadboard/switch_orientation.JPG "switch orientation")
  75. ![basic breadboard keyboard overhead](keybrd_1_breadboard/basic_breadboard_keyboard_overhead.JPG "basic breadboard keyboard overhead")
  76. 3. Insert jumper wires to connect Arduino pins to the matrix rows and columns.
  77. * refer to the [Teensy LC pinout diagram](https://www.pjrc.com/teensy/card6a_rev2.png).
  78. * row_0 is the top row, and col_0 is the left column
  79. | Pin number | Connects to |
  80. |------------|-------------|
  81. | 0 | row_0 |
  82. | 1 | row_1 |
  83. | 14 | col_0 |
  84. | 15 | col_1 |
  85. Compiling and loading the keyboard firmware
  86. -------------------------------------------
  87. Follow the [keybrd Library User's Guide](../doc/keybrd_library_user_guide.md) to set up the Arduino environment.
  88. Compile and load the [keybrd_1_breadboard.ino](/tutorials/keybrd_1_breadboard/keybrd_1_breadboard.ino) sketch into the keyboard's controller.
  89. The operating system will take 1 to 6 seconds to recognize the USB keyboard.
  90. Then pressing the keys should type the characters 1, 2, a, b.
  91. Congratulations, you have a working keyboard.
  92. How a key matrix works
  93. ----------------------
  94. Now we fill in some details of how it all works.
  95. This excellent article explains how key matrix, diodes, and ghosting work:
  96. [How a Key Matrix Work](http://pcbheaven.com/wikipages/How_Key_Matrices_Works/)
  97. In the article:
  98. > Output pins power columns and input pins detect the power on rows.
  99. The breadboard keyboards in this series of tutorials do it the other way:
  100. > Output pins power rows and input pins detect the power on columns.
  101. The keybrd library uses the word "strobe", which means powering one row for a very short time.
  102. Strobe pins are output pins connected to rows.
  103. One row at a time is strobed.
  104. While a row is strobed, input pins connected to the columns sense which buttons are pressed.
  105. Exercises
  106. ---------
  107. 1) replace the diodes with wires (cutoffs) and intentionally cause ghosting.
  108. <br>
  109. <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>.