{"id":78,"date":"2019-11-23T23:38:50","date_gmt":"2019-11-24T05:38:50","guid":{"rendered":"https:\/\/torensmith.com\/?p=78"},"modified":"2020-12-19T19:37:53","modified_gmt":"2020-12-20T01:37:53","slug":"keyboard-tinkering-part-1","status":"publish","type":"post","link":"https:\/\/torensmith.com\/?p=78","title":{"rendered":"Keyboard Tinkering, Part 1"},"content":{"rendered":"\n<p>There seem to be a few different models of NMB keyboards, but they mostly boil down to some that are more wedge-shaped but have thinner bezels, and some that are flatter but have a larger bezel. I&#8217;ve only ever found one model that was new enough to have Windows keys, and it&#8217;s one of the thin ones that takes up a lot of space.<\/p>\n\n\n\n<p>I started by mapping out the pinout of the microcontroller; I think I even found some official documentation at some point. But I ended up with a list of which pins on the 40-pin chip were rows, which were columns, which were capslock\/numlock\/scrolllock LEDs, and which were power and ground. The rest didn&#8217;t really matter.<\/p>\n\n\n\n<p>The NMB keyboards have a matrix with 8 rows and 16 columns. Unfortunately, the bluetooth microcontrollers available didn&#8217;t have enough IO pins to connect directly to all of these. My solution was to pick up some IO expander chips (the MCP23017). It&#8217;s connected via i2c, so all it needs from the microcontroller is four pins (power, ground, clock, and data). It provides 16 IO pins.<\/p>\n\n\n\n<p>The bluetooth microcontroller I picked was the (then relatively new) NRF52 Feather board from Adafruit. The first version of the board had a bug that prevented it from going into very low power mode (because it was powering the USB->serial chip off of the battery), but it was still a nice board.<\/p>\n\n\n\n<p>For the first version of this, I put one of the expander chips on some prototype board, connected it to the bluetooth microcontroller, and then connected the expander chip to the columns, and the bluetooth board to the rows and LEDs. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1303-768x1024.jpg\" alt=\"\" class=\"wp-image-79\" srcset=\"https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1303-768x1024.jpg 768w, https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1303-225x300.jpg 225w, https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1303-1152x1536.jpg 1152w, https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1303-1536x2048.jpg 1536w, https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1303-scaled.jpg 1920w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><figcaption>IO Expander on protoboard.<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1302-1024x768.jpg\" alt=\"\" class=\"wp-image-80\" srcset=\"https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1302-1024x768.jpg 1024w, https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1302-300x225.jpg 300w, https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1302-768x576.jpg 768w, https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1302-1536x1152.jpg 1536w, https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1302-2048x1536.jpg 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Battery, bluetooth controller, USB connector (charging\/programming), and expander board.<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1300-1024x768.jpg\" alt=\"\" class=\"wp-image-81\" srcset=\"https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1300-1024x768.jpg 1024w, https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1300-300x225.jpg 300w, https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1300-768x576.jpg 768w, https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1300-1536x1152.jpg 1536w, https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1300-2048x1536.jpg 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>16 wires from the expander lead to the column pins.<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1301-1024x768.jpg\" alt=\"\" class=\"wp-image-82\" srcset=\"https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1301-1024x768.jpg 1024w, https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1301-300x225.jpg 300w, https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1301-768x576.jpg 768w, https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1301-1536x1152.jpg 1536w, https:\/\/torensmith.com\/wp-content\/uploads\/2019\/11\/IMG_1301-2048x1536.jpg 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>The rows and LEDs were connected from the back of the board, leading directly to the bluetooth board.<\/figcaption><\/figure>\n\n\n\n<p>This worked, but I really wasn&#8217;t happy with the mess of wires on both sides of the board. I was determined to follow it up with a version that cleaned up or eliminated a lot of the wiring.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There seem to be a few different models of NMB keyboards, but they mostly boil down to some that are more wedge-shaped but have thinner bezels, and some that are flatter but have a larger bezel. I&#8217;ve only ever found one model that was new enough to have Windows keys, and it&#8217;s one of the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[1],"tags":[9,6,7],"class_list":["post-78","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-keyboard","tag-nmb","tag-space-invaders"],"_links":{"self":[{"href":"https:\/\/torensmith.com\/index.php?rest_route=\/wp\/v2\/posts\/78","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/torensmith.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/torensmith.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/torensmith.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/torensmith.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=78"}],"version-history":[{"count":1,"href":"https:\/\/torensmith.com\/index.php?rest_route=\/wp\/v2\/posts\/78\/revisions"}],"predecessor-version":[{"id":83,"href":"https:\/\/torensmith.com\/index.php?rest_route=\/wp\/v2\/posts\/78\/revisions\/83"}],"wp:attachment":[{"href":"https:\/\/torensmith.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/torensmith.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/torensmith.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}