element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Embedded and Microcontrollers
  • Technologies
  • More
Embedded and Microcontrollers
Embedded Forum Solutions for a very high number of inputs
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Embedded and Microcontrollers to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 18 replies
  • Answers 1 answer
  • Subscribers 476 subscribers
  • Views 1850 views
  • Users 0 members are here
  • microcontroller
  • electronics
Related

Solutions for a very high number of inputs

Former Member
Former Member over 12 years ago

I have a rather ambitious project to get started learning about microcontrollers and embedded systems. I have cheaply acquired an old organ console that is currently analog that i want to convert to digital/MIDI. The MIDI out part seems straightforward enough from a bit of Google searching, but I have no idea how to deal with the seemingly massive number of inputs I need. The current console is wired with a common rail that spans each keyboard, voice bank, etc., then each key is individually wired. The straightforward approach to this would seem to indicate that I need 300+ input connections. I understand the concept of shift registers for pulling in all of those lines, but I'm worried about being able to read them fast enough to get me the nearly real-time response I need to make it a usable musical instrument. Thoughts?

  • Sign in to reply
  • Cancel

Top Replies

  • D_Hersey
    D_Hersey over 11 years ago +1
    If I knew your circuit topology for your keyboard, I feel I could be more helpful, that said, couple o' deze, meebe: PCA9505/06 :: NXP Semiconductors
  • michaelkellett
    0 michaelkellett over 12 years ago

    It's not so hard,

     

    I'll assume that 1mS latency is good  enough, so you need  a 300kHz clock on your shift register, and thats assuming that you use just one serial stream for all your inputs.

     

    A bigger problem will be wiring it all up, if I were doing this I would design  a little board with about 32 inputs (using  a 64 pin micro) and put these where physically convenient to reduce the amount of wire. Then link the little boards to a cenrtal controller using CAN, RS485, or whatever you prefer.

     

    An STM32F100R4T6B is £1.98 from farnell, has 64 pins so will give you 32 inputs and a serial link with no need for shift registers. You'll need to design a board but its not too hard.

     

    Let me know if you fancy going this way and I might be able to help a bit more.

     

    MK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • johnbeetem
    0 johnbeetem over 12 years ago

    I actually designed something similar to this several decades ago.  First, some general comments:

     

    1.  Don't worry about "near real-time response".  MIDI only runs at 31.25 kb/s, so you're going to have some delays unless you use time-stamping.  A small amount of delay is actually good because real musicians don't play notes at exactly the same time and if you synthesizer does it will sound artificial.  The same goes for pitch -- I've heard synthesized music sounds more natural if instruments are slightly out of tune with respect to each other.  Of course, you don't want to go too far: "What's the difference between the first chair viola and the last chair viola?  Answer: A measure and a semi-tone."

     

    2.  Do worry about switch bounce.  Mechanical switches do not produce clean on/off transistions.  They tend to bounce between on and off until the contacts settle.  You'll need to filter out these transistions.

     

    So let me tell you what I did back then.  Since the technology was rather different, I'm going to borrow from The Four Yorkshiremen.  I wanted to build a simple polyphonic electronic organ using two 37-key surplus keyboards, with a one-octave overlap to give the usual 61-key organ keyboard range.  These keyboards didn't have switches: "Your keyboard has actual switches?  Pffaaa -- I had to make my own switches out of paper clips with wire insulation stuck over them, and glue each one to the end of a key -- I even had to make my own glue."  (OK, I made up the part about making my own glue.)

     

    Each key had a wire-wrap wire soldered to it and the wires were connected to the inputs of five 74150 16-to-1 multiplexers.  "Pffaaa -- back then we didn't have CMOS or even LS.  In fact, Schottky hadn't even been born yet."  Basically, the five 74150's plus a 74LS151 acted as an 80-to-1 multiplexer to select a key.  An advantage of TTL is that you don't need pull-up resistors on inputs: they automatically float high if not connected.

     

    Now the interesting part: I needed to debounce the inputs but I didn't want to add 80 resistors and capacitors.  Besides, debouncing with RC networks requires that the digital inputs have hystersis (Schmitt triggers) which 74150s don't have.  So I did the filtering digitally.  I used a 256x4 bit SRAM as a bank of 4-bit counters and then time-multiplexed logic to update the counters so that each counter was visited every 250 us or so.  Each visit would read a key's counter value into an up/down counter, increment or decrement the value depending whether the key was pressed or not (saturating at 0000 or 1111), and then write the updated value back into RAM.  If the MSb changed, it meant that the key had been pressed or released long enough for the bouncing to settle.  When MSb changed, the board would interrupt my computer (a Heathkit H-8) which would update my synthesizer board to add or delete a note.  The keyboard scanner was a couple dozen TTL and LSTTL chips and ran at 2 MHz -- a nice solution for 1977 wire-wrap technology.

     

    A scheme similar to this might work for you.  This being the 21st Century, I'd get a microcontroller board with lots of I/O pins such as an ST Discovery board and then add external multiplexers to get your 300 inputs down to 16 or 32, whichever works for your board.  You can do the filtering for 16 or 32 inputs in parallel.  If you don't know the trick, let me know.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 12 years ago in reply to michaelkellett

    This seems like an attractive solution from both a wiring and programming aspect. With a microcontroller for each small area, I could make each of them responsible for figuring out their own state changes, then send only actions which need to be taken on to a central MCU for conversion to MIDI. Correct?

     

    I must admit, though, the thought of having to design a board is a bit intimidating, as is manually soldering 10 64-pin chips to that board.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to johnbeetem

    Can you give schematic / block diagram? to understand better , for me it is difficult to understand high profile terms.

    Regards ,

    Sanjaylmbr@gmail.com

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • johnbeetem
    0 johnbeetem over 11 years ago in reply to Former Member

    Sanjay Limbore wrote:

     

    Can you give schematic / block diagram? to understand better , for me it is difficult to understand high profile terms.

    Regards ,

    Sanjaylmbr@gmail.com

    Thank you for your interest.  I probably still have the schematics and a write-up somewhere in my archives.  However, even if I can find it, it's hard copy (predates word processors and schematic editors) so I'd have to get it scanned into a PDF.  Plus, when I see the write-up I may be too embarrassed to share it -- this was some 35 years ago.  If this is important, I'll go to the trouble.  Please let me know.

     

    I think my design was a good 1978 solution for 80 keys.  However, I doubt you'd be able to get some of the parts these days.  Today I'd go with one or more micro-controllers and debounce in software.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to johnbeetem

    John...those were the days when ingenuity was really tested, bought back memories...Rod

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 11 years ago in reply to johnbeetem

    Hi,

    Single line diagram could solve my purpose, it it is difficult / trouble to find old docs , I want to built low cost organ for myself. since in my country it is difficult to get component which are normally not used . whatever easy do it for me.

    Regards

    Sanjay Limbore

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Aryldo
    0 Aryldo over 11 years ago in reply to michaelkellett

    I have never faced a problem like this but I would like to propose a different approach :

    Multiplexing.

    It's how the PC handles its keyboard.

    Each organ normal keyboard has 88 keys that could be handled by a 11 bits of input and 8 bits outputs (19 lines).

    The full organ could be handles by a 18 x 18 matrix (324 keys).

    One of the advantages of this approach is that the cabling would be done in the keyboard itself with fewer lines going to the processor(s).

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Aryldo
    0 Aryldo over 11 years ago

    Sorry, my last message should have been addressed to you, Alex.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • johnbeetem
    0 johnbeetem over 11 years ago in reply to Aryldo

    Aryldo Russo wrote:

     

    I have never faced a problem like this but I would like to propose a different approach :

    Multiplexing.

    It's how the PC handles its keyboard.

    Each organ normal keyboard has 88 keys that could be handled by a 11 bits of input and 8 bits outputs (19 lines).

    The full organ could be handles by a 18 x 18 matrix (324 keys).

    One of the advantages of this approach is that the cabling would be done in the keyboard itself with fewer lines going to the processor(s).

    That's a good solution if you have isolated switches.  In my 1977 design the switches had a common ground, so multiplexing had to be done using ICs.

     

    For a polyphonic keyboard each switch needs a diode.  http://en.wikipedia.org/wiki/Keyboard_matrix_circuit

     

    BTW, organ manuals typically have 61 keys (5 octaves plus an extra C).  Modern piano keyboards have 88 keys.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube