{"id":1634,"date":"2013-12-12T17:05:59","date_gmt":"2013-12-12T15:05:59","guid":{"rendered":"http:\/\/blog.cipworx.org\/laserman\/?p=1634"},"modified":"2013-12-14T04:03:57","modified_gmt":"2013-12-14T02:03:57","slug":"home-cockpit-pt-2-many-ios","status":"publish","type":"post","link":"https:\/\/blog.cipworx.org\/laserman\/2013\/12\/12\/home-cockpit-pt-2-many-ios\/","title":{"rendered":"Home Cockpit Pt.2: many IOs"},"content":{"rendered":"<p>I counted the number of IO Pins that I need for all the display,LEDs, buttons and switches. Without additional chips it would be: 57 input and 32 output. That&#8217;s too much, even for a Mega2560. So I was thinking about various options like&#8230; <\/p>\n<p>* master-slave 2 or more Atmega controllers<br \/>\n* separate controllers for in and out, each with it&#8217;s own USB<br \/>\n* shift registers (74LS164 or 74HC595) for output<br \/>\n* matrix for in &#038; out<br \/>\n* MAX7219 for up to 64 LEDs in a matrix<\/p>\n<p>Here&#8217;s my plan:<br \/>\n<strong>OUTPUT:<\/strong><br \/>\nI use 2 shift-register ICs for all the Data &#038; CE lines of the alphanumeric display<br \/>\nand connect A0, A1 and WR of the display direct to the controller.<br \/>\nI use a MAX7219 for all LEDs.<br \/>\nResult: a total of 8 output pins of the microcontroller.<\/p>\n<p><strong>INPUT:<\/strong><br \/>\nI want to connect all 6 rotaray encoders directly to the  microcontroller to get the best<br \/>\ntiming, so 12 input lines for that.<br \/>\nFor the remaining buttons &#038; switches I use a 8&#215;6 matrix (with 45 diodes)<br \/>\nTo scan the 8 rows I want to use a 1-out-of-8 (3bit) binary decoder chip<br \/>\nResult:  a total of 21 pins used for input.<\/p>\n<p>With 4 additional chips I reduced the amount of needed IO pins from 89 to 29.<br \/>\nWith the MAX7219 I have the option of adding many more LEDs If I want and on the input side I can still add 3 more switches or buttons to the matrix.<\/p>\n<p>When using only one microcontoller (the Atmega32 has 30 IO + TX &#038; RX) then I can update the display quickly when I turn the rotaries without communicating with Flightgear immediately.<br \/>\nI hope that USB serial is enough for everything that I want and there is no need for USB HID for this device.<\/p>\n<p>UPDATE:<br \/>\nYesterday I had the good(?) idea to use 4 shift registers instead of<br \/>\n2 shift registers + MAX7219. So I started to build a board with 4 x 74HC595 with all 32 outputs going to a 34-pin connector where I&#8217;ll plug in a ribbon cable. After finishig my board it came to my mind again what knew already but did forget: <\/p>\n<p>* the max. output current of the 74HC595 is very limited (75mA per chip, 35mA per output)<br \/>\n* I&#8217;ll need a resistor for every LED &#8211; (which is not the case with the  MAX7219)<\/p>\n<p>I might get away with it because I tried a red LED with 475 ohms to 5V: It is not very bright, but needs only 6,5mA this way.<br \/>\nI can&#8217;t use low current LEDs because they are all integrated in the buttons.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I counted the number of IO Pins that I need for all the display,LEDs, buttons and switches. Without additional chips it would be: 57 input and 32 output. That&#8217;s too much, even for a Mega2560. So I was thinking about various options like&#8230; * master-slave 2 or more Atmega controllers * separate controllers for in [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,13],"tags":[],"class_list":["post-1634","post","type-post","status-publish","format-standard","hentry","category-electronics","category-fly"],"_links":{"self":[{"href":"https:\/\/blog.cipworx.org\/laserman\/wp-json\/wp\/v2\/posts\/1634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.cipworx.org\/laserman\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.cipworx.org\/laserman\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.cipworx.org\/laserman\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.cipworx.org\/laserman\/wp-json\/wp\/v2\/comments?post=1634"}],"version-history":[{"count":4,"href":"https:\/\/blog.cipworx.org\/laserman\/wp-json\/wp\/v2\/posts\/1634\/revisions"}],"predecessor-version":[{"id":1637,"href":"https:\/\/blog.cipworx.org\/laserman\/wp-json\/wp\/v2\/posts\/1634\/revisions\/1637"}],"wp:attachment":[{"href":"https:\/\/blog.cipworx.org\/laserman\/wp-json\/wp\/v2\/media?parent=1634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.cipworx.org\/laserman\/wp-json\/wp\/v2\/categories?post=1634"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.cipworx.org\/laserman\/wp-json\/wp\/v2\/tags?post=1634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}