SparkFun Key Counter - PS2

This is a small device designed to receive and transmit PS2 commands. The ATmega168 can receive PS2 commands from a mouse or keyboard and pass them out to a terminal or computer. Power is obtained from the computer or terminal over PS2. This device was originally designed to count the number of keystrokes in our Key Counter tutorial. A good, simple development board for the ATmega168 and the PS2 protocol.

``` Key presses today: 000439324

You will need a miniDIN6 male to male cable to connect this device to a computer or terminal. We've successfully used the miniDIN8 Roomba cable listed below.

SparkFun Key Counter - PS2 Product Help and Resources

Core Skill: Programming

If a board needs code or communicates somehow, you're going to need to know how to program or interface with it. The programming skill is all about communication and code.

1 Programming

Skill Level: Noob - Programming will be limited to basic drag and drop interfaces like ModKit or Scratch. You won't be writing code, but you will still need to understand some basics of interfacing with hardware. If you?re just using a sensor, it's output is analog.
See all skill levels

Core Skill: Electrical Prototyping

If it requires power, you need to know how much, what all the pins do, and how to hook it up. You may need to reference datasheets, schematics, and know the ins and outs of electronics.

1 Electrical Prototyping

Skill Level: Noob - You don't need to reference a datasheet, but you will need to know basic power requirements.
See all skill levels


Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • Wouternet / about 13 years ago / 2

    it's so easy to make a keylogger with this...

  • GuySmiley / about 11 years ago / 1

    Would this still work with a USB to PS2 adapter? Also, are there any other examples out there of what this thing can do?

  • Elitism / about 12 years ago / 1

    Can RX/TX be used to record the keys and play them back like a macro using an application to send the data to this card?

    • since it's reading and repeating the keystrokes, you should be able to modify the software to do this. but you would need to re-write the software.

      check out the USB host shield as well. OR...

      check out this:

      It's from the Practical Arduino book we carry.

      • Elitism / about 12 years ago * / 1

        I'd actually like a device like above, whic has serial rx/tx which i can actually mimic the keys though ps2 using visual studio to interact through the board using a serial interface cable

        or something which can just mimic keys given the proper code? through the ps2 port? or usb?

        It may sound weird but something like a host injector?

        Keyboard>-->PS2 Device>---->PC (Receives: Hello) ^^^^ ||||(RX/TX Com with serial/ps2 Device) Serial Cable>----->PC>--->software write(Hello)\/ ^------------------------------------

        And i've never used audrino, i either use chips i can't program (But can send codes to which has a pre-coded function) to do the job or PICAXE chips which i program regulary.

        I'd gladly pay 50-70 pounds for such device :) Maybe you guys at sparkfun could colaberate with me so i can tell you what i need and you can build it and give me a price before hand? a single custom one off build?

        Here is a graphical illustration:

        • Sorry, we do not do one-off boards or custom builds.

          Do some searching for this on the internet and you'll find it's very easy with Arduino. Check my link above. There is a lot of information out there.

          • Elitism / about 12 years ago / 1

            Aparently it's much more complicated with arduino, i purchased the arduino mega almost a week ago and you have to reburn the bootloader with the hid capabilities which removes all ability to reprogram the arduino through the usb which means you have to use an avr programmer which is absolutely not what i was looking for.


              go to this link. you will find out it's much simpler than you're making it out to be. the arduino can EASILY show up as a keyboard without removing the bootloader.

              • Elitism / about 12 years ago / 1

                I cannot find where to buy this device i've looked for it everywhere, out of stock for months now

                • It's something you'd need to build. It just exists as a project. Check the schematic, it's only a few parts (all very inexpensive) with an arduino.

                  • Elitism / about 12 years ago / 1

                    Can you provide me with the links to the parts? some of the parts in the diagram are confusing me, i'd rather have someone with much more of an understanding of electronics to help me out, thanks robert

                    • It takes a 2.2K ohm resistor, 2 68 ohm resistors, and 2 3.6V zener diodes. We don't individually sell these parts (other than the resistors in the resistor kit.

          • Elitism / about 12 years ago / 1

            such a shame, school teachers would have loved this for helping students out

  • Tempest2k8 / about 13 years ago / 1

    This is a good canidate for this. PS/2 to USB Keyboard Converter

  • Note to Nate and/or others. I agree with JDTucker that this board has possibilities. I am using one to adapt a standard PC keyboard to ASCII by translating the keycodes (and there are a lot of them) into ASCII and sending it out the serial port to another AVR. If the unused pins were brought out, my options would be greater to further exploit this board. Guess I better buy a hot-air gun and learn to attach hair-like wires!
    One slight stumbling block I discovered in my testing concerns the baud rate for the serial port and the clock speed. By using the AVR default clock rate and divide by 8, the bit-rate divisor at 9600 baud has a 7% error factor. My K-107 style LCD display would not work with that high an error factor. Digging into the Datasheet revealed the Double Speed option for AVR Serial Ports. I added a line of code to double the speed and adjusted the baud rate in the formula (which lowered the err factor to .2%) - lo & behold - it worked! Details avail for those similarly affected.

  • JDTucker / about 14 years ago / 1

    I like this (and may buy a couple, after I figure out if they can function as 5v to 3.3v converters), but I would have liked it better if the unused pins on the '168 were pinned out, at least to pads.

Customer Reviews

No reviews yet.