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 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
Personal Blogs
  • Community Hub
  • More
Personal Blogs
NexGen Flight Simuator How to add old ps/2 keyboard interface to an Arduino
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: phoenixcomm
  • Date Created: 14 May 2024 2:37 AM Date Created
  • Views 452 views
  • Likes 5 likes
  • Comments 4 comments
  • flight simulator
  • nexgen
  • diy cockpit
  • ps2_keyboard_encoder
  • arduino
  • software
Related
Recommended

How to add old ps/2 keyboard interface to an Arduino

phoenixcomm
phoenixcomm
14 May 2024

imageHow many PS/2 keyboards do you have? More than one, I'd bet. Well, stop trying to hang them on your tree, and use them not the whole thing just the encoder. BTW that's the little black thing on the rear. 

image
1----DATA
3----GROUND
4----+5 V DC at 275 ma
5----CLLK

Of the six pins, we will only use four (4) of them. So what do we need? This will use an Arduino. and get this library.
Reference > Libraries > Ps2keyboard
This library is compatible with all architectures and boards.

image
image

Lib Code My Code

PS2Keyboard keyboard;
void setup() { delay(1000); keyboard.begin(DataPin, IRQpin);
Serial.begin(9600);
Serial.println("Keyboard Test:"); }
void loop() { if (keyboard.available()) { // read the next key char c = keyboard.read(); // check for some of the special keys
if (c == PS2_ENTER) { Serial.println(); }
else if (c == PS2_TAB) { Serial.print("[Tab]"); } else if (c == PS2_ESC) { Serial.print("[ESC]"); }
else if (c == PS2_PAGEDOWN) { Serial.print("[PgDn]"); }
else if (c == PS2_PAGEUP) { Serial.print("[PgUp]"); }
else if (c == PS2_LEFTARROW) { Serial.print("[Left]"); }
else if (c == PS2_RIGHTARROW) { Serial.print("[Right]"); }
else if (c == PS2_UPARROW) { Serial.print("[Up]"); }
else if (c == PS2_DOWNARROW) { Serial.print("[Down]"); }
else if (c == PS2_DELETE) { Serial.print("[Del]"); }
else { // otherwise, just print all normal characters Serial.print(c); } } }

#include const int DataPin = 8;
const int IRQpin = 5;

void setup() { delay(1000); keyboard.begin(DataPin, IRQpin);
Serial.begin(9600);
 }

keyboard()check for some of the special keys
switch (keycode)

case ENTER:{ doLine();}  // Send line to the processor.
break;
case CAPS: // USE AS ALPHA
default:{ // Keys that are not defined
}break;

  • Sign in to reply
Parents
  • DAB
    DAB over 1 year ago

    I got rid of most of mine when I upgraded my computer.

    I now have everything on USB.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • DAB
    DAB over 1 year ago

    I got rid of most of mine when I upgraded my computer.

    I now have everything on USB.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • phoenixcomm
    phoenixcomm over 1 year ago in reply to DAB

     DAB Hope do didn't toss the real IBM XT/AT keyboard with interchangeable cable! it was the best keyboard ever made. Great finger feel and feedback! I may still have one downstairs in the garage. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 1 year ago in reply to phoenixcomm

    Most of them were Dell keyboards, which were pretty good, but a guy was refurbishing old machines to get kids on the internet, so I gave them to him.

    I might have at least one of the IBM keyboards somewhere in my stash.

    I still have an original TEMPEST qualified IBM computer.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • phoenixcomm
    phoenixcomm over 1 year ago in reply to DAB

    cool, but when I lived in Pennington, between Princeton and Trenton. I was doing surplus, and I got a query if I wanted an old 360/50 well I said yes. and dragged it to where I lived, put on an OS, and then a Terminal Server (non-IBM) and sold time to students. the HD failed and that ended its life and I scraped it. 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • 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