Interfacing a keyboard PS/2 with the Picaxe 21X-1 in 3 easy steps

So one thing that I have been wanting to do is connect a keyboard (PS/2) to the Picaxe.

This is the first step to a whole slew of applications. Control Robots with a keyboard, make a computer, etc...

Just offering another source of info on how to do this.

 


 

It's pretty easy to do.

Before you get started here's a list of what I used.

 

Picaxe "Canuck" 28X-1 Kit --bought from HVW Tech Canada

Standard Breadboard

Breadboard Voltage Regulator -- converts 6~18 VDC to 5VDC @ 0.5Amps, bought from HVW Tech Canada

USB Download cable -- (using the serial one won't make a difference)

You NEED two 4.7k resistors on the CLK and DATA line -- I used 20 470ohm resistors soldered together :P

*to make it look cleaner, should only be temporary*

PS/2 Port -- I got mine from an old P2 motherboard

 

 

 



Step 1: How will it connect?

 

There are several ways to go about this step:

 

If you don't want to ruin a keyboard or want to use a temporary one (until you can acquire one you're willing to spare) then..

Either desolder a keyboard port from a motherboard or connect pins/clamps to the male end of the plug.

DSC_5608.jpg

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

You could also cut the cable really short then solder pins onto the line and plug that directly into a breadboard.

 

 


Step 2: Setup your breadboard

 

Here is a picture of mine ( notice I used 10 * 470ohm resistors to get a 4.7k resistor )

The keyboard would not transmit data of any sort to the Pic unless I had these in.

DSC_5610.jpg

DSC_5611.jpg

 

The schematic from "Picaxe manual #2, Page 42"

kbd.jpg

 

 


Step 3: Code

 

From here if you're on the Picaxe 28X-1 then you have to use the command

"Kbin[timeout, address], variable"

The above command broken down;

Kbin = Keyboard input

Timeout = How long the Pic will wait until moving on to address

Address = Where to go when it timesout

Variable = Value

or

"Kbin variable"

Kbin = Keyboard input

Variable = Value

 

Here is my test code.

-------------------------------------

'Boris Jovic Keyboard Input Test

main:

kbin[1000,main],b1

debug b1

goto main

-------------------------------------

 

And that's it, the values that come back in Debug will most likely be wonky until you set each value into eeprom.

 

Thanks for reading! Good luck.

 

 

 

 

Awesome! I will have to try

Awesome! I will have to try this.

Would be fun to convert a keyboard into a funky soundmaker of somesort.

SWEET

This is good info to have. All new levels of interface possibility!

I was just offered 4 or 5 old keyboards and I turned them down because I didn’t know I could use them with my 'axe. How ironic.

Same thing happened to me, I
Same thing happened to me, I saw a garbage bin full of them at school and was going to grab one but couldn’t think of where I would use it :stuck_out_tongue: