element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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
Arduino
  • Products
  • More
Arduino
Arduino Forum How to use Arduino Uno to connect USB keyboard to matrix keyboard?
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 8 replies
  • Answers 1 answer
  • Subscribers 393 subscribers
  • Views 1643 views
  • Users 0 members are here
  • ports
  • keyboard
  • matrix
  • usb
  • timing
  • uno
  • reducing
Related

How to use Arduino Uno to connect USB keyboard to matrix keyboard?

Former Member
Former Member over 12 years ago

Either I am looking in the wrong places or nobody has done this before.

 

What I am looking for is a way to read a USB keyboard that is attached to an extra USB port (as in the examples with D- and D+ to two/three? ports) and then write a matrix code to output.

 

To explain what I am trying to do in more detail. The old Sinclair ZX computers have a matrix keyboard.

For example the ZX81 has a 5x8 matrix. Five lines are selected one by one and pulled low over and over again. The pressed key pulls one out of 8 columns low. Shift key is special as it is the switch for the first bit only.

These membrane matrix keyboards tend to breakdown, their life expectancy is lower than 30 years :-)

So I'd like to find some way of using a standard USB keyboard instead.

 

I see several challenges:

 

1. Reading the USB keyboard. Looks like the USBHost library cannot be used for this???

 

2. Reading 5 lines (5x8 matrix) from the old retro computer line-select output (via interrupts), then if a character was received from the keyboard, translating it into 8 bit output. Should be doable as I know exactly which key is on what location, for instance if the current line is the first one, and a key '3' has been pressed without shift, then I can send a 00010000 byte, the first bit being shift. If the key was shift-3 (like '#' on some keyboards) then send 10010000.

 

3. Probably I got a shortage of ports on the Uno, if 3+5+8 are needed. Perhaps a way to feed a shift register with 8 bits output through one/two ports?

Or use the chipKIT Max32 that I have for this, hmmm lots more ports.

 

4. Somehow adjust to the timing factors of the old computer (keyboard repeats? control-shift-alt combinations?) and utilize buffers from the USB keyboard...

Of course the timing from the interrupts has the most important role. But I suspect the USB keyboard works with keypresses and releases, that might complicate things?

 

Can you guys please advise.

 

Regards, Martin

  • Sign in to reply
  • Cancel

Top Replies

  • Former Member
    Former Member over 10 years ago +1 verified
    Update. As no one solved this problem I have initiated a project for doing this. This project is finally finished: I have now an Arduino Uno with USB Host Shield, the USB Host Library 2.0 (from GitHub…
Parents
  • Former Member
    0 Former Member over 10 years ago

    Update.

    As no one solved this problem I have initiated a project for doing this.

     

    This project is finally finished: I have now an Arduino Uno with USB Host Shield, the USB Host Library 2.0 (from GitHub) with the example USBHIDBootKbd augmented to translate a pressed key on the USB keyboard into an 8 by 5 bit code.

    I use a digital switch interface, based on two 74HC4051 chips (if you need the design please let me know), to connect the ZX81 A8-A15 address lines to D0-D4 datalines. The Shift key has a A8-D0 bypass using a 4066 chip.

    Arduino uses output 3 ports (A8-A15) + 3 ports (D0-D4) + 1 port (enable) + 1 port (Shift) and works independantly from ZX81 timing. If you need the Arduino code please let me know.

     

    Regards, Martin

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to Former Member

    Hello Martin

     

    I'm trying going a USB keyboard with Arduino UNO and a Matrix Keyboard as what you do before.

    May I take a look of your Arduino code?

     

    Regards, Merkle

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

    Hello Martin

     

    I'm trying going a USB keyboard with Arduino UNO and a Matrix Keyboard as what you do before.

    May I take a look of your Arduino code?

     

    Regards, Merkle

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

    Uploaded schematic and sketch.

    • 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